[flang][cuda] Do not register global constants (#118582)
[llvm-project.git] / llvm / unittests / Analysis / InlineAdvisorPlugin / InlineAdvisorPlugin.cpp
blobbeefff2b3b10635adff93507fe90b4c1575dbdd5
1 #include "llvm/IR/Function.h"
2 #include "llvm/IR/Module.h"
3 #include "llvm/Pass.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"
11 using namespace llvm;
13 namespace {
15 InlineAdvisor *DefaultAdvisorFactory(Module &M, FunctionAnalysisManager &FAM,
16 InlineParams Params, InlineContext IC) {
17 return new DefaultInlineAdvisor(M, FAM, Params, IC);
20 } // namespace
22 /* New PM Registration */
23 llvm::PassPluginLibraryInfo getDefaultDynamicAdvisorPluginInfo() {
24 return {LLVM_PLUGIN_API_VERSION, "DynamicDefaultAdvisor", LLVM_VERSION_STRING,
25 [](PassBuilder &PB) {
26 PB.registerAnalysisRegistrationCallback(
27 [](ModuleAnalysisManager &MAM) {
28 PluginInlineAdvisorAnalysis PA(DefaultAdvisorFactory);
29 MAM.registerPass([&] { return PA; });
30 });
31 }};
34 extern "C" LLVM_ATTRIBUTE_WEAK ::llvm::PassPluginLibraryInfo
35 llvmGetPassPluginInfo() {
36 return getDefaultDynamicAdvisorPluginInfo();