Skip to content

Commit

Permalink
Call TargetMachine::addEarlyAsPossiblePasses from BackendUtil.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Justin Lebar committed Apr 27, 2016
1 parent 6e1089b commit 5a7df9c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clang/lib/CodeGen/BackendUtil.cpp
Expand Up @@ -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);

Expand Down

0 comments on commit 5a7df9c

Please sign in to comment.