LLVM 20.0.0git
|
Used for dynamically registering InlineAdvisors as plugins. More...
#include "llvm/Analysis/InlineAdvisor.h"
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 AnalysisKey * | ID () |
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. | |
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.
typedef InlineAdvisor *(* llvm::PluginInlineAdvisorAnalysis::AdvisorFactory) (Module &M, FunctionAnalysisManager &FAM, InlineParams Params, InlineContext IC) |
Definition at line 284 of file InlineAdvisor.h.
|
inline |
Definition at line 289 of file InlineAdvisor.h.
References assert().
|
inline |
Definition at line 299 of file InlineAdvisor.h.
|
inline |
Definition at line 298 of file InlineAdvisor.h.
|
static |
Definition at line 282 of file InlineAdvisor.h.