LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
llvm::PluginInlineAdvisorAnalysis Class Reference

Used for dynamically registering InlineAdvisors as plugins. More...

#include "llvm/Analysis/InlineAdvisor.h"

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

Classes

struct  Result
 

Public Types

typedef InlineAdvisor *(* AdvisorFactory) (Module &M, FunctionAnalysisManager &FAM, InlineParams Params, InlineContext IC)
 

Public Member Functions

 PluginInlineAdvisorAnalysis (AdvisorFactory Factory)
 
Result run (Module &M, ModuleAnalysisManager &MAM)
 
Result getResult ()
 
- Public Member Functions inherited from llvm::PassInfoMixin< DerivedT >
void printPipeline (raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
 

Static Public Attributes

static AnalysisKey Key
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::AnalysisInfoMixin< PluginInlineAdvisorAnalysis >
static AnalysisKeyID ()
 Returns an opaque, unique ID for this analysis type.
 
- Static Public Member Functions inherited from llvm::PassInfoMixin< DerivedT >
static StringRef name ()
 Gets the name of the pass we are mixed into.
 

Detailed Description

Used for dynamically registering InlineAdvisors as plugins.

An advisor plugin adds a new advisor at runtime by registering an instance of PluginInlineAdvisorAnalysis in the current ModuleAnalysisManager. For example, the following code dynamically registers a DefaultInlineAdvisor:

namespace {

InlineAdvisor *defaultAdvisorFactory(Module &M, FunctionAnalysisManager &FAM, InlineParams Params, InlineContext IC) { return new DefaultInlineAdvisor(M, FAM, Params, IC); }

} // namespace

extern "C" LLVM_ATTRIBUTE_WEAK llvm::PassPluginLibraryInfo llvmGetPassPluginInfo() { return {LLVM_PLUGIN_API_VERSION, "DynamicDefaultAdvisor", LLVM_VERSION_STRING, [](PassBuilder &PB) { PB.registerAnalysisRegistrationCallback( [](ModuleAnalysisManager &MAM) { PluginInlineAdvisorAnalysis PA(defaultAdvisorFactory); MAM.registerPass([&] { return PA; }); }); }}; }

A plugin must implement an AdvisorFactory and register it with a PluginInlineAdvisorAnlysis to the provided ModuleAnalysisManager.

If such a plugin has been registered InlineAdvisorAnalysis::Result::tryCreate will return the dynamically loaded advisor.

Definition at line 279 of file InlineAdvisor.h.

Member Typedef Documentation

◆ AdvisorFactory

typedef InlineAdvisor *(* llvm::PluginInlineAdvisorAnalysis::AdvisorFactory) (Module &M, FunctionAnalysisManager &FAM, InlineParams Params, InlineContext IC)

Definition at line 284 of file InlineAdvisor.h.

Constructor & Destructor Documentation

◆ PluginInlineAdvisorAnalysis()

llvm::PluginInlineAdvisorAnalysis::PluginInlineAdvisorAnalysis ( AdvisorFactory  Factory)
inline

Definition at line 289 of file InlineAdvisor.h.

References assert().

Member Function Documentation

◆ getResult()

Result llvm::PluginInlineAdvisorAnalysis::getResult ( )
inline

Definition at line 299 of file InlineAdvisor.h.

◆ run()

Result llvm::PluginInlineAdvisorAnalysis::run ( Module M,
ModuleAnalysisManager MAM 
)
inline

Definition at line 298 of file InlineAdvisor.h.

Member Data Documentation

◆ Key

AnalysisKey PluginInlineAdvisorAnalysis::Key
static

Definition at line 282 of file InlineAdvisor.h.


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