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

Brian Gaeke gaeke at cs.uiuc.edu
Wed Jan 28 12:50:03 PST 2004


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.35 -> 1.36

---
Log message:

Push entry-MBB copies into a vector first, then print them out and actually do
them. This will give us a chance to see what is going on here.


---
Diffs of the changes:  (+23 -1)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.35 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.36
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.35	Wed Jan 28 11:58:29 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Wed Jan 28 12:48:56 2004
@@ -276,6 +276,21 @@
   return new UnpackTraceFunction (TM, TF);
 }
 
+struct CopyInfo {
+  AllocInfo Src;
+  AllocInfo Targ;
+  MachineBasicBlock *Blk;
+  const Type *Ty;
+  CopyInfo (AllocInfo &_Src, AllocInfo &_Targ, MachineBasicBlock *_Blk,
+            const Type *_Ty) : Src (_Src), Targ (_Targ), Blk (_Blk), Ty (_Ty) {}
+};
+
+std::ostream &operator << (std::ostream &OS, CopyInfo &CI) {
+  OS << "(Src " << CI.Src << " Targ " << CI.Targ << " Blk " << CI.Blk << " Ty "
+     << *CI.Ty << ")";
+  return OS;
+}
+
 /// runOnMachineFunction - This method is provided with MF, which is the
 /// machine code for TF->TraceFn.  We modify it (according to the description
 /// of the pass, above) using the information provided along with TF when this
@@ -298,6 +313,7 @@
 
   // Modify ENTRY MachineBasicBlock of MF
   MachineBasicBlock &E = MF.front (); // E = Entry MBB of MF
+  std::vector<CopyInfo> EntryCopies;
   for (LiveVariableSet::iterator SI = Si.begin (), SE = Si.end (); SI != SE;
        ++SI) {
     // Insert copies from each live-in variable's reg. in the matrix fn.
@@ -306,7 +322,13 @@
     AllocInfo Source = getValueAllocStateFromModule (MatrixF, V);
     AllocInfo Target = getValueAllocStateFromGlobal (TraceF, V);
     if (Source != Target)
-      SRI.insertCopyMachineInstrs (Source, Target, E, V->getType ());
+      EntryCopies.push_back (CopyInfo (Source, Target, &E, V->getType ()));
+  }
+
+  for (std::vector<CopyInfo>::iterator i = EntryCopies.begin (),
+         e = EntryCopies.end (); i != e; ++i) {
+    DEBUG(std::cerr << *i);
+    SRI.insertCopyMachineInstrs (i->Src, i->Targ, *i->Blk, i->Ty);
   }
 
   // Modify EXIT MachineBasicBlocks of MF





More information about the llvm-commits mailing list