LLVM  15.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 (LazyCallGraph::SCC *SCC) 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 (Function &F) const
 
void onSuccessfulInlining (const MLInlineAdvice &Advice, bool CalleeWasDeleted)
 
bool isForcedToStop () const
 
int64_t getLocalCalls (Function &F)
 
const MLModelRunnergetModelRunner () const
 
FunctionPropertiesInfogetCachedFPI (Function &) 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...
 
const char * getAnnotatedInlinePassName () const
 NOTE pass name is annotated only when inline advisor constructor provides InlineContext. 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, Optional< InlineContext > IC=NoneType::None)
 
OptimizationRemarkEmittergetCallerORE (CallBase &CB)
 

Protected Attributes

std::unique_ptr< MLModelRunnerModelRunner
 
- Protected Attributes inherited from llvm::InlineAdvisor
ModuleM
 
FunctionAnalysisManagerFAM
 
const Optional< InlineContextIC
 
const std::string AnnotatedInlinePassName
 
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 27 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 379 of file MLInlineAdvisor.cpp.

References ModelRunner.

Referenced by getAdviceImpl().

◆ getAdviceImpl()

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

◆ getCachedFPI()

FunctionPropertiesInfo & MLInlineAdvisor::getCachedFPI ( Function F) const

◆ getInitialFunctionLevel()

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

Definition at line 138 of file MLInlineAdvisor.cpp.

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

Referenced by getAdviceImpl().

◆ getIRSize()

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

◆ 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 393 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 409 of file MLInlineAdvisor.cpp.

References llvm::InlineAdvisor::getCallerORE().

Referenced by getMandatoryAdvice().

◆ getModelRunner()

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

Definition at line 45 of file MLInlineAdvisor.h.

References ModelRunner.

◆ isForcedToStop()

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

Definition at line 43 of file MLInlineAdvisor.h.

◆ onPassEntry()

void MLInlineAdvisor::onPassEntry ( LazyCallGraph::SCC SCC)
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 142 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 189 of file MLInlineAdvisor.cpp.

References assert(), getFunction(), getLocalCalls(), I, KeepFPICache, and N.

◆ 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: