[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jun 4 12:59:01 PDT 2004


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.79 -> 1.80

---
Log message:

Make live-in register saving a little more robust.
Add code (currently not tested) for copying live-ins from the MatrixFn's stack.


---
Diffs of the changes:  (+28 -16)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.79 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.80
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.79	Thu Jun  3 00:40:29 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Fri Jun  4 12:58:24 2004
@@ -117,11 +117,11 @@
       std::make_pair (V, GetValueAllocState (TF, V));
     AllocStates.insert (as);
     AllocInfo &Source = as.second.first, &Target = as.second.second;
-    assert (Source.AllocState == AllocInfo::Allocated &&
-            Target.AllocState == AllocInfo::Allocated && 
-            "Only handle live-in values in registers for now!");
-    RegsToSave.insert (Source.Placement);
-    RegsToSave.insert (Target.Placement);
+    if (Source.AllocState == AllocInfo::Allocated)
+      RegsToSave.insert (Source.Placement);
+    if (Target.AllocState == AllocInfo::Allocated
+        && Target.Placement != Source.Placement)
+      RegsToSave.insert (Target.Placement);
   }
 
   DEBUG(std::cerr << "findRegsToSave: RegsToSave (size " 
@@ -191,18 +191,30 @@
     Value *V = *SI;
     std::pair<AllocInfo, AllocInfo> &ai = AllocStates[V];
     AllocInfo &Source = ai.first, &Target = ai.second;
-    assert (Target.AllocState == AllocInfo::Allocated
-            && "FIXME: can't do mem-->mem copy of live-ins yet");
-    mvec.clear ();
-    assert (TRI.getRegType (Target.Placement)
-            == TRI.getRegType (Source.Placement)
-            && "Live-in value changed reg type?!");
-    unsigned RegType = TRI.getRegType (Target.Placement);
-    TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (Source.Placement),
-                     Target.Placement, RegType, g2);
-    for (std::vector<MachineInstr *>::iterator vi = mvec.begin (),
+    if (Source.AllocState == AllocInfo::Allocated
+        && Target.AllocState == AllocInfo::Allocated) {
+      mvec.clear ();
+      assert (TRI.getRegType (Target.Placement)
+              == TRI.getRegType (Source.Placement)
+              && "Live-in value changed reg type?!");
+      unsigned RegType = TRI.getRegType (Target.Placement);
+      TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (Source.Placement),
+                       Target.Placement, RegType, g2);
+      for (std::vector<MachineInstr *>::iterator vi = mvec.begin (),
            ve = mvec.end (); vi != ve; ++vi)
-      E.push_back (*vi);
+        E.push_back (*vi);
+    } else if (Source.AllocState == AllocInfo::Spilled
+               && Target.AllocState == AllocInfo::Allocated) {
+      mvec.clear ();
+      unsigned RegType = TRI.getRegType (Target.Placement);
+      TRI.cpMem2RegMI (mvec, fp, Source.Placement, Target.Placement, RegType, g2);
+      for (std::vector<MachineInstr *>::iterator vi = mvec.begin (),
+           ve = mvec.end (); vi != ve; ++vi)
+        E.push_back (*vi);
+    } else {
+      std::cerr << "Whoops, can't do live-ins spilled in TraceFn yet\n";
+      abort ();
+    }
   }
 }
 





More information about the llvm-commits mailing list