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

Brian Gaeke gaeke at cs.uiuc.edu
Tue Mar 9 13:29:02 PST 2004


Changes in directory reopt/lib/LightWtProfiling:

TraceToFunction.cpp updated: 1.23 -> 1.24
TraceToFunction.h updated: 1.5 -> 1.6

---
Log message:

Move ValueMap and O2CMap into class TraceFunction.
Add an accessor 'getCorrespondingValue()' to dig things out of it only if they
are already there.


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

Index: reopt/lib/LightWtProfiling/TraceToFunction.cpp
diff -u reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.23 reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.24
--- reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.23	Mon Mar  8 16:46:29 2004
+++ reopt/lib/LightWtProfiling/TraceToFunction.cpp	Tue Mar  9 13:18:26 2004
@@ -48,7 +48,6 @@
 
 typedef std::vector<const Type *> TypeVector;
 typedef std::map<Value *, unsigned int> ValueToIntMap;
-typedef std::map<const Value *, Value *> ValueMap;
 typedef std::map<BranchInst *, unsigned int> BranchNumberMap;
 
 class TraceToFunction {
@@ -382,7 +381,7 @@
 ///
 void TraceToFunction::fillInFunctionBody (Trace &T, Function *F,
 					  LiveVariableSet &So) {
-  ValueMap O2CMap;
+  ValueMap &O2CMap = TF->O2CMap;
   // First copy the basic blocks from the trace.
   cloneTraceBBsIntoFunction (T, F, O2CMap);
 


Index: reopt/lib/LightWtProfiling/TraceToFunction.h
diff -u reopt/lib/LightWtProfiling/TraceToFunction.h:1.5 reopt/lib/LightWtProfiling/TraceToFunction.h:1.6
--- reopt/lib/LightWtProfiling/TraceToFunction.h:1.5	Mon Mar  8 16:46:54 2004
+++ reopt/lib/LightWtProfiling/TraceToFunction.h	Tue Mar  9 13:18:27 2004
@@ -17,6 +17,7 @@
 
 typedef std::set<Value *> LiveVariableSet;
 typedef std::map<BasicBlock *, BasicBlock *> BasicBlockMap;
+typedef std::map<const Value *, Value *> ValueMap;
 
 // This class encapsulates all the TraceToFunction algorithm's saved baggage.
 // You can't have a TraceFunction without a Trace, but you might be able to
@@ -58,6 +59,17 @@
   /// basic blocks that they are supposed to return to in MatrixFn.
   ///
   BasicBlockMap ReturnBlockForTraceExit;
+
+  /// Map of original values in MatrixFn --> clones in TraceFn.
+  ///
+  ValueMap O2CMap;
+
+  Value *getCorrespondingValue (const Value *V) {
+    ValueMap::iterator i = O2CMap.find (V);
+    assert (O2CMap.end() == i
+            && "getCorrespondingValue called on value not in map");
+    return i->second;
+  }
 };
 
 class FunctionPass;





More information about the llvm-commits mailing list