Add hook to insert late LLVM=>LLVM passes just before isel
authorAnton Korobeynikov <asl@math.spbu.ru>
Wed, 7 Apr 2010 18:18:42 +0000 (18:18 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Wed, 7 Apr 2010 18:18:42 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100640 91177308-0d34-0410-b5e6-96231b3b80d8

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

index d1d665f870ffe4c4bb1c9e65fa15d536c21d34c4..2f29de55be2d4d19799f84a8060367d4fd243d8e 100644 (file)
@@ -264,10 +264,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 ced6664c4a3ac01bf6d071da06a8c02b0344b87b..714ad73e7905f8e6a41f591b59df541664365463 100644 (file)
@@ -268,6 +268,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",