[llvm-commits] CVS: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Tue Jan 13 12:19:02 PST 2004
Changes in directory reopt/lib/LightWtProfiling:
RuntimeOptimizations.cpp updated: 1.12 -> 1.13
---
Log message:
Always use a ModuleProvider.
Fix up some comments.
Set up a FunctionPassManager, a DefaultIntrinsicLowering, and a SPARC
TargetMachine; hopefully we can use all these instances in the rest of the
trace-opt machinery too.
Add commented-out code: we will want to addPassesToJITCompile soon. :-)
---
Diffs of the changes: (+17 -5)
Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.12 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.13
--- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.12 Thu Jan 8 16:22:00 2004
+++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp Tue Jan 13 12:17:49 2004
@@ -16,6 +16,9 @@
#include "llvm/BasicBlock.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Assembly/CachedWriter.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetMachineImpls.h"
+#include "llvm/IntrinsicLowering.h"
#include <fstream>
namespace llvm {
@@ -37,7 +40,8 @@
alreadyDone.insert(a);
}
- if (!M)
+ // Ensure module has been read in (very likely, but you never know...)
+ if (!MP)
initModules ();
// Dump the trace to the standard error stream if we are in debug mode.
@@ -55,15 +59,23 @@
// Create Trace object.
Trace T (vBB);
- // Try to turn it into a function
+ // Try to turn it into a function.
Function *TF = runTraceToFunction (T);
DEBUG(std::cerr << "Function created from trace: \n" << *TF);
- // Run some stuff on it
-#if 0
- FunctionPassManager PM;
+ // Run some passes on it.
+ FunctionPassManager PM (MP);
PM.add (createVerifierPass ());
PM.run (*TF);
+
+ // Allocate a target...
+ IntrinsicLowering *IL = new DefaultIntrinsicLowering ();
+ TargetMachine *Target = allocateSparcTargetMachine (*MP->getModule (), IL);
+ assert (Target && "Could not allocate target machine!");
+
+#if 0
+ // Compile LLVM Code down to machine code in the intermediate representation
+ Target->getJITInfo ()->addPassesToJITCompile (PM);
// Make the ExecutionEngine generate code for the function and give us
// the MachineFunctions so that we can run UnpackTraceFunction on them.
More information about the llvm-commits
mailing list