[PATCH] D76866: Enable plugin support for LTO.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 10:19:09 PDT 2020


efriedma created this revision.
efriedma added a reviewer: Meinersbur.
Herald added subscribers: dang, dexonsmith, steven_wu, hiraditya, inglorion, mgorny.
Herald added a project: LLVM.

This should make static plugins work correctly for all tools that link to LLVMLTO.  (New pass manager plugins are explicitly called. Old pass manager plugins are hopefully pulled in implicitly by the registration calls for new pass manager plugins.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76866

Files:
  lld/tools/lld/CMakeLists.txt
  llvm/lib/LTO/CMakeLists.txt
  llvm/lib/LTO/LTOBackend.cpp


Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -28,6 +28,7 @@
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/Object/ModuleSymbolTable.h"
 #include "llvm/Passes/PassBuilder.h"
+#include "llvm/Passes/PassPlugin.h"
 #include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
@@ -127,6 +128,10 @@
   return Error::success();
 }
 
+#define HANDLE_EXTENSION(Ext)                                                  \
+  llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+#include "llvm/Support/Extension.def"
+
 namespace {
 
 std::unique_ptr<TargetMachine>
@@ -181,6 +186,10 @@
   if (auto Err = PB.parseAAPipeline(AA, "default"))
     report_fatal_error("Error parsing default AA pipeline");
 
+#define HANDLE_EXTENSION(Ext)                                                  \
+  get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
+#include "llvm/Support/Extension.def"
+
   LoopAnalysisManager LAM(Conf.DebugPassManager);
   FunctionAnalysisManager FAM(Conf.DebugPassManager);
   CGSCCAnalysisManager CGAM(Conf.DebugPassManager);
Index: llvm/lib/LTO/CMakeLists.txt
===================================================================
--- llvm/lib/LTO/CMakeLists.txt
+++ llvm/lib/LTO/CMakeLists.txt
@@ -11,6 +11,8 @@
   ADDITIONAL_HEADER_DIRS
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/LTO
 
+  ENABLE_PLUGINS
+
   DEPENDS
   intrinsics_gen
   llvm_vcsrevision_h
Index: lld/tools/lld/CMakeLists.txt
===================================================================
--- lld/tools/lld/CMakeLists.txt
+++ lld/tools/lld/CMakeLists.txt
@@ -5,7 +5,6 @@
 add_lld_tool(lld
   lld.cpp
 
-  ENABLE_PLUGINS
   SUPPORT_PLUGINS
   )
 export_executable_symbols_for_plugins(lld)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76866.252891.patch
Type: text/x-patch
Size: 1848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200326/89e0f722/attachment.bin>


More information about the llvm-commits mailing list