1 #include "llvm/IR/Function.h"
2 #include "llvm/IR/Module.h"
4 #include "llvm/Passes/PassBuilder.h"
5 #include "llvm/Passes/PassPlugin.h"
6 #include "llvm/Support/CommandLine.h"
7 #include "llvm/Support/raw_ostream.h"
9 #include "llvm/Analysis/InlineAdvisor.h"
15 InlineAdvisor
*DefaultAdvisorFactory(Module
&M
, FunctionAnalysisManager
&FAM
,
16 InlineParams Params
, InlineContext IC
) {
17 return new DefaultInlineAdvisor(M
, FAM
, Params
, IC
);
22 /* New PM Registration */
23 llvm::PassPluginLibraryInfo
getDefaultDynamicAdvisorPluginInfo() {
24 return {LLVM_PLUGIN_API_VERSION
, "DynamicDefaultAdvisor", LLVM_VERSION_STRING
,
26 PB
.registerAnalysisRegistrationCallback(
27 [](ModuleAnalysisManager
&MAM
) {
28 PluginInlineAdvisorAnalysis
PA(DefaultAdvisorFactory
);
29 MAM
.registerPass([&] { return PA
; });
34 extern "C" LLVM_ATTRIBUTE_WEAK ::llvm::PassPluginLibraryInfo
35 llvmGetPassPluginInfo() {
36 return getDefaultDynamicAdvisorPluginInfo();