LLVM API Documentation
Cost analyzer used by inliner. More...
#include <InlineCost.h>
Public Member Functions | |
InlineCostAnalysis () | |
~InlineCostAnalysis () | |
void | getAnalysisUsage (AnalysisUsage &AU) const |
bool | runOnSCC (CallGraphSCC &SCC) |
InlineCost | getInlineCost (CallSite CS, int Threshold) |
Get an InlineCost object representing the cost of inlining this callsite. More... | |
InlineCost | getInlineCost (CallSite CS, Function *Callee, int Threshold) |
Get an InlineCost with the callee explicitly specified. This allows you to calculate the cost of inlining a function via a pointer. This behaves exactly as the version with no explicit callee parameter in all other respects. More... | |
bool | isInlineViable (Function &Callee) |
Minimal filter to detect invalid constructs for inlining. More... | |
![]() | |
CallGraphSCCPass (char &pid) | |
Pass * | createPrinterPass (raw_ostream &O, const std::string &Banner) const |
virtual bool | doInitialization (CallGraph &CG) |
virtual bool | doFinalization (CallGraph &CG) |
virtual void | assignPassManager (PMStack &PMS, PassManagerType PMT) |
Assign pass manager to manager this pass. More... | |
virtual PassManagerType | getPotentialPassManagerType () const |
Return what kind of Pass Manager can manage this pass. More... | |
![]() | |
Pass (PassKind K, char &pid) | |
virtual | ~Pass () |
PassKind | getPassKind () const |
virtual const char * | getPassName () const |
AnalysisID | getPassID () const |
getPassID - Return the PassID number that corresponds to this pass. More... | |
virtual bool | doInitialization (Module &) |
virtual bool | doFinalization (Module &) |
virtual void | print (raw_ostream &O, const Module *M) const |
void | dump () const |
virtual void | preparePassManager (PMStack &) |
Check if available pass managers are suitable for this pass or not. More... | |
void | setResolver (AnalysisResolver *AR) |
AnalysisResolver * | getResolver () const |
virtual void | releaseMemory () |
virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
virtual ImmutablePass * | getAsImmutablePass () |
virtual PMDataManager * | getAsPMDataManager () |
virtual void | verifyAnalysis () const |
virtual void | dumpPassStructure (unsigned Offset=0) |
template<typename AnalysisType > | |
AnalysisType * | getAnalysisIfAvailable () const |
bool | mustPreserveAnalysisID (char &AID) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis () const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis (Function &F) |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Attributes | |
static char | ID = 0 |
Additional Inherited Members | |
![]() | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
Cost analyzer used by inliner.
Definition at line 101 of file InlineCost.h.
InlineCostAnalysis::InlineCostAnalysis | ( | ) |
Definition at line 1154 of file InlineCost.cpp.
InlineCostAnalysis::~InlineCostAnalysis | ( | ) |
Definition at line 1156 of file InlineCost.cpp.
|
virtual |
getAnalysisUsage - For this class, we declare that we require and preserve the call graph. If the derived class implements this method, it should always explicitly call the implementation here.
Reimplemented from llvm::CallGraphSCCPass.
Definition at line 1158 of file InlineCost.cpp.
References llvm::AnalysisUsage::addRequired(), llvm::CallGraphSCCPass::getAnalysisUsage(), and llvm::AnalysisUsage::setPreservesAll().
InlineCost InlineCostAnalysis::getInlineCost | ( | CallSite | CS, |
int | Threshold | ||
) |
Get an InlineCost object representing the cost of inlining this callsite.
Note that threshold is passed into this function. Only costs below the threshold are computed with any accuracy. The threshold can be used to bound the computation necessary to determine whether the cost is sufficiently low to warrant inlining.
Also note that calling this function dynamically computes the cost of inlining the callsite. It is an expensive, heavyweight call.
Definition at line 1170 of file InlineCost.cpp.
References llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), and Threshold.
InlineCost InlineCostAnalysis::getInlineCost | ( | CallSite | CS, |
Function * | Callee, | ||
int | Threshold | ||
) |
Get an InlineCost with the callee explicitly specified. This allows you to calculate the cost of inlining a function via a pointer. This behaves exactly as the version with no explicit callee parameter in all other respects.
Definition at line 1190 of file InlineCost.cpp.
References llvm::Attribute::AlwaysInline, llvm::dbgs(), DEBUG, functionsHaveCompatibleAttributes(), llvm::InlineCost::get(), llvm::InlineCost::getAlways(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCaller(), llvm::Value::getName(), llvm::InlineCost::getNever(), llvm::Function::hasFnAttribute(), isInlineViable(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isNoInline(), llvm::GlobalValue::mayBeOverridden(), llvm::Attribute::NoInline, llvm::Attribute::OptimizeNone, and TD.
Minimal filter to detect invalid constructs for inlining.
Definition at line 1237 of file InlineCost.cpp.
References llvm::Function::begin(), llvm::Function::end(), llvm::Function::getAttributes(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::AttributeSet::hasAttribute(), llvm::ARM_PROC::IE, llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isCall(), and llvm::Attribute::ReturnsTwice.
Referenced by getInlineCost().
|
virtual |
runOnSCC - This method should be implemented by the subclass to perform whatever action is necessary for the specified SCC. Note that non-recursive (or only self-recursive) functions will have an SCC size of 1, where recursive portions of the call graph will have SCC size > 1.
SCC passes that add or delete functions to the SCC are required to update the SCC list, otherwise stale pointers may be dereferenced.
Implements llvm::CallGraphSCCPass.
Definition at line 1164 of file InlineCost.cpp.
References TD.
|
inlinestatic |
Definition at line 106 of file InlineCost.h.