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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267764
91177308-0d34-0410-b5e6-
96231b3b80d8
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);