[llvm-commits] CVS: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Fri Oct 15 12:31:30 PDT 2004
Changes in directory reopt/lib/LightWtProfiling:
RuntimeOptimizations.cpp updated: 1.55 -> 1.56
---
Log message:
Minor comment/whitespace edits.
When "skipping" traces, go all the way through unpackTraceFunction; just don't
write the final branch.
---
Diffs of the changes: (+17 -16)
Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.55 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.56
--- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.55 Tue Oct 12 15:22:06 2004
+++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp Fri Oct 15 14:31:20 2004
@@ -30,12 +30,11 @@
extern bool SaveRegAllocState;
static int TraceCount = 0;
+// Bug-isolation mechanisms
cl::list<int>
SkipTrace("skip-trace",
cl::CommaSeparated,
cl::desc("Don't optimize these trace numbers, when using trace optimizer"));
-
-// Bug-isolation mechanisms
cl::opt<bool>
DisableTTF("disable-ttf",
cl::init(false),
@@ -72,7 +71,6 @@
return false;
}
-
static bool TraceContainsCall (Trace &T) {
for (Trace::const_iterator ti = T.begin (), te = T.end (); ti != te; ++ti)
for (BasicBlock::const_iterator bi = (*ti)->begin(), be = (*ti)->end ();
@@ -101,15 +99,8 @@
if (TraceContainsCall (T))
return false;
- DEBUG(if (DisableTTF) return false);
+ DEBUG (if (DisableTTF) return false);
- DEBUG(++TraceCount;
- if (std::find (SkipTrace.begin (), SkipTrace.end (), TraceCount)
- != SkipTrace.end ()) {
- std::cerr << "optimizeTrace: skipping trace " << TraceCount << "\n";
- return false;
- });
-
// Initialization stuff: ensure module has been read in, and allocate a
// target machine, if there isn't one already.
static TraceJIT *TJIT = 0;
@@ -126,22 +117,32 @@
DEBUG (WriteTraceToFile (&T));
TraceFunction *TF = BuildTraceFunction (T, MP);
- DEBUG(if (DisableUTF) return false);
+ DEBUG (if (DisableUTF) return false);
// Compile the TraceFunction to machine code using the optimizing trace JIT
// compiler, and unpack the resulting optimized trace back into its matrix
// function.
uint64_t traceStartAddr = TJIT->compileTraceFunction (TF);
- DEBUG(if (DisableBranchStitching) return false);
-
+#ifndef NDEBUG
+ ++TraceCount;
// Add a branch from address A (the parameter to this method) to the
// entry basic block of the unpacked TraceFn. Future executions of the trace
// will proceed from the optimized version of the code.
- DEBUG(std::cerr << "Writing branch at 0x" << std::hex << a
- << " to point to 0x" << traceStartAddr << std::dec << "\n");
TraceOptimizerDone(a, traceStartAddr,
TJIT->getEmitter ()->getCurrentPCValue ());
+
+ DEBUG(if (DisableBranchStitching ||
+ (std::find (SkipTrace.begin (), SkipTrace.end (), TraceCount)
+ != SkipTrace.end ())) {
+ std::cerr << "optimizeTrace: Skipping branch stitch for trace #"
+ << TraceCount << "\n";
+ return false;
+ });
+
+ DEBUG(std::cerr << "optimizeTrace: Writing branch at 0x" << std::hex << a
+ << " to point to 0x" << traceStartAddr << std::dec << "\n");
+#endif
vm->writeBranchInstruction(a, traceStartAddr);
doFlush (a, a + 4);
return true;
More information about the llvm-commits
mailing list