[llvm-commits] CVS: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Sun Aug 22 20:10:41 PDT 2004
Changes in directory reopt/lib/LightWtProfiling:
RuntimeOptimizations.cpp updated: 1.48 -> 1.49
---
Log message:
Prune #includes.
Copy isFirstTriggerCall() here from TraceToFunction.
New function TraceContainsCall(), to identify traces containing (non-FLI)
calls.
Skip traces containing calls for now.
---
Diffs of the changes: (+38 -19)
Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.48 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.49
--- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.48 Thu Jul 15 16:53:43 2004
+++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp Sun Aug 22 22:10:30 2004
@@ -14,24 +14,15 @@
//===----------------------------------------------------------------------===//
#include "ReoptimizerInternal.h"
+#include "llvm/Instructions.h"
+#include "reopt/InstrUtils.h"
+#include "reopt/TraceIO.h"
#include "reopt/TraceJIT.h"
-#include "reopt/UnpackTraceFunction.h"
#include "reopt/TraceToFunction.h"
#include "reopt/VirtualMem.h"
-#include "reopt/InstrUtils.h"
-#include "reopt/TraceIO.h"
+#include "Support/CommandLine.h"
#include "Support/Debug.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Assembly/PrintModulePass.h"
-#include "llvm/CodeGen/MachineFunction.h"
-#include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/MachineCodeEmitter.h"
-#include "llvm/CodeGen/IntrinsicLowering.h"
-#include "llvm/ModuleProvider.h"
-#include "llvm/PassManager.h"
-#include "llvm/Target/TargetJITInfo.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include <set>
namespace llvm {
@@ -51,6 +42,32 @@
<< std::dec);
}
+cl::opt<bool> AllowCalls("allow-calls", cl::init(false));
+/// isFirstTriggerCall - Returns true iff I is a call instruction which
+//appears
+/// to call into the first-level trigger function.
+///
+static bool isFirstTriggerCall (const Instruction &I) {
+ if (const CallInst *CI = dyn_cast<CallInst> (&I)) {
+ const Function *CF = CI->getCalledFunction ();
+ // Look for an external function call with no args to
+ // "llvm_first_trigger".
+ return (CF && CF->isExternal () && CF->hasName()
+ && CF->getName () == "llvm_first_trigger" && CF->asize () == 0);
+ }
+ 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 ();
+ bi != be; ++bi)
+ if (isa<CallInst> (*bi) && !isFirstTriggerCall (*bi))
+ return true;
+ return false;
+}
+
/// This method is called when we have finally constructed a
/// trace. The first parameter is the vector of basic blocks that form
/// the trace; the second parameter is the starting
@@ -63,9 +80,13 @@
return false;
else
alreadyDone.insert (a);
-
+
+ // Turn the vector of basic blocks into a Trace.
+ Trace T (vBB);
+
DEBUG(++TraceCount;
- if (skipTrace.find (TraceCount) != skipTrace.end ()) {
+ if ((!AllowCalls && TraceContainsCall (T))
+ || (skipTrace.find (TraceCount) != skipTrace.end ())) {
std::cerr << "optimizeTrace: skipping trace " << TraceCount << "\n";
return false;
});
@@ -82,9 +103,7 @@
SaveStateToModule = false;
}
- // Turn the vector of basic blocks into a Trace, and then turn the Trace into
- // a TraceFunction.
- Trace T (vBB);
+ // Turn the Trace into a TraceFunction.
DEBUG (WriteTraceToFile (&T));
TraceFunction *TF = BuildTraceFunction (T, MP);
More information about the llvm-commits
mailing list