LLVM API Documentation
#include <InlinerPass.h>
Public Member Functions | |
Inliner (char &ID) | |
Inliner (char &ID, int Threshold, bool InsertLifetime) | |
virtual void | getAnalysisUsage (AnalysisUsage &Info) const |
virtual bool | runOnSCC (CallGraphSCC &SCC) |
virtual bool | doFinalization (CallGraph &CG) |
unsigned | getInlineThreshold () const |
unsigned | getInlineThreshold (CallSite CS) const |
virtual InlineCost | getInlineCost (CallSite CS)=0 |
bool | removeDeadFunctions (CallGraph &CG, bool AlwaysInlineOnly=false) |
![]() | |
CallGraphSCCPass (char &pid) | |
Pass * | createPrinterPass (raw_ostream &O, const std::string &Banner) const |
virtual bool | doInitialization (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) |
Additional Inherited Members | |
![]() | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
Inliner - This class contains all of the helper code which is used to perform the inlining operations that do not depend on the policy.
Definition at line 32 of file InlinerPass.h.
|
explicit |
Definition at line 56 of file Inliner.cpp.
|
explicit |
Definition at line 59 of file Inliner.cpp.
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 572 of file Inliner.cpp.
References removeDeadFunctions().
|
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 67 of file Inliner.cpp.
References llvm::CallGraphSCCPass::getAnalysisUsage().
|
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.
|
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 53 of file InlinerPass.h.
Calculate the inline threshold for given Caller. This threshold is lower if the caller is marked with OptimizeForSize and -inline-threshold is not given on the comand line. It is higher if the callee is marked with the inlinehint attribute.
Definition at line 255 of file Inliner.cpp.
References llvm::Function::getAttributes(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCaller(), llvm::AttributeSet::hasAttribute(), HintThreshold, llvm::Attribute::InlineHint, InlineLimit, llvm::GlobalValue::isDeclaration(), llvm::Attribute::MinSize, llvm::Attribute::OptimizeForSize, and OptSizeThreshold.
removeDeadFunctions - Remove dead functions.
This also includes a hack in the form of the 'AlwaysInlineOnly' flag which restricts it to deleting functions with an 'AlwaysInline' attribute. This is useful for the InlineAlways pass that only wants to deal with that subset of the functions.
removeDeadFunctions - Remove dead functions that are not included in DNR (Do Not Remove) list.
Definition at line 578 of file Inliner.cpp.
References llvm::Attribute::AlwaysInline, llvm::array_pod_sort(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::CallGraph::begin(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::CallGraph::end(), llvm::SmallVectorImpl< T >::erase(), F(), llvm::Function::getAttributes(), llvm::CallGraph::getExternalCallingNode(), llvm::CallGraphNode::getFunction(), llvm::AttributeSet::hasAttribute(), I, llvm::GlobalValue::isDeclaration(), llvm::Function::isDefTriviallyDead(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::CallGraphNode::removeAllCalledFunctions(), llvm::CallGraphNode::removeAnyCallEdgeTo(), llvm::Constant::removeDeadConstantUsers(), and llvm::CallGraph::removeFunctionFromModule().
Referenced by doFinalization().
|
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 397 of file Inliner.cpp.
References llvm::SmallVectorTemplateCommon< T >::back(), llvm::CallGraphSCC::begin(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::Function::begin(), llvm::dbgs(), DEBUG, llvm::SmallVectorBase::empty(), llvm::CallGraphSCC::end(), llvm::Function::end(), llvm::SmallVectorImpl< T >::erase(), llvm::Instruction::eraseFromParent(), F(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCaller(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::Value::getName(), llvm::GlobalValue::hasLocalLinkage(), I, InlineCallIfPossible(), llvm::InlineFunctionInfo::InlinedCalls, InlineHistoryIncludes(), llvm::GlobalValue::isDeclaration(), llvm::isInstructionTriviallyDead(), llvm::CallGraphSCC::isSingular(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::pop_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::CallGraph::removeFunctionFromModule(), llvm::SmallVectorTemplateCommon< T >::size(), std::swap(), TD, and llvm::Value::use_empty().