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

Brian Gaeke gaeke at cs.uiuc.edu
Wed Mar 10 16:22:09 PST 2004


Changes in directory reopt/lib/LightWtProfiling:

TraceToFunction.cpp updated: 1.25 -> 1.26
TraceToFunction.h updated: 1.7 -> 1.8

---
Log message:

Constify the keys of ValueToIntMap...why not? :-)
Make getFunctionArg() into a 'static inline' function in TraceToFunction.h.
Make getCorrespondingValue() look in LiveInToParameterMap first before O2CMap.


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

Index: reopt/lib/LightWtProfiling/TraceToFunction.cpp
diff -u reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.25 reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.26
--- reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.25	Wed Mar 10 13:03:43 2004
+++ reopt/lib/LightWtProfiling/TraceToFunction.cpp	Wed Mar 10 16:21:13 2004
@@ -260,14 +260,6 @@
   }
 }
 
-/// getFunctionArg - Return a pointer to F's ARGNOth argument.
-///
-static Argument *getFunctionArg (Function *F, unsigned argno) {
-  Function::aiterator ai = F->abegin ();
-  while (argno) { ++ai; --argno; }
-  return &*ai;
-}
-
 /// cloneTraceBBsIntoFunction - Copy the BasicBlocks of the trace T into
 /// the new Function F, which should be initially empty. Correspondences
 /// between Original instructions (in T) and their Clones (in F) are added


Index: reopt/lib/LightWtProfiling/TraceToFunction.h
diff -u reopt/lib/LightWtProfiling/TraceToFunction.h:1.7 reopt/lib/LightWtProfiling/TraceToFunction.h:1.8
--- reopt/lib/LightWtProfiling/TraceToFunction.h:1.7	Wed Mar 10 13:03:44 2004
+++ reopt/lib/LightWtProfiling/TraceToFunction.h	Wed Mar 10 16:21:13 2004
@@ -18,7 +18,15 @@
 typedef std::set<Value *> LiveVariableSet;
 typedef std::map<BasicBlock *, BasicBlock *> BasicBlockMap;
 typedef std::map<const Value *, Value *> ValueMap;
-typedef std::map<Value *, unsigned int> ValueToIntMap;
+typedef std::map<const Value *, unsigned int> ValueToIntMap;
+
+/// getFunctionArg - Return a pointer to F's ARGNOth argument.
+///
+static inline Argument *getFunctionArg (Function *F, unsigned argno) {
+  Function::aiterator ai = F->abegin ();
+  while (argno) { ++ai; --argno; }
+  return &*ai;
+}
 
 // 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
@@ -71,8 +79,11 @@
   ValueToIntMap LiveInToParameterMap;
 
   Value *getCorrespondingValue (const Value *V) {
+    if (LiveInToParameterMap.find (V) != LiveInToParameterMap.end ()) {
+      return getFunctionArg (TraceFn, LiveInToParameterMap[V]);
+    }
     ValueMap::iterator i = O2CMap.find (V);
-    assert (O2CMap.end() == i
+    assert (O2CMap.end() != i
             && "getCorrespondingValue called on value not in map");
     return i->second;
   }





More information about the llvm-commits mailing list