LLVM API Documentation
Utility to calculate the size and a few similar metrics for a set of basic blocks. More...
#include <CodeMetrics.h>
Public Member Functions | |
CodeMetrics () | |
void | analyzeBasicBlock (const BasicBlock *BB, const TargetTransformInfo &TTI) |
Add information about a block to the current state. More... | |
Public Attributes | |
bool | exposesReturnsTwice |
True if this function contains a call to setjmp or other functions with attribute "returns twice" without having the attribute itself. More... | |
bool | isRecursive |
True if this function calls itself. More... | |
bool | notDuplicatable |
True if this function cannot be duplicated. More... | |
bool | usesDynamicAlloca |
True if this function calls alloca (in the C sense). More... | |
unsigned | NumInsts |
Number of instructions in the analyzed blocks. More... | |
unsigned | NumBlocks |
Number of analyzed blocks. More... | |
DenseMap< const BasicBlock *, unsigned > | NumBBInsts |
Keeps track of basic block code size estimates. More... | |
unsigned | NumCalls |
Keep track of the number of calls to 'big' functions. More... | |
unsigned | NumInlineCandidates |
The number of calls to internal functions with a single caller. More... | |
unsigned | NumVectorInsts |
How many instructions produce vector values. More... | |
unsigned | NumRets |
How many 'ret' instructions the blocks contain. More... | |
Utility to calculate the size and a few similar metrics for a set of basic blocks.
Definition at line 39 of file CodeMetrics.h.
|
inline |
Definition at line 82 of file CodeMetrics.h.
void CodeMetrics::analyzeBasicBlock | ( | const BasicBlock * | BB, |
const TargetTransformInfo & | TTI | ||
) |
Add information about a block to the current state.
analyzeBasicBlock - Fill in the current structure with information gleaned from the specified block.
Definition at line 25 of file CodeMetrics.cpp.
References llvm::BasicBlock::begin(), llvm::BasicBlock::end(), F(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::BasicBlock::getParent(), llvm::BasicBlock::getTerminator(), llvm::TargetTransformInfo::getUserCost(), llvm::TargetTransformInfo::isLoweredToCall(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isNoInline(), isRecursive, llvm::Attribute::NoDuplicate, notDuplicatable, NumBBInsts, NumBlocks, NumCalls, NumInlineCandidates, NumInsts, NumRets, NumVectorInsts, and usesDynamicAlloca.
Referenced by ApproximateLoopSize().
bool llvm::CodeMetrics::exposesReturnsTwice |
True if this function contains a call to setjmp or other functions with attribute "returns twice" without having the attribute itself.
Definition at line 42 of file CodeMetrics.h.
bool llvm::CodeMetrics::isRecursive |
True if this function calls itself.
Definition at line 45 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
bool llvm::CodeMetrics::notDuplicatable |
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 51 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and ApproximateLoopSize().
DenseMap<const BasicBlock *, unsigned> llvm::CodeMetrics::NumBBInsts |
Keeps track of basic block code size estimates.
Definition at line 63 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
unsigned llvm::CodeMetrics::NumBlocks |
Number of analyzed blocks.
Definition at line 60 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
unsigned llvm::CodeMetrics::NumCalls |
Keep track of the number of calls to 'big' functions.
Definition at line 66 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
unsigned llvm::CodeMetrics::NumInlineCandidates |
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 72 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and ApproximateLoopSize().
unsigned llvm::CodeMetrics::NumInsts |
Number of instructions in the analyzed blocks.
Definition at line 57 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and ApproximateLoopSize().
unsigned llvm::CodeMetrics::NumRets |
How many 'ret' instructions the blocks contain.
Definition at line 80 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
unsigned llvm::CodeMetrics::NumVectorInsts |
How many instructions produce vector values.
The inliner is more aggressive with inlining vector kernels.
Definition at line 77 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
bool llvm::CodeMetrics::usesDynamicAlloca |
True if this function calls alloca (in the C sense).
Definition at line 54 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().