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, SmallPtrSetImpl< const Value * > &EphValues) |
Add information about a block to the current state. | |
Static Public Member Functions | |
static void | collectEphemeralValues (const Loop *L, AssumptionTracker *AT, SmallPtrSetImpl< const Value * > &EphValues) |
Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop). | |
static void | collectEphemeralValues (const Function *L, AssumptionTracker *AT, 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 | exposesReturnsTwice |
True if this function contains a call to setjmp or other functions with attribute "returns twice" without having the attribute itself. | |
bool | isRecursive |
True if this function calls itself. | |
bool | notDuplicatable |
True if this function cannot be duplicated. | |
bool | usesDynamicAlloca |
True if this function calls alloca (in the C sense). | |
unsigned | NumInsts |
Number of instructions in the analyzed blocks. | |
unsigned | NumBlocks |
Number of analyzed blocks. | |
DenseMap< const BasicBlock *, unsigned > | NumBBInsts |
Keeps track of basic block code size estimates. | |
unsigned | NumCalls |
Keep track of the number of calls to 'big' functions. | |
unsigned | NumInlineCandidates |
The number of calls to internal functions with a single caller. | |
unsigned | NumVectorInsts |
How many instructions produce vector values. | |
unsigned | NumRets |
How many 'ret' instructions the blocks contain. |
Utility to calculate the size and a few similar metrics for a set of basic blocks.
Definition at line 42 of file CodeMetrics.h.
llvm::CodeMetrics::CodeMetrics | ( | ) | [inline] |
Definition at line 85 of file CodeMetrics.h.
void CodeMetrics::analyzeBasicBlock | ( | const BasicBlock * | BB, |
const TargetTransformInfo & | TTI, | ||
SmallPtrSetImpl< const Value * > & | EphValues | ||
) |
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 96 of file CodeMetrics.cpp.
References llvm::BasicBlock::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), 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, notDuplicatable, NumBBInsts, NumBlocks, NumCalls, NumInlineCandidates, NumInsts, NumRets, NumVectorInsts, and usesDynamicAlloca.
Referenced by ApproximateLoopSize().
void CodeMetrics::collectEphemeralValues | ( | const Loop * | L, |
AssumptionTracker * | AT, | ||
SmallPtrSetImpl< const Value * > & | EphValues | ||
) | [static] |
Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop).
Definition at line 67 of file CodeMetrics.cpp.
References llvm::AssumptionTracker::assumptions(), completeEphemeralValues(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::BasicBlock::getParent(), I, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by ApproximateLoopSize().
void CodeMetrics::collectEphemeralValues | ( | const Function * | L, |
AssumptionTracker * | AT, | ||
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 84 of file CodeMetrics.cpp.
References llvm::AssumptionTracker::assumptions(), completeEphemeralValues(), I, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
True if this function contains a call to setjmp or other functions with attribute "returns twice" without having the attribute itself.
Definition at line 45 of file CodeMetrics.h.
True if this function calls itself.
Definition at line 48 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
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 54 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and ApproximateLoopSize().
Keeps track of basic block code size estimates.
Definition at line 66 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
Number of analyzed blocks.
Definition at line 63 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
Keep track of the number of calls to 'big' functions.
Definition at line 69 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
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 75 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and ApproximateLoopSize().
Number of instructions in the analyzed blocks.
Definition at line 60 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and ApproximateLoopSize().
How many 'ret' instructions the blocks contain.
Definition at line 83 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
How many instructions produce vector values.
The inliner is more aggressive with inlining vector kernels.
Definition at line 80 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
True if this function calls alloca (in the C sense).
Definition at line 57 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().