LLVM  14.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]
Collaboration diagram for llvm::InlineAdvice:
Collaboration 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. More...
 
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. More...
 
void recordUnsuccessfulInlining (const InlineResult &Result)
 Call after the decision for a call site was to not inline. More...
 
void recordUnattemptedInlining ()
 Call to indicate inlining was not attempted. More...
 
bool isInliningRecommended () const
 Get the inlining recommendation. More...
 
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. More...
 
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 51 of file InlineAdvisor.h.

Constructor & Destructor Documentation

◆ InlineAdvice() [1/3]

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

Definition at line 160 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 58 of file InlineAdvisor.h.

References assert().

Member Function Documentation

◆ getOriginalCallSiteBasicBlock()

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

Definition at line 89 of file InlineAdvisor.h.

References Block.

◆ getOriginalCallSiteDebugLoc()

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

Definition at line 88 of file InlineAdvisor.h.

References DLoc.

◆ isInliningRecommended()

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

Get the inlining recommendation.

Definition at line 87 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 172 of file InlineAdvisor.cpp.

References recordInliningImpl().

◆ recordInliningImpl()

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

Reimplemented in llvm::MLInlineAdvice.

Definition at line 92 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 178 of file InlineAdvisor.cpp.

References recordInliningWithCalleeDeletedImpl().

◆ recordInliningWithCalleeDeletedImpl()

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

Reimplemented in llvm::MLInlineAdvice.

Definition at line 93 of file InlineAdvisor.h.

Referenced by recordInliningWithCalleeDeleted().

◆ recordUnattemptedInlining()

void llvm::InlineAdvice::recordUnattemptedInlining ( )
inline

Call to indicate inlining was not attempted.

Definition at line 81 of file InlineAdvisor.h.

References recordUnattemptedInliningImpl().

◆ recordUnattemptedInliningImpl()

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

Reimplemented in llvm::MLInlineAdvice.

Definition at line 95 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 75 of file InlineAdvisor.h.

References recordUnsuccessfulInliningImpl().

◆ recordUnsuccessfulInliningImpl()

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

Reimplemented in llvm::MLInlineAdvice.

Definition at line 94 of file InlineAdvisor.h.

Referenced by recordUnsuccessfulInlining().

Member Data Documentation

◆ Advisor

InlineAdvisor* const llvm::InlineAdvice::Advisor
protected

Definition at line 97 of file InlineAdvisor.h.

◆ Block

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

◆ Callee

Function* const llvm::InlineAdvice::Callee
protected

Definition at line 100 of file InlineAdvisor.h.

Referenced by llvm::MLInlineAdvice::getCallee(), and getDefaultInlineAdvice().

◆ Caller

Function* const llvm::InlineAdvice::Caller
protected

Caller and Callee are pre-inlining.

Definition at line 99 of file InlineAdvisor.h.

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

◆ DLoc

const DebugLoc llvm::InlineAdvice::DLoc
protected

◆ IsInliningRecommended

const bool llvm::InlineAdvice::IsInliningRecommended
protected

Definition at line 108 of file InlineAdvisor.h.

Referenced by isInliningRecommended().

◆ ORE

OptimizationRemarkEmitter& llvm::InlineAdvice::ORE
protected

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