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

Brian Gaeke gaeke at cs.uiuc.edu
Mon Mar 8 16:47:27 PST 2004


Changes in directory reopt/lib/LightWtProfiling:

TraceToFunction.cpp updated: 1.22 -> 1.23

---
Log message:

Move ReturnBlockForTraceExit inside of TraceFunction.
Make TF be a member of the TraceToFunction method object.
Fix a bug in fixupFunctionBodyBB() where we were passing a null Function * to
 the BasicBlock ctor, causing us to failing an assertion.
Fix some indentation.


---
Diffs of the changes:  (+6 -7)

Index: reopt/lib/LightWtProfiling/TraceToFunction.cpp
diff -u reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.22 reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.23
--- reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.22	Tue Feb 10 13:17:15 2004
+++ reopt/lib/LightWtProfiling/TraceToFunction.cpp	Mon Mar  8 16:46:29 2004
@@ -51,11 +51,10 @@
 typedef std::map<const Value *, Value *> ValueMap;
 typedef std::map<BranchInst *, unsigned int> BranchNumberMap;
 
-BasicBlockMap ReturnBlockForTraceExit;
-
 class TraceToFunction {
   ValueToIntMap LiveInToParameterMap;
   BranchNumberMap BranchNumber;
+  TraceFunction *TF;
   virtual TypeVector createFunctionArgTypeVector (PointerType *ST,
 						  LiveVariableSet S);
   virtual void fillInFunctionBody (Trace &T, Function *F, LiveVariableSet &So);
@@ -422,7 +421,7 @@
   // the function. So create new entry basic block to serve as source
   // for old entry's initial phi node.
   if (srcB == T.getEntryBasicBlock ()) {
-    BasicBlock *FEntry = new BasicBlock ("entryfixup", 0, dstB);
+    BasicBlock *FEntry = new BasicBlock ("entryfixup", F, dstB);
     FEntry->getInstList ().push_back (new BranchInst (dstB));
     // Replace the references to the trace's predecessor with a
     // reference to FEntry now. This is kind of a dodge because we
@@ -462,9 +461,9 @@
 	BasicBlock *FB = new BasicBlock (name, F);
 	// Change BI's clone's destination to FB.
 	BIinF->setSuccessor (i, FB);
-        // Remember that FB's "return" instruction would involve a
-        // return to the off-trace successor we just found.
-        ReturnBlockForTraceExit[FB] = BI->getSuccessor (i);
+    // Remember that FB's "return" instruction would involve a
+    // return to the off-trace successor we just found.
+    TF->ReturnBlockForTraceExit[FB] = BI->getSuccessor (i);
 	// Add the getelementptr/store instruction pairs here that
 	// correspond to each live-out variable.
 	unsigned Slot = 0;
@@ -563,7 +562,7 @@
 TraceFunction *TraceToFunction::traceToFunction (Trace &T) {
   // Create a TraceFunction object to hold the trace function along with
   // its auxiliary data structures.
-  TraceFunction *TF = new TraceFunction (T);
+  TF = new TraceFunction (T);
 
   std::string CurrentFnName = T.getFunction ()->getName ();
   DEBUG(std::cerr << "In traceToFunction() for " << CurrentFnName << "\n");





More information about the llvm-commits mailing list