[PATCH] D18617: Call TargetMachine::addEarlyAsPossiblePasses from BackendUtil.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 11:57:33 PDT 2016


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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18617.52101.patch
Type: text/x-patch
Size: 625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160330/26500a87/attachment.bin>


More information about the cfe-commits mailing list