summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-10-14 21:37:41 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-10-14 21:37:41 +0000
commit299f3e650fead224a4291624a877aaae9bddd14d (patch)
tree41791957b4ba7d1e8ac46dae4afbe70a44bde506 /llvm/lib/ExecutionEngine/JIT/JIT.cpp
parent2f1e200248376a12040c57aab747d5348bba9265 (diff)
downloadbcm5719-llvm-299f3e650fead224a4291624a877aaae9bddd14d.tar.gz
bcm5719-llvm-299f3e650fead224a4291624a877aaae9bddd14d.zip
Enabling incremental bytecode loading in the JIT:
* The VM is now constructed with a ModuleProvider llvm-svn: 9125
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index d2de0a8b50c..9bdaa570179 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -45,7 +45,7 @@ namespace {
/// create - Create an return a new JIT compiler if there is one available
/// for the current target. Otherwise, return null.
///
-ExecutionEngine *VM::create(Module *M) {
+ExecutionEngine *VM::create(ModuleProvider *MP) {
TargetMachine* (*TargetMachineAllocator)(const Module &) = 0;
// Allow a command-line switch to override what *should* be the default target
@@ -71,14 +71,16 @@ ExecutionEngine *VM::create(Module *M) {
}
// Allocate a target...
- TargetMachine *Target = TargetMachineAllocator(*M);
+ TargetMachine *Target = TargetMachineAllocator(*(MP->getModule()));
assert(Target && "Could not allocate target machine!");
// Create the virtual machine object...
- return new VM(M, Target);
+ return new VM(MP, Target);
}
-VM::VM(Module *M, TargetMachine *tm) : ExecutionEngine(M), TM(*tm) {
+VM::VM(ModuleProvider *MP, TargetMachine *tm) : ExecutionEngine(MP), TM(*tm),
+ PM(MP)
+{
setTargetData(TM.getTargetData());
// Initialize MCE
@@ -94,7 +96,10 @@ VM::VM(Module *M, TargetMachine *tm) : ExecutionEngine(M), TM(*tm) {
// Specialize LLVM code for this target machine and then
// run basic dataflow optimizations on LLVM code.
PM.add(createPreSelectionPass(TM));
- PM.run(*M);
+ // We cannot utilize function-at-a-time loading here because PreSelection
+ // is a ModulePass.
+ MP->materializeModule();
+ PM.run(*(MP->getModule()));
}
#endif
OpenPOWER on IntegriCloud