LLVM  12.0.0git
Public Member Functions | 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 ()
 
virtual std::unique_ptr< InlineAdvicegetAdvice (CallBase &CB)=0
 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 ()
 This must be called when the Inliner pass is exited, as function passes may be run subsequently. More...
 

Protected Member Functions

 InlineAdvisor (FunctionAnalysisManager &FAM)
 
void freeDeletedFunctions ()
 We may want to defer deleting functions to after the inlining for a whole module has finished. More...
 
bool isFunctionDeleted (const Function *F) const
 

Protected Attributes

FunctionAnalysisManagerFAM
 

Friends

class InlineAdvice
 

Detailed Description

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

Definition at line 119 of file InlineAdvisor.h.

Constructor & Destructor Documentation

◆ InlineAdvisor() [1/2]

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

◆ ~InlineAdvisor()

virtual llvm::InlineAdvisor::~InlineAdvisor ( )
inlinevirtual

Definition at line 122 of file InlineAdvisor.h.

◆ InlineAdvisor() [2/2]

llvm::InlineAdvisor::InlineAdvisor ( FunctionAnalysisManager FAM)
inlineprotected

Definition at line 141 of file InlineAdvisor.h.

Member Function Documentation

◆ freeDeletedFunctions()

void InlineAdvisor::freeDeletedFunctions ( )
protected

We may want to defer deleting functions to after the inlining for a whole module has finished.

This allows us to reliably use function pointers as unique identifiers, as an efficient implementation detail of the InlineAdvisor. Otherwise, it is possible the memory allocator re-allocate Function objects at the same address of a deleted Function; and Functions are potentially created during the function passes called after each SCC inlining (e.g. argument promotion does that).

Definition at line 141 of file InlineAdvisor.cpp.

References F().

◆ getAdvice()

virtual std::unique_ptr<InlineAdvice> llvm::InlineAdvisor::getAdvice ( CallBase CB)
pure virtual

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. Returns an InlineAdvice with the inlining recommendation.

Implemented in llvm::MLInlineAdvisor.

Referenced by llvm::InlinerPass::run().

◆ isFunctionDeleted()

bool llvm::InlineAdvisor::isFunctionDeleted ( const Function F) const
inlineprotected

Definition at line 154 of file InlineAdvisor.h.

◆ 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 133 of file InlineAdvisor.h.

Referenced by llvm::InlinerPass::run().

◆ onPassExit()

virtual void llvm::InlineAdvisor::onPassExit ( )
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.

Definition at line 138 of file InlineAdvisor.h.

Referenced by llvm::InlinerPass::run().

Friends And Related Function Documentation

◆ InlineAdvice

friend class InlineAdvice
friend

Definition at line 159 of file InlineAdvisor.h.

Member Data Documentation

◆ FAM

FunctionAnalysisManager& llvm::InlineAdvisor::FAM
protected

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