diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-23 18:50:06 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-23 18:50:06 +0200 |
commit | ac9b572dc308315c0ecb1685cc2f439337594b11 (patch) | |
tree | 10f63ae8f53ec35b19354d02d6226c539dba0a00 | |
parent | 8d9be8bd39dc08996c1e8de8d8f7517913287dc7 (diff) |
LLVM compiler: Support the LLVM interpreter for debugging.
-rw-r--r-- | MLKLLVMCompiler.mm | 11 |
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."); |