From: Philip Pfaffe Date: Fri, 4 Aug 2017 09:28:09 +0000 (+0000) Subject: [Polly][PM] Register polly passes with the opt tool for the new-pm path X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=389880910a2da533fbda53cdf5ddf344f70f591f;p=llvm [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 --- 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;