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

Capture state between an inlining decision having had been made, and its impact being observable. More...

#include "llvm/Analysis/InlineAdvisor.h"

Inheritance diagram for llvm::InlineAdvice:
Inheritance graph
[legend]

Public Member Functions

 InlineAdvice (InlineAdvisor *Advisor, CallBase &CB, OptimizationRemarkEmitter &ORE, bool IsInliningRecommended)
 
 InlineAdvice (InlineAdvice &&)=delete
 
 InlineAdvice (const InlineAdvice &)=delete
 
virtual ~InlineAdvice ()
 
void recordInlining ()
 Exactly one of the record* APIs must be called.
 
void recordInliningWithCalleeDeleted ()
 Call after inlining succeeded, and results in the callee being delete-able, meaning, it has no more users, and will be cleaned up subsequently.
 
void recordUnsuccessfulInlining (const InlineResult &Result)
 Call after the decision for a call site was to not inline.
 
void recordUnattemptedInlining ()
 Call to indicate inlining was not attempted.
 
bool isInliningRecommended () const
 Get the inlining recommendation.
 
const DebugLocgetOriginalCallSiteDebugLoc () const
 
const BasicBlockgetOriginalCallSiteBasicBlock () const
 

Protected Member Functions

virtual void recordInliningImpl ()
 
virtual void recordInliningWithCalleeDeletedImpl ()
 
virtual void recordUnsuccessfulInliningImpl (const InlineResult &Result)
 
virtual void recordUnattemptedInliningImpl ()
 

Protected Attributes

InlineAdvisor *const Advisor
 
Function *const Caller
 Caller and Callee are pre-inlining.
 
Function *const Callee
 
const DebugLoc DLoc
 
const BasicBlock *const Block
 
OptimizationRemarkEmitterORE
 
const bool IsInliningRecommended
 

Detailed Description

Capture state between an inlining decision having had been made, and its impact being observable.

When collecting model training data, this allows recording features/decisions/partial reward data sets.

Derivations of this type are expected to be tightly coupled with their InliningAdvisors. The base type implements the minimal contractual obligations.

Definition at line 74 of file InlineAdvisor.h.

Constructor & Destructor Documentation

◆ InlineAdvice() [1/3]

InlineAdvice::InlineAdvice ( InlineAdvisor Advisor,
CallBase CB,
OptimizationRemarkEmitter ORE,
bool  IsInliningRecommended 
)

Definition at line 176 of file InlineAdvisor.cpp.

◆ InlineAdvice() [2/3]

llvm::InlineAdvice::InlineAdvice ( InlineAdvice &&  )
delete

◆ InlineAdvice() [3/3]

llvm::InlineAdvice::InlineAdvice ( const InlineAdvice )
delete

◆ ~InlineAdvice()

virtual llvm::InlineAdvice::~InlineAdvice ( )
inlinevirtual

Definition at line 81 of file InlineAdvisor.h.

References assert().

Member Function Documentation

◆ getOriginalCallSiteBasicBlock()

const BasicBlock * llvm::InlineAdvice::getOriginalCallSiteBasicBlock ( ) const
inline

Definition at line 112 of file InlineAdvisor.h.

References Block.

◆ getOriginalCallSiteDebugLoc()

const DebugLoc & llvm::InlineAdvice::getOriginalCallSiteDebugLoc ( ) const
inline

Definition at line 111 of file InlineAdvisor.h.

References DLoc.

◆ isInliningRecommended()

bool llvm::InlineAdvice::isInliningRecommended ( ) const
inline

Get the inlining recommendation.

Definition at line 110 of file InlineAdvisor.h.

References IsInliningRecommended.

◆ recordInlining()

void InlineAdvice::recordInlining ( )

Exactly one of the record* APIs must be called.

Implementers may extend behavior by implementing the corresponding record*Impl.

Call after inlining succeeded, and did not result in deleting the callee.

Definition at line 188 of file InlineAdvisor.cpp.

References recordInliningImpl().

◆ recordInliningImpl()

virtual void llvm::InlineAdvice::recordInliningImpl ( )
inlineprotectedvirtual

Reimplemented in llvm::MLInlineAdvice.

Definition at line 115 of file InlineAdvisor.h.

Referenced by recordInlining().

◆ recordInliningWithCalleeDeleted()

void InlineAdvice::recordInliningWithCalleeDeleted ( )

Call after inlining succeeded, and results in the callee being delete-able, meaning, it has no more users, and will be cleaned up subsequently.

Definition at line 194 of file InlineAdvisor.cpp.

References recordInliningWithCalleeDeletedImpl().

◆ recordInliningWithCalleeDeletedImpl()

virtual void llvm::InlineAdvice::recordInliningWithCalleeDeletedImpl ( )
inlineprotectedvirtual

Reimplemented in llvm::MLInlineAdvice.

Definition at line 116 of file InlineAdvisor.h.

Referenced by recordInliningWithCalleeDeleted().

◆ recordUnattemptedInlining()

void llvm::InlineAdvice::recordUnattemptedInlining ( )
inline

Call to indicate inlining was not attempted.

Definition at line 104 of file InlineAdvisor.h.

References recordUnattemptedInliningImpl().

◆ recordUnattemptedInliningImpl()

virtual void llvm::InlineAdvice::recordUnattemptedInliningImpl ( )
inlineprotectedvirtual

Reimplemented in llvm::MLInlineAdvice.

Definition at line 118 of file InlineAdvisor.h.

Referenced by recordUnattemptedInlining().

◆ recordUnsuccessfulInlining()

void llvm::InlineAdvice::recordUnsuccessfulInlining ( const InlineResult Result)
inline

Call after the decision for a call site was to not inline.

Definition at line 98 of file InlineAdvisor.h.

References recordUnsuccessfulInliningImpl().

◆ recordUnsuccessfulInliningImpl()

virtual void llvm::InlineAdvice::recordUnsuccessfulInliningImpl ( const InlineResult Result)
inlineprotectedvirtual

Reimplemented in llvm::MLInlineAdvice.

Definition at line 117 of file InlineAdvisor.h.

Referenced by recordUnsuccessfulInlining().

Member Data Documentation

◆ Advisor

InlineAdvisor* const llvm::InlineAdvice::Advisor
protected

Definition at line 120 of file InlineAdvisor.h.

Referenced by llvm::MLInlineAdvice::MLInlineAdvice().

◆ Block

const BasicBlock* const llvm::InlineAdvice::Block
protected

◆ Callee

Function* const llvm::InlineAdvice::Callee
protected

Definition at line 123 of file InlineAdvisor.h.

Referenced by llvm::MLInlineAdvice::getCallee().

◆ Caller

Function* const llvm::InlineAdvice::Caller
protected

Caller and Callee are pre-inlining.

Definition at line 122 of file InlineAdvisor.h.

Referenced by llvm::MLInlineAdvice::getCaller(), and llvm::MLInlineAdvice::recordUnsuccessfulInliningImpl().

◆ DLoc

const DebugLoc llvm::InlineAdvice::DLoc
protected

◆ IsInliningRecommended

const bool llvm::InlineAdvice::IsInliningRecommended
protected

Definition at line 131 of file InlineAdvisor.h.

Referenced by isInliningRecommended().

◆ ORE

OptimizationRemarkEmitter& llvm::InlineAdvice::ORE
protected

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