LLVM  14.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::MLInlineAdvisor Class Reference

#include "llvm/Analysis/MLInlineAdvisor.h"

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

Public Member Functions

 MLInlineAdvisor (Module &M, ModuleAnalysisManager &MAM, std::unique_ptr< MLModelRunner > ModelRunner)
 
virtual ~MLInlineAdvisor ()=default
 
void onPassEntry () override
 This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal state, as result of function passes run between Inliner pass runs (for the same module). More...
 
void onPassExit (LazyCallGraph::SCC *SCC) override
 This must be called when the Inliner pass is exited, as function passes may be run subsequently. More...
 
int64_t getIRSize (const Function &F) const
 
void onSuccessfulInlining (const MLInlineAdvice &Advice, bool CalleeWasDeleted)
 
bool isForcedToStop () const
 
int64_t getLocalCalls (Function &F)
 
const MLModelRunnergetModelRunner () const
 
- Public Member Functions inherited from llvm::InlineAdvisor
 InlineAdvisor (InlineAdvisor &&)=delete
 
virtual ~InlineAdvisor ()
 
std::unique_ptr< InlineAdvicegetAdvice (CallBase &CB, bool MandatoryOnly=false)
 Get an InlineAdvice containing a recommendation on whether to inline or not. More...
 

Protected Member Functions

std::unique_ptr< InlineAdvicegetAdviceImpl (CallBase &CB) override
 
std::unique_ptr< InlineAdvicegetMandatoryAdvice (CallBase &CB, bool Advice) override
 
virtual std::unique_ptr< MLInlineAdvicegetMandatoryAdviceImpl (CallBase &CB)
 
virtual std::unique_ptr< MLInlineAdvicegetAdviceFromModel (CallBase &CB, OptimizationRemarkEmitter &ORE)
 
unsigned getInitialFunctionLevel (const Function &F) const
 
- Protected Member Functions inherited from llvm::InlineAdvisor
 InlineAdvisor (Module &M, FunctionAnalysisManager &FAM)
 
OptimizationRemarkEmittergetCallerORE (CallBase &CB)
 

Protected Attributes

std::unique_ptr< MLModelRunnerModelRunner
 
- Protected Attributes inherited from llvm::InlineAdvisor
ModuleM
 
FunctionAnalysisManagerFAM
 
std::unique_ptr< ImportedFunctionsInliningStatisticsImportedFunctionsStats
 

Additional Inherited Members

- Protected Types inherited from llvm::InlineAdvisor
enum  MandatoryInliningKind { MandatoryInliningKind::NotMandatory, MandatoryInliningKind::Always, MandatoryInliningKind::Never }
 
- Static Protected Member Functions inherited from llvm::InlineAdvisor
static MandatoryInliningKind getMandatoryKind (CallBase &CB, FunctionAnalysisManager &FAM, OptimizationRemarkEmitter &ORE)
 

Detailed Description

Definition at line 24 of file MLInlineAdvisor.h.

Constructor & Destructor Documentation

◆ MLInlineAdvisor()

MLInlineAdvisor::MLInlineAdvisor ( Module M,
ModuleAnalysisManager MAM,
std::unique_ptr< MLModelRunner ModelRunner 
)

◆ ~MLInlineAdvisor()

virtual llvm::MLInlineAdvisor::~MLInlineAdvisor ( )
virtualdefault

Member Function Documentation

◆ getAdviceFromModel()

std::unique_ptr< MLInlineAdvice > MLInlineAdvisor::getAdviceFromModel ( CallBase CB,
OptimizationRemarkEmitter ORE 
)
protectedvirtual

Definition at line 345 of file MLInlineAdvisor.cpp.

References ModelRunner.

Referenced by getAdviceImpl().

◆ getAdviceImpl()

std::unique_ptr< InlineAdvice > MLInlineAdvisor::getAdviceImpl ( CallBase CB)
overrideprotectedvirtual

◆ getInitialFunctionLevel()

unsigned MLInlineAdvisor::getInitialFunctionLevel ( const Function F) const
protected

Definition at line 137 of file MLInlineAdvisor.cpp.

References F, and llvm::LazyCallGraph::lookup().

Referenced by getAdviceImpl().

◆ getIRSize()

int64_t llvm::MLInlineAdvisor::getIRSize ( const Function F) const
inline

Definition at line 34 of file MLInlineAdvisor.h.

References F.

Referenced by onSuccessfulInlining().

◆ getLocalCalls()

int64_t MLInlineAdvisor::getLocalCalls ( Function F)

◆ getMandatoryAdvice()

std::unique_ptr< InlineAdvice > MLInlineAdvisor::getMandatoryAdvice ( CallBase CB,
bool  Advice 
)
overrideprotectedvirtual

Reimplemented from llvm::InlineAdvisor.

Definition at line 351 of file MLInlineAdvisor.cpp.

References llvm::InlineAdvisor::getCallerORE(), and getMandatoryAdviceImpl().

Referenced by getAdviceImpl().

◆ getMandatoryAdviceImpl()

std::unique_ptr< MLInlineAdvice > MLInlineAdvisor::getMandatoryAdviceImpl ( CallBase CB)
protectedvirtual

Definition at line 365 of file MLInlineAdvisor.cpp.

References llvm::InlineAdvisor::getCallerORE().

Referenced by getMandatoryAdvice().

◆ getModelRunner()

const MLModelRunner& llvm::MLInlineAdvisor::getModelRunner ( ) const
inline

Definition at line 40 of file MLInlineAdvisor.h.

References ModelRunner.

◆ isForcedToStop()

bool llvm::MLInlineAdvisor::isForcedToStop ( ) const
inline

Definition at line 38 of file MLInlineAdvisor.h.

◆ onPassEntry()

void MLInlineAdvisor::onPassEntry ( )
overridevirtual

This must be called when the Inliner pass is entered, to allow the InlineAdvisor update internal state, as result of function passes run between Inliner pass runs (for the same module).

Reimplemented from llvm::InlineAdvisor.

Definition at line 141 of file MLInlineAdvisor.cpp.

References assert(), E, getLocalCalls(), I, and N.

◆ onPassExit()

void MLInlineAdvisor::onPassExit ( LazyCallGraph::SCC SCC)
overridevirtual

This must be called when the Inliner pass is exited, as function passes may be run subsequently.

This allows an implementation of InlineAdvisor to prepare for a partial update, based on the optional SCC.

Reimplemented from llvm::InlineAdvisor.

Definition at line 179 of file MLInlineAdvisor.cpp.

References assert(), getLocalCalls(), N, and llvm::LazyCallGraph::SCC::size().

◆ onSuccessfulInlining()

void MLInlineAdvisor::onSuccessfulInlining ( const MLInlineAdvice Advice,
bool  CalleeWasDeleted 
)

Member Data Documentation

◆ ModelRunner

std::unique_ptr<MLModelRunner> llvm::MLInlineAdvisor::ModelRunner
protected

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