Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
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:
[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.
virtual void onPassEntry (LazyCallGraph::SCC *SCC=nullptr)
 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).
virtual void onPassExit (LazyCallGraph::SCC *SCC=nullptr)
 This must be called when the Inliner pass is exited, as function passes may be run subsequently.
virtual void print (raw_ostream &OS) const
 Support for printer pass.
const chargetAnnotatedInlinePassName () const
 NOTE pass name is annotated only when inline advisor constructor provides InlineContext.

Protected Types

enum class  MandatoryInliningKind { NotMandatory , Always , Never }

Protected Member Functions

 InlineAdvisor (Module &M, FunctionAnalysisManager &FAM, std::optional< InlineContext > IC=std::nullopt)
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
const std::optional< InlineContextIC
const std::string AnnotatedInlinePassName
std::unique_ptr< ImportedFunctionsInliningStatisticsImportedFunctionsStats

Friends

class InlineAdvice

Detailed Description

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

Definition at line 165 of file InlineAdvisor.h.

Member Enumeration Documentation

◆ MandatoryInliningKind

enum class llvm::InlineAdvisor::MandatoryInliningKind
strongprotected
Enumerator
NotMandatory 
Always 
Never 

Definition at line 216 of file InlineAdvisor.h.

Constructor & Destructor Documentation

◆ InlineAdvisor() [1/2]

◆ ~InlineAdvisor()

InlineAdvisor::~InlineAdvisor ( )
virtual

◆ InlineAdvisor() [2/2]

InlineAdvisor::InlineAdvisor ( Module & M,
FunctionAnalysisManager & FAM,
std::optional< InlineContext > IC = std::nullopt )
protected

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 650 of file InlineAdvisor.cpp.

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

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

◆ getAdviceImpl()

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

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

References getMandatoryAdvice().

Referenced by getAdvice().

◆ getAnnotatedInlinePassName()

const char * llvm::InlineAdvisor::getAnnotatedInlinePassName ( ) const
inline

NOTE pass name is annotated only when inline advisor constructor provides InlineContext.

Definition at line 199 of file InlineAdvisor.h.

References AnnotatedInlinePassName.

◆ getCallerORE()

◆ getMandatoryAdvice()

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

Reimplemented in llvm::MLInlineAdvisor.

Definition at line 579 of file InlineAdvisor.cpp.

References getCallerORE().

Referenced by getAdvice(), and getAdviceImpl().

◆ getMandatoryKind()

◆ onPassEntry()

virtual void llvm::InlineAdvisor::onPassEntry ( LazyCallGraph::SCC * SCC = nullptr)
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 186 of file InlineAdvisor.h.

Referenced by llvm::InlinerPass::run(), and llvm::ModuleInlinerPass::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 191 of file InlineAdvisor.h.

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

◆ print()

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

Support for printer pass.

Definition at line 194 of file InlineAdvisor.h.

◆ InlineAdvice

friend class InlineAdvice
friend

Definition at line 225 of file InlineAdvisor.h.

References InlineAdvice.

Referenced by InlineAdvice.

Member Data Documentation

◆ AnnotatedInlinePassName

const std::string llvm::InlineAdvisor::AnnotatedInlinePassName
protected

Definition at line 213 of file InlineAdvisor.h.

Referenced by getAnnotatedInlinePassName(), and InlineAdvisor().

◆ FAM

◆ IC

const std::optional<InlineContext> llvm::InlineAdvisor::IC
protected

◆ ImportedFunctionsStats

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

Definition at line 214 of file InlineAdvisor.h.

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

◆ M


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