summaryrefslogtreecommitdiff
path: root/MLKLLVMCompiler.mm
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-23 18:50:06 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-23 18:50:06 +0200
commitac9b572dc308315c0ecb1685cc2f439337594b11 (patch)
tree10f63ae8f53ec35b19354d02d6226c539dba0a00 /MLKLLVMCompiler.mm
parent8d9be8bd39dc08996c1e8de8d8f7517913287dc7 (diff)
LLVM compiler: Support the LLVM interpreter for debugging.
Diffstat (limited to 'MLKLLVMCompiler.mm')
-rw-r--r--MLKLLVMCompiler.mm11
1 files changed, 9 insertions, 2 deletions
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index f2d1d6e..f65654f 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -33,6 +33,7 @@
#include <llvm/DerivedTypes.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/Instructions.h>
+//#include <llvm/Interpreter.h>
#include <llvm/Module.h>
#include <llvm/ModuleProvider.h>
#include <llvm/PassManager.h>
@@ -149,16 +150,22 @@ static Constant
//function->dump();
- // JIT-compile.
- fn = (id (*)()) execution_engine->getPointerToFunction (function);
//module->dump();
//NSLog (@"%p", fn);
[pool release];
//NSLog (@"Code compiled.");
+#if 1
+ // JIT-compile.
+ fn = (id (*)()) execution_engine->getPointerToFunction (function);
// Execute.
lambdaForm = fn();
+ execution_engine->freeMachineCodeForFunction (function);
+#else
+ Interpreter *i = Interpreter::create (module_provider);
+ lambdaForm = i->runFunction (function)->PointerVal;
+#endif
//NSLog (@"Closure built.");