LLVM API Documentation
#include <InlinerPass.h>
Public Member Functions | |
| Inliner (void *ID) | |
| Inliner (void *ID, int Threshold) | |
| virtual void | getAnalysisUsage (AnalysisUsage &Info) const |
| virtual bool | runOnSCC (const std::vector< CallGraphNode * > &SCC) |
| virtual bool | doFinalization (CallGraph &CG) |
| bool | InlineCallIfPossible (CallSite CS, CallGraph &CG, const SmallPtrSet< Function *, 8 > &SCCFunctions, const TargetData *TD) |
| unsigned | getInlineThreshold () const |
| virtual InlineCost | getInlineCost (CallSite CS)=0 |
| virtual float | getInlineFudgeFactor (CallSite CS)=0 |
| virtual void | resetCachedCostInfo (Function *Caller)=0 |
| bool | removeDeadFunctions (CallGraph &CG, SmallPtrSet< const Function *, 16 > *DNR=NULL) |
Definition at line 31 of file InlinerPass.h.
| Inliner::Inliner | ( | void * | ID | ) | [explicit] |
Definition at line 39 of file Inliner.cpp.
| Inliner::Inliner | ( | void * | ID, | |
| int | Threshold | |||
| ) | [explicit] |
Definition at line 42 of file Inliner.cpp.
| void Inliner::getAnalysisUsage | ( | AnalysisUsage & | Info | ) | const [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.
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 48 of file Inliner.cpp.
References llvm::CallGraphSCCPass::getAnalysisUsage().
| bool Inliner::runOnSCC | ( | const std::vector< CallGraphNode * > & | SCC | ) | [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.
Implements llvm::CallGraphSCCPass.
Definition at line 128 of file Inliner.cpp.
References BB, llvm::MachineBasicBlock::begin(), Caller, Changed, DEBUG, E, llvm::MachineBasicBlock::end(), llvm::errs(), F, llvm::CallSite::get(), llvm::CallSite::getCalledFunction(), llvm::CallSite::getCaller(), llvm::CallSite::getInstruction(), llvm::Value::getName(), InlineCallIfPossible(), llvm::Function::isDeclaration(), resetCachedCostInfo(), std::swap(), and TD.
doFinalization - This method is called after the SCC's of the program has been processed, allowing the pass to do final cleanup as necessary.
Reimplemented from llvm::CallGraphSCCPass.
Definition at line 226 of file Inliner.cpp.
References removeDeadFunctions().
| bool Inliner::InlineCallIfPossible | ( | CallSite | CS, | |
| CallGraph & | CG, | |||
| const SmallPtrSet< Function *, 8 > & | SCCFunctions, | |||
| const TargetData * | TD | |||
| ) |
Definition at line 54 of file Inliner.cpp.
References llvm::Function::addFnAttr(), Caller, llvm::SmallPtrSet< PtrType, SmallSize >::count(), DEBUG, llvm::errs(), llvm::CallSite::getCalledFunction(), llvm::CallSite::getCaller(), llvm::Value::getName(), llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::Function::hasFnAttr(), llvm::GlobalValue::hasLocalLinkage(), llvm::InlineFunction(), llvm::CallGraph::removeFunctionFromModule(), resetCachedCostInfo(), llvm::Attribute::StackProtect, llvm::Attribute::StackProtectReq, and llvm::Value::use_empty().
Referenced by runOnSCC().
| unsigned llvm::Inliner::getInlineThreshold | ( | ) | const [inline] |
This method returns the value specified by the -inline-threshold value, specified on the command line. This is typically not directly needed.
Definition at line 56 of file InlinerPass.h.
| virtual InlineCost llvm::Inliner::getInlineCost | ( | CallSite | CS | ) | [pure virtual] |
getInlineCost - This method must be implemented by the subclass to determine the cost of inlining the specified call site. If the cost returned is greater than the current inline threshold, the call site is not inlined.
| virtual float llvm::Inliner::getInlineFudgeFactor | ( | CallSite | CS | ) | [pure virtual] |
| virtual void llvm::Inliner::resetCachedCostInfo | ( | Function * | Caller | ) | [pure virtual] |
resetCachedCostInfo - erase any cached cost data from the derived class. If the derived class has no such data this can be empty.
Referenced by InlineCallIfPossible(), removeDeadFunctions(), and runOnSCC().
| bool Inliner::removeDeadFunctions | ( | CallGraph & | CG, | |
| SmallPtrSet< const Function *, 16 > * | DNR = NULL | |||
| ) |
removeDeadFunctions - Remove dead functions that are not included in DNR (Do Not Remove) list.
Definition at line 232 of file Inliner.cpp.
References llvm::CallGraph::begin(), Changed, llvm::SmallPtrSet< PtrType, SmallSize >::count(), E, llvm::CallGraph::end(), F, llvm::CallGraph::getExternalCallingNode(), llvm::CallGraphNode::getFunction(), llvm::CallGraphNode::removeAllCalledFunctions(), llvm::CallGraphNode::removeAnyCallEdgeTo(), llvm::CallGraph::removeFunctionFromModule(), and resetCachedCostInfo().
Referenced by doFinalization().