LLVM  15.0.0git
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::InlineAdvisor Class Referenceabstract

Interface for deciding whether to inline a call site or not. More...

#include "llvm/Analysis/InlineAdvisor.h"

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

Public Member Functions

 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...
 
virtual void onPassEntry ()
 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...
 
virtual void onPassExit (LazyCallGraph::SCC *SCC=nullptr)
 This must be called when the Inliner pass is exited, as function passes may be run subsequently. More...
 
virtual void print (raw_ostream &OS) const
 Support for printer pass. More...
 

Protected Types

enum  MandatoryInliningKind { MandatoryInliningKind::NotMandatory, MandatoryInliningKind::Always, MandatoryInliningKind::Never }
 

Protected Member Functions

 InlineAdvisor (Module &M, FunctionAnalysisManager &FAM)
 
virtual std::unique_ptr< InlineAdvicegetAdviceImpl (CallBase &CB)=0
 
virtual std::unique_ptr< InlineAdvicegetMandatoryAdvice (CallBase &CB, bool Advice)
 
OptimizationRemarkEmittergetCallerORE (CallBase &CB)
 

Static Protected Member Functions

static MandatoryInliningKind getMandatoryKind (CallBase &CB, FunctionAnalysisManager &FAM, OptimizationRemarkEmitter &ORE)
 

Protected Attributes

ModuleM
 
FunctionAnalysisManagerFAM
 
std::unique_ptr< ImportedFunctionsInliningStatisticsImportedFunctionsStats
 

Friends

class InlineAdvice
 

Detailed Description

Interface for deciding whether to inline a call site or not.

Definition at line 140 of file InlineAdvisor.h.

Member Enumeration Documentation

◆ MandatoryInliningKind

Enumerator
NotMandatory 
Always 
Never 

Definition at line 183 of file InlineAdvisor.h.

Constructor & Destructor Documentation

◆ InlineAdvisor() [1/2]

llvm::InlineAdvisor::InlineAdvisor ( InlineAdvisor &&  )
delete

◆ ~InlineAdvisor()

InlineAdvisor::~InlineAdvisor ( )
virtual

◆ InlineAdvisor() [2/2]

InlineAdvisor::InlineAdvisor ( Module M,
FunctionAnalysisManager FAM 
)
protected

Definition at line 503 of file InlineAdvisor.cpp.

References ImportedFunctionsStats, InlinerFunctionImportStats, M, M, and llvm::No.

Member Function Documentation

◆ getAdvice()

std::unique_ptr< InlineAdvice > InlineAdvisor::getAdvice ( CallBase CB,
bool  MandatoryOnly = false 
)

Get an InlineAdvice containing a recommendation on whether to inline or not.

CB is assumed to be a direct call. FAM is assumed to be up-to-date wrt previous inlining decisions. MandatoryOnly indicates only mandatory (always-inline) call sites should be recommended - this allows the InlineAdvisor track such inlininings. Returns:

Definition at line 549 of file InlineAdvisor.cpp.

References Always, FAM, getAdviceImpl(), llvm::CallBase::getCalledFunction(), llvm::CallBase::getCaller(), getCallerORE(), getMandatoryAdvice(), and getMandatoryKind().

◆ getAdviceImpl()

virtual std::unique_ptr<InlineAdvice> llvm::InlineAdvisor::getAdviceImpl ( CallBase CB)
protectedpure virtual

Implemented in llvm::ReplayInlineAdvisor, and llvm::MLInlineAdvisor.

Referenced by getAdvice().

◆ getCallerORE()

OptimizationRemarkEmitter & InlineAdvisor::getCallerORE ( CallBase CB)
protected

◆ getMandatoryAdvice()

std::unique_ptr< InlineAdvice > InlineAdvisor::getMandatoryAdvice ( CallBase CB,
bool  Advice 
)
protectedvirtual

Reimplemented in llvm::MLInlineAdvisor.

Definition at line 520 of file InlineAdvisor.cpp.

References getCallerORE().

Referenced by getAdvice().

◆ getMandatoryKind()

InlineAdvisor::MandatoryInliningKind InlineAdvisor::getMandatoryKind ( CallBase CB,
FunctionAnalysisManager FAM,
OptimizationRemarkEmitter ORE 
)
staticprotected

◆ onPassEntry()

virtual void llvm::InlineAdvisor::onPassEntry ( )
inlinevirtual

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 in llvm::MLInlineAdvisor.

Definition at line 161 of file InlineAdvisor.h.

Referenced by llvm::ModuleInlinerPass::run(), and llvm::InlinerPass::run().

◆ onPassExit()

virtual void llvm::InlineAdvisor::onPassExit ( LazyCallGraph::SCC SCC = nullptr)
inlinevirtual

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 in llvm::MLInlineAdvisor.

Definition at line 166 of file InlineAdvisor.h.

Referenced by llvm::ModuleInlinerPass::run(), and llvm::InlinerPass::run().

◆ print()

virtual void llvm::InlineAdvisor::print ( raw_ostream OS) const
inlinevirtual

Support for printer pass.

Definition at line 169 of file InlineAdvisor.h.

Friends And Related Function Documentation

◆ InlineAdvice

friend class InlineAdvice
friend

Definition at line 192 of file InlineAdvisor.h.

Member Data Documentation

◆ FAM

FunctionAnalysisManager& llvm::InlineAdvisor::FAM
protected

◆ ImportedFunctionsStats

std::unique_ptr<ImportedFunctionsInliningStatistics> llvm::InlineAdvisor::ImportedFunctionsStats
protected

Definition at line 181 of file InlineAdvisor.h.

Referenced by InlineAdvisor(), and ~InlineAdvisor().

◆ M

Module& llvm::InlineAdvisor::M
protected

Definition at line 179 of file InlineAdvisor.h.

Referenced by InlineAdvisor(), and llvm::MLInlineAdvisor::MLInlineAdvisor().


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