jlebar created this revision. jlebar added a reviewer: chandlerc. jlebar added subscribers: tra, cfe-commits, rnk.
As of D18614, TargetMachine exposes a hook to add a set of passes that should be run as early as possible. Invoke this hook from clang when setting up the pass manager. http://reviews.llvm.org/D18617 Files: lib/CodeGen/BackendUtil.cpp Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -340,6 +340,14 @@ return; } + // Add target-specific passes that need to run as early as possible. + if (TM) + PMBuilder.addExtension( + PassManagerBuilder::EP_EarlyAsPossible, + [this](const PassManagerBuilder &, legacy::PassManagerBase &PM) { + TM->addEarlyAsPossiblePasses(PM); + }); + PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, addAddDiscriminatorsPass);
Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -340,6 +340,14 @@ return; } + // Add target-specific passes that need to run as early as possible. + if (TM) + PMBuilder.addExtension( + PassManagerBuilder::EP_EarlyAsPossible, + [this](const PassManagerBuilder &, legacy::PassManagerBase &PM) { + TM->addEarlyAsPossiblePasses(PM); + }); + PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, addAddDiscriminatorsPass);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits