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

Brian Gaeke gaeke at cs.uiuc.edu
Sat May 22 19:11:01 PDT 2004


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.64 -> 1.65

---
Log message:

Simplify the interface to retrieving register allocation state.
Remove a dead reference to TF->LiveOutSet.


---
Diffs of the changes:  (+13 -9)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.64 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.65
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.64	Fri May 21 02:58:43 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Sat May 22 19:09:59 2004
@@ -232,6 +232,12 @@
   regsUsed.insert (fp);
 }
 
+static std::pair<AllocInfo, AllocInfo>
+getValueAllocState (TraceFunction *TF, Value *V) {
+  return std::make_pair (getValueAllocStateFromModule (TF->MatrixFn, V),
+    getValueAllocStateFromGlobal (TF->TraceFn, TF->getCorrespondingValue (V)));
+}
+
 void UnpackTraceFunction::rewriteProlog (MachineFunction &MF,
                                          MachineBasicBlock &E) {
   const TargetRegInfo &TRI = TM->getRegInfo ();
@@ -297,7 +303,7 @@
   // 4. Insert copies from each live-in variable's reg. in the matrix fn.
   // to its reg. in the trace.
   Function *TraceF = TF->TraceFn, *MatrixF = TF->MatrixFn;
-  LiveVariableSet &Si = TF->LiveInSet, &So = TF->LiveOutSet;
+  LiveVariableSet &Si = TF->LiveInSet;
   std::vector<CopyInfo> EntryCopies;
   for (LiveVariableSet::iterator SI = Si.begin (), SE = Si.end (); SI != SE;
        ++SI) {
@@ -306,11 +312,10 @@
           << "rewriteProlog: Getting alloc state for live-in value ";
           WriteAsOperand (std::cerr, V, true, true, MatrixF->getParent ());
           std::cerr << "\n");
-    AllocInfo Source = getValueAllocStateFromModule (MatrixF, V),
-              Target = getValueAllocStateFromGlobal (TraceF,
-                         TF->getCorrespondingValue (V));
-    DEBUG(std::cerr << "rewriteProlog: Source = " << Source << "\n"
-                    << "rewriteProlog: Target = " << Target << "\n");
+    std::pair<AllocInfo, AllocInfo> ai = getValueAllocState (TF, V);
+    AllocInfo &Source = ai.first, &Target = ai.second;
+    DEBUG(std::cerr << "rewriteProlog: Source in MatrixFn = " << Source << "\n"
+                    << "rewriteProlog: Target in TraceFn = " << Target << "\n");
     if (Source != Target)
       EntryCopies.push_back (CopyInfo (Source, Target, &E, V->getType ()));
   }
@@ -495,9 +500,8 @@
   for (LiveVariableSet::iterator SI = So.begin (), SE = So.end ();
 	   SI != SE; ++SI) {
 	Value *V = *SI;
-	AllocInfo Source =
-	  getValueAllocStateFromGlobal (TraceF, TF->getCorrespondingValue (V));
-	AllocInfo Target = getValueAllocStateFromModule (MatrixF, V);
+    std::pair<AllocInfo, AllocInfo> ai = getValueAllocState (TF, V);
+    AllocInfo &Target = ai.first, &Source = ai.second;
 	if (Source != Target)
 	  insertCopyMachineInstrs (Source, Target, MBB, V->getType ());
   }





More information about the llvm-commits mailing list