summaryrefslogtreecommitdiff
path: root/tools/opt
diff options
context:
space:
mode:
authorPhilip Pfaffe <philip.pfaffe@gmail.com>2017-08-04 09:28:09 +0000
committerPhilip Pfaffe <philip.pfaffe@gmail.com>2017-08-04 09:28:09 +0000
commit389880910a2da533fbda53cdf5ddf344f70f591f (patch)
tree63f283b030ee87195809f9f8370a7f0576bf335e /tools/opt
parentb7e74df94f8a8725c9beb632a34c91ee1294f8b1 (diff)
[Polly][PM] Register polly passes with the opt tool for the new-pm path
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
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/NewPMDriver.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/opt/NewPMDriver.cpp b/tools/opt/NewPMDriver.cpp
index 32f71a5beda..f46d37ee8c7 100644
--- a/tools/opt/NewPMDriver.cpp
+++ b/tools/opt/NewPMDriver.cpp
@@ -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;