[llvm-commits] [llvm] r158340 - in /llvm/trunk: include/llvm/CodeGen/RegisterPressure.h lib/CodeGen/RegisterPressure.cpp

Andrew Trick atrick at apple.com
Mon Jun 11 16:42:23 PDT 2012


Author: atrick
Date: Mon Jun 11 18:42:23 2012
New Revision: 158340

URL: http://llvm.org/viewvc/llvm-project?rev=158340&view=rev
Log:
misched: When querying RegisterPressureTracker, always save current and max pressure.

Modified:
    llvm/trunk/include/llvm/CodeGen/RegisterPressure.h
    llvm/trunk/lib/CodeGen/RegisterPressure.cpp

Modified: llvm/trunk/include/llvm/CodeGen/RegisterPressure.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterPressure.h?rev=158340&r1=158339&r2=158340&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/RegisterPressure.h (original)
+++ llvm/trunk/include/llvm/CodeGen/RegisterPressure.h Mon Jun 11 18:42:23 2012
@@ -249,19 +249,22 @@
 
   /// Get the pressure of each PSet after traversing this instruction bottom-up.
   void getUpwardPressure(const MachineInstr *MI,
-                         std::vector<unsigned> &PressureResult);
+                         std::vector<unsigned> &PressureResult,
+                         std::vector<unsigned> &MaxPressureResult);
 
   /// Get the pressure of each PSet after traversing this instruction top-down.
   void getDownwardPressure(const MachineInstr *MI,
-                           std::vector<unsigned> &PressureResult);
+                           std::vector<unsigned> &PressureResult,
+                           std::vector<unsigned> &MaxPressureResult);
 
   void getPressureAfterInst(const MachineInstr *MI,
-                            std::vector<unsigned> &PressureResult) {
+                            std::vector<unsigned> &PressureResult,
+                            std::vector<unsigned> &MaxPressureResult) {
     if (isTopClosed())
-      return getUpwardPressure(MI, PressureResult);
+      return getUpwardPressure(MI, PressureResult, MaxPressureResult);
 
     assert(isBottomClosed() && "Uninitialized pressure tracker");
-    return getDownwardPressure(MI, PressureResult);
+    return getDownwardPressure(MI, PressureResult, MaxPressureResult);
   }
 
 protected:

Modified: llvm/trunk/lib/CodeGen/RegisterPressure.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterPressure.cpp?rev=158340&r1=158339&r2=158340&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterPressure.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterPressure.cpp Mon Jun 11 18:42:23 2012
@@ -811,25 +811,31 @@
 /// Get the pressure of each PSet after traversing this instruction bottom-up.
 void RegPressureTracker::
 getUpwardPressure(const MachineInstr *MI,
-                  std::vector<unsigned> &PressureResult) {
+                  std::vector<unsigned> &PressureResult,
+                  std::vector<unsigned> &MaxPressureResult) {
   // Snapshot pressure.
   PressureResult = CurrSetPressure;
+  MaxPressureResult = P.MaxSetPressure;
 
   bumpUpwardPressure(MI);
 
   // Current pressure becomes the result. Restore current pressure.
+  P.MaxSetPressure.swap(MaxPressureResult);
   CurrSetPressure.swap(PressureResult);
 }
 
 /// Get the pressure of each PSet after traversing this instruction top-down.
 void RegPressureTracker::
 getDownwardPressure(const MachineInstr *MI,
-                    std::vector<unsigned> &PressureResult) {
+                    std::vector<unsigned> &PressureResult,
+                    std::vector<unsigned> &MaxPressureResult) {
   // Snapshot pressure.
   PressureResult = CurrSetPressure;
+  MaxPressureResult = P.MaxSetPressure;
 
   bumpDownwardPressure(MI);
 
   // Current pressure becomes the result. Restore current pressure.
+  P.MaxSetPressure.swap(MaxPressureResult);
   CurrSetPressure.swap(PressureResult);
 }





More information about the llvm-commits mailing list