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

Brian Gaeke gaeke at cs.uiuc.edu
Thu Oct 14 14:44:23 PDT 2004



Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.112 -> 1.113
---
Log message:

Add calls to fixupSpilledArgPlacement(), which should (for the moment)
do nothing, because the SpilledArgMap is not filled in (yet).


---
Diffs of the changes:  (+26 -3)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.112 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.113
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.112	Thu Oct 14 14:50:53 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Thu Oct 14 16:44:13 2004
@@ -271,7 +271,8 @@
       TRI.cpMem2RegMI (mvec, MatrixFP, Source.Placement, R, RegType, g2);
     if (Target.AllocState == AllocInfo::Spilled)
       // Finally copy it onto TraceFn's stack
-      TRI.cpReg2MemMI (mvec, R, TraceFP, Target.Placement, RegType, g2);
+      TRI.cpReg2MemMI (mvec, R, TraceFP,
+                       fixupSpilledArgPlacement (Target.Placement), RegType, g2);
     for (std::vector<MachineInstr *>::iterator vi = mvec.begin (),
          ve = mvec.end (); vi != ve; ++vi)
       E.push_back (*vi);
@@ -399,7 +400,8 @@
                             g2, mvec);
   } else if (Source.AllocState == AllocInfo::Spilled) {
     // Copy live-out value from TraceFn's stack to the register.
-    TRI.cpMem2RegMI (mvec, TraceFP, Source.Placement, R, RegType, g2);
+    TRI.cpMem2RegMI (mvec, TraceFP, fixupSpilledArgPlacement (Source.Placement),
+                     R, RegType, g2);
   }
 
   // Most live-outs are in registers in MatrixFn. They get saved on TraceFn's
@@ -622,6 +624,22 @@
   BuildMI (&MBB, V9::NOP, 0);
 }
 
+typedef std::map<int,int> SpilledArgMapTy;
+SpilledArgMapTy SpilledArgMap;
+
+void UnpackTraceFunction::placeSpilledArgs () {
+  SpilledArgMap.clear ();
+  // FIXME - implement
+}
+
+int UnpackTraceFunction::fixupSpilledArgPlacement (int offset) {
+  SpilledArgMapTy::iterator It = SpilledArgMap.find (offset);
+  if (It != SpilledArgMap.end ())
+    return It->second;
+  else
+    return offset;
+}
+
 void UnpackTraceFunction::postprocessMachineInstrsForTrace (MachineBasicBlock &MBB,
                                                             MachineBasicBlock::iterator Start) {
   const SparcV9RegInfo &TRI = *TM->getRegInfo ();
@@ -629,8 +647,12 @@
     // Rewrite references to %fp to use TraceFP (%g1) instead.
     for (unsigned i = 0; i < BI->getNumOperands(); ++i)
       if (BI->getOperand (i).hasAllocatedReg ()
-          && BI->getOperand (i).getReg () == MatrixFP)
+          && BI->getOperand (i).getReg () == MatrixFP) {
         BI->SetMachineOperandReg (i, TraceFP);
+        if (i + 1 < BI->getNumOperands() && BI->getOperand (i + 1).isImmediate ())
+          BI->SetMachineOperandConst (i + 1, MachineOperand::MO_SignExtendedImmed,
+            fixupSpilledArgPlacement (BI->getOperand (i + 1).getImmedValue ()));
+      }
     // If this is a CALL, add compensation code around it.
     if (BI->getOpcode() == V9::CALL || BI->getOpcode() == V9::JMPLCALLi) {
       std::vector<MachineInstr *> mvec;
@@ -715,6 +737,7 @@
   DEBUG(std::cerr << "UnpackTraceFunction: Stack sizes: static = "
         << StaticStackSize << ", spilled args = " << SpilledArgsSpace
         << ", total = " << TotalStackSize << "\n");
+  if (SpilledArgsSpace) placeSpilledArgs();
 
   bool Changed = false;
   for (MachineFunction::iterator I = MF.begin (), E = MF.end (); I != E; ++I)






More information about the llvm-commits mailing list