LLVM API Documentation
Cost analyzer used by inliner. More...
#include <InlineCost.h>
Public Member Functions | |
InlineCostAnalysis () | |
~InlineCostAnalysis () | |
void | getAnalysisUsage (AnalysisUsage &AU) const override |
bool | runOnSCC (CallGraphSCC &SCC) override |
InlineCost | getInlineCost (CallSite CS, int Threshold) |
Get an InlineCost object representing the cost of inlining this callsite. | |
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. | |
bool | isInlineViable (Function &Callee) |
Minimal filter to detect invalid constructs for inlining. | |
Static Public Attributes | |
static char | ID = 0 |
Cost analyzer used by inliner.
Definition at line 102 of file InlineCost.h.
Definition at line 1242 of file InlineCost.cpp.
Definition at line 1244 of file InlineCost.cpp.
void InlineCostAnalysis::getAnalysisUsage | ( | AnalysisUsage & | AU | ) | const [override, 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 1246 of file InlineCost.cpp.
References llvm::AnalysisUsage::addRequired(), 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 1259 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 1279 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::GlobalValue::getDataLayout(), llvm::Value::getName(), llvm::InlineCost::getNever(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::hasFnAttr(), llvm::Function::hasFnAttribute(), isInlineViable(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::isNoInline(), llvm::GlobalValue::mayBeOverridden(), llvm::Attribute::NoInline, llvm::Attribute::OptimizeNone, and Threshold.
bool InlineCostAnalysis::isInlineViable | ( | Function & | Callee | ) |
Minimal filter to detect invalid constructs for inlining.
Definition at line 1326 of file InlineCost.cpp.
References llvm::Function::begin(), llvm::Function::end(), llvm::AttributeSet::FunctionIndex, 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().
bool InlineCostAnalysis::runOnSCC | ( | CallGraphSCC & | SCC | ) | [override, 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 1253 of file InlineCost.cpp.
Inline Cost true char InlineCostAnalysis::ID = 0 [inline, static] |
Definition at line 107 of file InlineCost.h.