summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-04-27 19:12:56 +0000
committerJustin Lebar <jlebar@google.com>2016-04-27 19:12:56 +0000
commit5a7df9c130410766a3e76423109bafae1abbae3d (patch)
tree61cd9bac119a96af47a0830168599d7311c1a78d /clang/lib/CodeGen/BackendUtil.cpp
parent6e1089b3a7501694bc52cc3ec5a690760a28d11c (diff)
downloadbcm5719-llvm-5a7df9c130410766a3e76423109bafae1abbae3d.tar.gz
bcm5719-llvm-5a7df9c130410766a3e76423109bafae1abbae3d.zip
Call TargetMachine::addEarlyAsPossiblePasses from BackendUtil.
Summary: 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. Reviewers: chandlerc Subscribers: rnk, cfe-commits, tra Differential Revision: http://reviews.llvm.org/D18617 llvm-svn: 267764
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 148c0a09f9e..6958679de5d 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -354,6 +354,14 @@ void EmitAssemblyHelper::CreatePasses(ModuleSummaryIndex *ModuleSummary) {
return;
}
+ // Add target-specific passes that need to run as early as possible.
+ if (TM)
+ PMBuilder.addExtension(
+ PassManagerBuilder::EP_EarlyAsPossible,
+ [&](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
+ TM->addEarlyAsPossiblePasses(PM);
+ });
+
PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
addAddDiscriminatorsPass);
OpenPOWER on IntegriCloud