LLVM
8.0.1
|
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 | |
void | analyzeBasicBlock (const BasicBlock *BB, const TargetTransformInfo &TTI, const SmallPtrSetImpl< const Value *> &EphValues) |
Add information about a block to the current state. More... | |
Static Public Member Functions | |
static 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). More... | |
static 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). More... | |
Public Attributes | |
bool | exposesReturnsTwice = false |
True if this function contains a call to setjmp or other functions with attribute "returns twice" without having the attribute itself. More... | |
bool | isRecursive = false |
True if this function calls itself. More... | |
bool | notDuplicatable = false |
True if this function cannot be duplicated. More... | |
bool | convergent = false |
True if this function contains a call to a convergent function. More... | |
bool | usesDynamicAlloca = false |
True if this function calls alloca (in the C sense). More... | |
unsigned | NumInsts = false |
Number of instructions in the analyzed blocks. More... | |
unsigned | NumBlocks = false |
Number of analyzed blocks. More... | |
DenseMap< const BasicBlock *, unsigned > | NumBBInsts |
Keeps track of basic block code size estimates. More... | |
unsigned | NumCalls = false |
Keep track of the number of calls to 'big' functions. More... | |
unsigned | NumInlineCandidates = 0 |
The number of calls to internal functions with a single caller. More... | |
unsigned | NumVectorInsts = 0 |
How many instructions produce vector values. More... | |
unsigned | NumRets = 0 |
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 42 of file CodeMetrics.h.
void CodeMetrics::analyzeBasicBlock | ( | const BasicBlock * | BB, |
const TargetTransformInfo & | TTI, | ||
const SmallPtrSetImpl< const Value *> & | EphValues | ||
) |
Add information about a block to the current state.
Fill in the current structure with information gleaned from the specified block.
Definition at line 118 of file CodeMetrics.cpp.
References convergent, llvm::SmallPtrSetImpl< PtrType >::count(), F(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::TargetTransformInfo::getUserCost(), I, llvm::TargetTransformInfo::isLoweredToCall(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::isNoInline(), isRecursive, notDuplicatable, NumBBInsts, NumBlocks, NumCalls, NumInlineCandidates, NumInsts, NumRets, NumVectorInsts, and usesDynamicAlloca.
Referenced by llvm::ApproximateLoopSize(), asmClobbersCTR(), llvm::LoopDataPrefetchPass::run(), and shouldRotateLoopExitingLatch().
|
static |
Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop).
Definition at line 72 of file CodeMetrics.cpp.
References appendSpeculatableOperands(), llvm::AssumptionCache::assumptions(), completeEphemeralValues(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::Instruction::getParent(), I, and llvm::SmallPtrSetImpl< PtrType >::insert().
Referenced by asmClobbersCTR(), llvm::slpvectorizer::BoUpSLP::BoUpSLP(), llvm::LoopVectorizationCostModel::collectValuesToIgnore(), llvm::IVUsers::IVUsers(), llvm::LoopDataPrefetchPass::run(), shouldRotateLoopExitingLatch(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), and unswitchBestCondition().
|
static |
Collect a functions's ephemeral values (those used only by an assume or similar intrinsics in the function).
Definition at line 96 of file CodeMetrics.cpp.
References appendSpeculatableOperands(), assert(), llvm::AssumptionCache::assumptions(), completeEphemeralValues(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), I, and llvm::SmallPtrSetImpl< PtrType >::insert().
True if this function contains a call to a convergent function.
Definition at line 57 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), llvm::ApproximateLoopSize(), and shouldRotateLoopExitingLatch().
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(), llvm::ApproximateLoopSize(), and shouldRotateLoopExitingLatch().
DenseMap<const BasicBlock *, unsigned> llvm::CodeMetrics::NumBBInsts |
Keeps track of basic block code size estimates.
Definition at line 69 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
Number of analyzed blocks.
Definition at line 66 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
Keep track of the number of calls to 'big' functions.
Definition at line 72 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
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 78 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), and llvm::ApproximateLoopSize().
Number of instructions in the analyzed blocks.
Definition at line 63 of file CodeMetrics.h.
Referenced by analyzeBasicBlock(), llvm::ApproximateLoopSize(), asmClobbersCTR(), llvm::LoopDataPrefetchPass::run(), and shouldRotateLoopExitingLatch().
unsigned llvm::CodeMetrics::NumRets = 0 |
How many 'ret' instructions the blocks contain.
Definition at line 86 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
unsigned llvm::CodeMetrics::NumVectorInsts = 0 |
How many instructions produce vector values.
The inliner is more aggressive with inlining vector kernels.
Definition at line 83 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().
True if this function calls alloca (in the C sense).
Definition at line 60 of file CodeMetrics.h.
Referenced by analyzeBasicBlock().