[llvm-commits] CVS: reopt/lib/Mapping/ValueAllocState.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Tue Oct 26 13:08:29 PDT 2004



Changes in directory reopt/lib/Mapping:

ValueAllocState.cpp updated: 1.4 -> 1.5
---
Log message:

Split GetValueAllocState into GetTraceFnValueAllocState and
GetMatrixFnValueAllocState. Refactor common bits out into 
cacheTraceBoundaryBlocks.


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

Index: reopt/lib/Mapping/ValueAllocState.cpp
diff -u reopt/lib/Mapping/ValueAllocState.cpp:1.4 reopt/lib/Mapping/ValueAllocState.cpp:1.5
--- reopt/lib/Mapping/ValueAllocState.cpp:1.4	Thu Sep  2 11:55:44 2004
+++ reopt/lib/Mapping/ValueAllocState.cpp	Tue Oct 26 15:08:19 2004
@@ -85,7 +85,6 @@
 }
 
 static std::set<BasicBlock *> TraceBoundaryBlocks;
-static TraceFunction *lastTraceFunction;
 
 static void findTraceBoundaryBlocks (TraceFunction *TF) {
   TraceBoundaryBlocks.clear ();
@@ -183,15 +182,31 @@
   return AllocInfo();
 }
 
-/// GetValueAllocState - Returns a pair <MatrixState,TraceState> containing the
-/// saved register allocator state for a value.
-///
-std::pair<AllocInfo, AllocInfo>
-GetValueAllocState (TraceFunction *TF, Value *V, bool preferLiveIn) {
+static inline void cacheTraceBoundaryBlocks (TraceFunction *TF) {
+  static TraceFunction *lastTraceFunction;
   if (lastTraceFunction != TF) {
     findTraceBoundaryBlocks (TF);
     lastTraceFunction = TF;
   }
+}
+
+AllocInfo GetTraceFnValueAllocState (TraceFunction *TF, Value *V, bool preferLiveIn) {
+  cacheTraceBoundaryBlocks (TF);
+  return getValueAllocStateFromGlobal (TF->TraceFn, V, preferLiveIn);
+}
+
+AllocInfo GetMatrixFnValueAllocState (TraceFunction *TF, Value *V, bool preferLiveIn){
+  cacheTraceBoundaryBlocks (TF);
+  return getValueAllocStateFromModule (TF->MatrixFn, V, preferLiveIn);
+}
+
+/// GetValueAllocState - Returns a pair <MatrixState,TraceState> containing the
+/// saved register allocator state for a value which exists in both the MatrixFn
+/// and TraceFn.
+///
+std::pair<AllocInfo, AllocInfo>
+GetValueAllocState (TraceFunction *TF, Value *V, bool preferLiveIn) {
+  cacheTraceBoundaryBlocks (TF);
   return std::make_pair
    (getValueAllocStateFromModule (TF->MatrixFn, V, preferLiveIn),
     getValueAllocStateFromGlobal (TF->TraceFn,






More information about the llvm-commits mailing list