]> granicus.if.org Git - llvm/commitdiff
[Polly][PM] Register polly passes with the opt tool for the new-pm path
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Fri, 4 Aug 2017 09:28:09 +0000 (09:28 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Fri, 4 Aug 2017 09:28:09 +0000 (09:28 +0000)
Summary: When polly is linked into the tools because of the LLVM_POLLY_LINK_INTO_TOOLS option being set, we need to register its passes with the PassBuilder. Because polly is linked in, we can directly call its callback registration method, which registers the appropriate callbacks with the new PM's PassBuilder. This essentially follows exactly the way it worked with the legacy PM.

Reviewers: grosser, chandlerc, bollu

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

Differential Revision: https://reviews.llvm.org/D36273

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310043 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt/NewPMDriver.cpp

index 32f71a5beda6c7cc8f286d67e9d11ffd9dc1b81d..f46d37ee8c7af21d94b1477e51395e221a287456 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/CGSCCPassManager.h"
 #include "llvm/Bitcode/BitcodeWriterPass.h"
+#include "llvm/Config/config.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/IRPrintingPasses.h"
 #include "llvm/IR/LLVMContext.h"
@@ -160,6 +161,12 @@ static void registerEPCallbacks(PassBuilder &PB, bool VerifyEachPass,
     });
 }
 
+#ifdef LINK_POLLY_INTO_TOOLS
+namespace polly {
+void RegisterPollyPasses(PassBuilder &);
+}
+#endif
+
 bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
                            tool_output_file *Out,
                            tool_output_file *ThinLTOLinkOut,
@@ -190,6 +197,10 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
   PassBuilder PB(TM, P);
   registerEPCallbacks(PB, VerifyEachPass, DebugPM);
 
+#ifdef LINK_POLLY_INTO_TOOLS
+  polly::RegisterPollyPasses(PB);
+#endif
+
   // Specially handle the alias analysis manager so that we can register
   // a custom pipeline of AA passes with it.
   AAManager AA;