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

Brian Gaeke gaeke at cs.uiuc.edu
Sat Nov 8 13:09:01 PST 2003


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.17 -> 1.18

---
Log message:

Arbitrarily pick a standard temporary register for spill-to-spill moves.

Move getSavedStateIndexOfFunction() to live with the other MappingInfo stuff
so that it can share code. Rename it to getLLVMFunctionPositionInfo().


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

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.17 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.18
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.17	Fri Nov  7 16:03:26 2003
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Sat Nov  8 13:08:33 2003
@@ -58,10 +58,13 @@
                      RegType);
   } else if (Source.AllocState == AllocInfo::Spilled
              && Target.AllocState == AllocInfo::Spilled) {
-    // Emit load instruction from address in SrcReg into register SrcReg
-    TRI.cpMem2RegMI (mvec, FramePtrReg, Source.Placement, SrcReg, RegType);
-    // Emit store instruction from register SrcReg to stack loc. Target
-    TRI.cpReg2MemMI (mvec, SrcReg, FramePtrReg, Target.Placement, RegType);
+    const unsigned TempReg = 
+      getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
+                       SparcIntRegClass::g1); // just pick one?
+    // Emit load instruction from stack loc. Source into register TempReg
+    TRI.cpMem2RegMI (mvec, FramePtrReg, Source.Placement, TempReg, RegType);
+    // Emit store instruction from register TempReg to stack loc. Target
+    TRI.cpReg2MemMI (mvec, TempReg, FramePtrReg, Target.Placement, RegType);
   }
   // Add whatever the TargetRegInfo gave us to the MachineBasicBlock we were
   // provided.
@@ -157,29 +160,6 @@
 
 extern PhyRegAlloc::SavedStateMapTy ExportedFnAllocState;
 
-/// Returns the index in _llvm_regAllocState.functions[] where F's register
-/// allocation data may be found.
-///
-/// FIXME: This is basically the same as Anand's FunctionKey[] in
-/// getLLVMinfo.cpp; merge the two!
-///
-unsigned getSavedStateIndexOfFunction (Function *F) {
-  unsigned Key = 0;
-  Module *M = F->getParent ();
-  for (Module::iterator I = M->begin (), E = M->end (); I != E; ++I) {
-    Function *FI = I;
-    if (FI->isExternal ()) continue;
-    if (FI == F) return Key;
-    ++Key;
-  }
-  // By this time we had better have found it, otherwise we are about to do bad
-  // things.
-  std::cerr << "ERROR: UnpackTraceFunction: Cannot find index of Function "
-            << F->getName() << "() in its parent Module, in "
-            << "getSavedStateIndexOfFunction()\n";
-  abort ();
-}
-
 unsigned getSavedStateIndexOfInstruction (const Function *F,
                                           const Instruction *I) {
   unsigned Key = 0;
@@ -210,7 +190,7 @@
   // Figure out the indices (FI, VI, VO) that can be used to look up V, which
   // is an operand of some instruction in F, in _llvm_regAllocState:
   Instruction *Instr = cast<Instruction> (V);
-  unsigned FI = getSavedStateIndexOfFunction (F);
+  unsigned FI = getLLVMFunctionPositionInfo (F);
   unsigned VI = getSavedStateIndexOfInstruction (F, Instr);
   unsigned VO = getSavedStateIndexOfOperandInInstruction (F, V, VI);
   // Reconstruct the AllocInfo for V by searching





More information about the llvm-commits mailing list