LLVM 17.0.0git
|
Interface for deciding whether to inline a call site or not. More...
#include "llvm/Analysis/InlineAdvisor.h"
Public Member Functions | |
InlineAdvisor (InlineAdvisor &&)=delete | |
virtual | ~InlineAdvisor () |
std::unique_ptr< InlineAdvice > | getAdvice (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 char * | getAnnotatedInlinePassName () 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< InlineAdvice > | getAdviceImpl (CallBase &CB)=0 |
virtual std::unique_ptr< InlineAdvice > | getMandatoryAdvice (CallBase &CB, bool Advice) |
OptimizationRemarkEmitter & | getCallerORE (CallBase &CB) |
Static Protected Member Functions | |
static MandatoryInliningKind | getMandatoryKind (CallBase &CB, FunctionAnalysisManager &FAM, OptimizationRemarkEmitter &ORE) |
Protected Attributes | |
Module & | M |
FunctionAnalysisManager & | FAM |
const std::optional< InlineContext > | IC |
const std::string | AnnotatedInlinePassName |
std::unique_ptr< ImportedFunctionsInliningStatistics > | ImportedFunctionsStats |
Friends | |
class | InlineAdvice |
Interface for deciding whether to inline a call site or not.
Definition at line 165 of file InlineAdvisor.h.
|
strongprotected |
Enumerator | |
---|---|
NotMandatory | |
Always | |
Never |
Definition at line 216 of file InlineAdvisor.h.
|
delete |
|
virtual |
Definition at line 534 of file InlineAdvisor.cpp.
References assert(), ImportedFunctionsStats, llvm::InlinerFunctionImportStats, llvm::No, and llvm::Verbose.
|
protected |
Definition at line 521 of file InlineAdvisor.cpp.
References ImportedFunctionsStats, llvm::InlinerFunctionImportStats, M, and llvm::No.
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 613 of file InlineAdvisor.cpp.
References Always, FAM, getAdviceImpl(), llvm::CallBase::getCalledFunction(), llvm::CallBase::getCaller(), getCallerORE(), getMandatoryAdvice(), and getMandatoryKind().
|
protectedpure virtual |
Implemented in llvm::MLInlineAdvisor, and llvm::ReplayInlineAdvisor.
Referenced by getAdvice().
NOTE pass name is annotated only when inline advisor constructor provides InlineContext.
Definition at line 199 of file InlineAdvisor.h.
References AnnotatedInlinePassName.
|
protected |
Definition at line 623 of file InlineAdvisor.cpp.
References FAM, llvm::CallBase::getCaller(), and llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getResult().
Referenced by getAdvice(), getMandatoryAdvice(), llvm::MLInlineAdvisor::getMandatoryAdvice(), and llvm::MLInlineAdvisor::getMandatoryAdviceImpl().
|
protectedvirtual |
Reimplemented in llvm::MLInlineAdvisor.
Definition at line 542 of file InlineAdvisor.cpp.
References getCallerORE().
Referenced by getAdvice().
|
staticprotected |
Definition at line 591 of file InlineAdvisor.cpp.
References Always, Callee, F, FAM, llvm::getAttributeBasedInliningDecision(), llvm::CallBase::getCalledFunction(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getResult(), Never, and NotMandatory.
Referenced by getAdvice(), and llvm::MLInlineAdvisor::getAdviceImpl().
|
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().
|
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().
|
inlinevirtual |
|
friend |
Definition at line 225 of file InlineAdvisor.h.
|
protected |
Definition at line 213 of file InlineAdvisor.h.
Referenced by getAnnotatedInlinePassName().
|
protected |
Definition at line 211 of file InlineAdvisor.h.
Referenced by getAdvice(), llvm::MLInlineAdvisor::getAdviceImpl(), llvm::ReplayInlineAdvisor::getAdviceImpl(), llvm::MLInlineAdvisor::getCachedFPI(), getCallerORE(), getMandatoryKind(), and llvm::MLInlineAdvisor::onSuccessfulInlining().
|
protected |
Definition at line 212 of file InlineAdvisor.h.
|
protected |
Definition at line 214 of file InlineAdvisor.h.
Referenced by InlineAdvisor(), and ~InlineAdvisor().
|
protected |
Definition at line 210 of file InlineAdvisor.h.
Referenced by InlineAdvisor(), and llvm::MLInlineAdvisor::MLInlineAdvisor().