LLVM 24.0.0git
llvm::CodeMetrics Struct Reference

Utility to calculate the size and a few similar metrics for a set of basic blocks. More...

#include "llvm/Analysis/CodeMetrics.h"

Public Member Functions

LLVM_ABI void analyzeBasicBlock (const BasicBlock *BB, const TargetTransformInfo &TTI, const SmallPtrSetImpl< const Value * > &EphValues, bool PrepareForLTO=false, const Loop *L=nullptr)
 Add information about a block to the current state.

Static Public Member Functions

static LLVM_ABI void collectEphemeralValues (const Loop *L, AssumptionCache *AC, SmallPtrSetImpl< const Value * > &EphValues)
 Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop).
static LLVM_ABI void collectEphemeralValues (const Function *L, AssumptionCache *AC, SmallPtrSetImpl< const Value * > &EphValues)
 Collect a functions's ephemeral values (those used only by an assume or similar intrinsics in the function).

Public Attributes

bool isRecursive = false
 True if this function calls itself.
bool notDuplicatable = false
 True if this function cannot be duplicated.
bool usesDynamicAlloca = false
 True if this function calls alloca (in the C sense).
ConvergenceKind Convergence = ConvergenceKind::None
 The kind of convergence specified in this function.
InstructionCost NumInsts = 0
 Code size cost of the analyzed blocks.
SmallVector< InstructionCost, 0 > NumBBInsts
 Keeps track of basic block code size estimates. Indexed by block number.
unsigned NumInlineCandidates = 0
 The number of calls to internal functions with a single caller.
unsigned NumVectorInsts = 0
 How many instructions produce vector values.
unsigned NumRets = 0
 How many 'ret' instructions the blocks contain.

Detailed Description

Utility to calculate the size and a few similar metrics for a set of basic blocks.

Definition at line 34 of file CodeMetrics.h.

Member Function Documentation

◆ analyzeBasicBlock()

◆ collectEphemeralValues() [1/2]

void CodeMetrics::collectEphemeralValues ( const Function * L,
AssumptionCache * AC,
SmallPtrSetImpl< const Value * > & EphValues )
static

Collect a functions's ephemeral values (those used only by an assume or similar intrinsics in the function).

Definition at line 95 of file CodeMetrics.cpp.

References appendSpeculatableOperands(), assert(), llvm::AssumptionCache::assumptions(), llvm::cast(), completeEphemeralValues(), F, I, and llvm::SmallPtrSetImpl< PtrType >::insert().

◆ collectEphemeralValues() [2/2]

Member Data Documentation

◆ Convergence

ConvergenceKind llvm::CodeMetrics::Convergence = ConvergenceKind::None

The kind of convergence specified in this function.

Definition at line 48 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ isRecursive

bool llvm::CodeMetrics::isRecursive = false

True if this function calls itself.

Definition at line 36 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ notDuplicatable

bool llvm::CodeMetrics::notDuplicatable = false

True if this function cannot be duplicated.

True if this function contains one or more indirect branches, or it contains one or more 'noduplicate' instructions.

Definition at line 42 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ NumBBInsts

SmallVector<InstructionCost, 0> llvm::CodeMetrics::NumBBInsts

Keeps track of basic block code size estimates. Indexed by block number.

Definition at line 54 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ NumInlineCandidates

unsigned llvm::CodeMetrics::NumInlineCandidates = 0

The number of calls to internal functions with a single caller.

These are likely targets for future inlining, likely exposed by interleaved devirtualization.

Definition at line 60 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ NumInsts

InstructionCost llvm::CodeMetrics::NumInsts = 0

Code size cost of the analyzed blocks.

Definition at line 51 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ NumRets

unsigned llvm::CodeMetrics::NumRets = 0

How many 'ret' instructions the blocks contain.

Definition at line 68 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ NumVectorInsts

unsigned llvm::CodeMetrics::NumVectorInsts = 0

How many instructions produce vector values.

The inliner is more aggressive with inlining vector kernels.

Definition at line 65 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().

◆ usesDynamicAlloca

bool llvm::CodeMetrics::usesDynamicAlloca = false

True if this function calls alloca (in the C sense).

Definition at line 45 of file CodeMetrics.h.

Referenced by analyzeBasicBlock().


The documentation for this struct was generated from the following files: