LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | List of all members
llvm::InlineCostAnalysis Class Reference

Cost analyzer used by inliner. More...

#include <InlineCost.h>

Inheritance diagram for llvm::InlineCostAnalysis:
Inheritance graph
[legend]
Collaboration diagram for llvm::InlineCostAnalysis:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from llvm::CallGraphSCCPass
 CallGraphSCCPass (char &pid)
 
PasscreatePrinterPass (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...
 
- Public Member Functions inherited from llvm::Pass
 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)
 
AnalysisResolvergetResolver () const
 
virtual void releaseMemory ()
 
virtual void * getAdjustedAnalysisPointer (AnalysisID ID)
 
virtual ImmutablePassgetAsImmutablePass ()
 
virtual PMDataManagergetAsPMDataManager ()
 
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 Public Member Functions inherited from llvm::Pass
static const PassInfolookupPassInfo (const void *TI)
 
static const PassInfolookupPassInfo (StringRef Arg)
 
static PasscreatePass (AnalysisID ID)
 

Detailed Description

Cost analyzer used by inliner.

Definition at line 101 of file InlineCost.h.

Constructor & Destructor Documentation

InlineCostAnalysis::InlineCostAnalysis ( )

Definition at line 1154 of file InlineCost.cpp.

InlineCostAnalysis::~InlineCostAnalysis ( )

Definition at line 1156 of file InlineCost.cpp.

Member Function Documentation

void InlineCostAnalysis::getAnalysisUsage ( AnalysisUsage AU) 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.

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 
)
bool InlineCostAnalysis::isInlineViable ( Function Callee)
bool InlineCostAnalysis::runOnSCC ( CallGraphSCC 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.

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.

Member Data Documentation

Inline Cost true char InlineCostAnalysis::ID = 0
inlinestatic

Definition at line 106 of file InlineCost.h.


The documentation for this class was generated from the following files: