Add hook to insert late LLVM=>LLVM passes just before isel
authorAnton Korobeynikov <asl@math.spbu.ru>
Sat, 24 Jul 2010 20:48:54 +0000 (20:48 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sat, 24 Jul 2010 20:48:54 +0000 (20:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109354 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetMachine.h
lib/CodeGen/LLVMTargetMachine.cpp

index 60c0064cecf95c92ede5d74bba8ed6ac7f5d633a..42e99e015644b7acec1231d6246132c094f96a22 100644 (file)
@@ -312,10 +312,15 @@ public:
                                  bool DisableVerify = true);
   
   /// Target-Independent Code Generator Pass Configuration Options.
-  
-  /// addInstSelector - This method should add any "last minute" LLVM->LLVM
-  /// passes, then install an instruction selector pass, which converts from
-  /// LLVM code to machine instructions.
+
+  /// addPreISelPasses - This method should add any "last minute" LLVM->LLVM
+  /// passes (which are run just before instruction selector).
+  virtual bool addPreISel(PassManagerBase &, CodeGenOpt::Level) {
+    return true;
+  }
+
+  /// addInstSelector - This method should install an instruction selector pass,
+  /// which converts from LLVM code to machine instructions.
   virtual bool addInstSelector(PassManagerBase &, CodeGenOpt::Level) {
     return true;
   }
index fd102416d8946ca4bf9d559082e5268e4667e244..98d49ad65af768a9bdafa29bacce801f704af31f 100644 (file)
@@ -307,6 +307,8 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
 
   PM.add(createStackProtectorPass(getTargetLowering()));
 
+  addPreISel(PM, OptLevel);
+
   if (PrintISelInput)
     PM.add(createPrintFunctionPass("\n\n"
                                    "*** Final LLVM Code input to ISel ***\n",