[llvm-commits] CVS: reopt/lib/TraceToFunction/TraceToFunction.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed May 19 05:00:01 PDT 2004
Changes in directory reopt/lib/TraceToFunction:
TraceToFunction.cpp updated: 1.44 -> 1.45
---
Log message:
Make CloneTraceInto do the work of connecting live-in arguments to
their uses. (cloneTraceBBsIntoFunction now takes a TraceFunction arg.)
Give threadFLIEdges a doc comment.
---
Diffs of the changes: (+21 -13)
Index: reopt/lib/TraceToFunction/TraceToFunction.cpp
diff -u reopt/lib/TraceToFunction/TraceToFunction.cpp:1.44 reopt/lib/TraceToFunction/TraceToFunction.cpp:1.45
--- reopt/lib/TraceToFunction/TraceToFunction.cpp:1.44 Wed May 19 04:37:04 2004
+++ reopt/lib/TraceToFunction/TraceToFunction.cpp Wed May 19 04:59:45 2004
@@ -276,23 +276,27 @@
}
}
-/// 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
-/// to O2CMap.
+/// cloneTraceBBsIntoFunction - Copy the BasicBlocks of the trace into
+/// the new TraceFn, which should be initially empty. Correspondences
+/// between Original instructions (in the trace) and their Clones (in
+/// TraceFn) are added to TF->O2CMap.
///
-static void cloneTraceBBsIntoFunction (Trace &T, Function *F, ValueMap &O2CMap){
- for (Function::aiterator AI = T.getFunction ()->abegin (),
- AE = T.getFunction ()->aend (); AI != AE; ++AI)
+static void cloneTraceBBsIntoFunction (TraceFunction *TF) {
+ Function *MF = TF->MatrixFn;
+ LiveVariableSet &Si = TF->LiveInSet;
+ ValueMap &O2CMap = TF->O2CMap;
+ for (Function::aiterator AI = MF->abegin (), AE = MF->aend (); AI != AE; ++AI)
O2CMap[AI] = AI;
- for (Function::iterator FI = T.getFunction ()->begin (),
- FE = T.getFunction ()->end (); FI != FE; ++FI)
- if (!T.contains (FI)) {
+ for (Function::iterator FI = MF->begin (), FE = MF->end (); FI != FE; ++FI)
+ if (!TF->T.contains (FI)) {
O2CMap[FI] = FI;
- for (BasicBlock::iterator BI = FI->begin (), BE = FI->end (); BI != BE; ++BI)
+ for (BasicBlock::iterator BI = FI->begin (), BE = FI->end (); BI != BE;
+ ++BI)
O2CMap[BI] = BI;
}
- CloneTraceInto (F, T, O2CMap, ".ttf");
+ for (LiveVariableSet::iterator I = Si.begin (), E = Si.end (); I != E; ++I)
+ O2CMap[*I] = getFunctionArg (TF->TraceFn, TF->LiveInToParameterMap[*I]);
+ CloneTraceInto (TF->TraceFn, TF->T, O2CMap, ".ttf");
}
/// isFirstTriggerCall - Returns true iff I is a call instruction which appears
@@ -397,7 +401,7 @@
buildFLIMap (T, FLIMap);
// First copy the basic blocks from the trace.
- cloneTraceBBsIntoFunction (T, F, O2CMap);
+ cloneTraceBBsIntoFunction (TF);
threadFLIEdges (F);
@@ -443,6 +447,10 @@
return true;
}
+/// threadFLIEdges - Replace all references to FLI blocks in the given
+/// function: at PHI nodes, with the corresponding edge's source, and at
+/// branches, with the corresponding edge's target.
+///
void TraceFunctionBuilder::threadFLIEdges (Function *F) {
for (Function::iterator FI = F->begin (), FE = F->end (); FI != FE; ++FI) {
// Replace references to FLI blocks in PHI nodes with the
More information about the llvm-commits
mailing list