[llvm-commits] [llvm] r50165 - in /llvm/trunk: include/llvm/Target/TargetMachine.h lib/CodeGen/LLVMTargetMachine.cpp

Anton Korobeynikov asl at math.spbu.ru
Wed Apr 23 11:22:28 PDT 2008


Author: asl
Date: Wed Apr 23 13:22:28 2008
New Revision: 50165

URL: http://llvm.org/viewvc/llvm-project?rev=50165&view=rev
Log:
Add facility for pre-RA passes

Modified:
    llvm/trunk/include/llvm/Target/TargetMachine.h
    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp

Modified: llvm/trunk/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=50165&r1=50164&r2=50165&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Wed Apr 23 13:22:28 2008
@@ -280,7 +280,14 @@
   virtual bool addInstSelector(PassManagerBase &PM, bool Fast) {
     return true;
   }
-  
+
+  /// addPreRegAllocPasses - This method may be implemented by targets that want
+  /// to run passes immediately before register allocation. This should return
+  /// true if -print-machineinstrs should print after these passes.
+  virtual bool addPreRegAlloc(PassManagerBase &PM, bool Fast) {
+    return false;
+  }
+
   /// addPostRegAllocPasses - This method may be implemented by targets that
   /// want to run passes after register allocation but before prolog-epilog
   /// insertion.  This should return true if -print-machineinstrs should print

Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=50165&r1=50164&r2=50165&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Apr 23 13:22:28 2008
@@ -94,6 +94,10 @@
   if (EnableSinking)
     PM.add(createMachineSinkingPass());
 
+  // Run pre-ra passes.
+  if (addPreRegAlloc(PM, Fast) && PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(cerr));
+
   // Perform register allocation to convert to a concrete x86 representation
   PM.add(createRegisterAllocator());
   





More information about the llvm-commits mailing list