diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-09-02 20:18:54 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-09-02 20:18:54 +0200 |
commit | 07aea7334f5e82002bcbd86edb5cd811be57d441 (patch) | |
tree | 6c1249f9d0d6cd5232a19444cf1a893f086c42de /MLKLLVMCompiler.mm | |
parent | 3c786f910f73de547bdb2f853745b21097119598 (diff) |
LLVM compiler: Treat closure data pointers as of type i8** rather than i8*.
Diffstat (limited to 'MLKLLVMCompiler.mm')
-rw-r--r-- | MLKLLVMCompiler.mm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 60753e5..9e51112 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -59,7 +59,7 @@ static IRBuilder builder; static IRBuilder<true, ConstantFolder> builder; #endif static FunctionPassManager *fpm; -static PointerType *PointerTy; +static PointerType *PointerTy, *PointerPointerTy; static ModuleProvider *module_provider; @@ -105,6 +105,8 @@ static Constant execution_engine = ExecutionEngine::create (module_provider, false); PointerTy = PointerType::get(Type::Int8Ty, 0); + PointerPointerTy = PointerType::get(PointerTy, 0); + fpm = new FunctionPassManager (module_provider); fpm->add (new TargetData (*execution_engine->getTargetData())); //fpm->add (new TargetData (module)); @@ -578,7 +580,7 @@ static Constant @implementation MLKSimpleLambdaForm (MLKLLVMCompilation) -(Value *) reallyProcessForLLVM { - std::vector <const Type *> argtypes (1, PointerTy); + std::vector <const Type *> argtypes (1, PointerPointerTy); FunctionType *ftype = FunctionType::get (PointerTy, argtypes, true); Function *function = Function::Create (ftype, Function::InternalLinkage, @@ -625,7 +627,9 @@ static Constant builder.SetInsertPoint (initBlock); Value *local_closure_value_ptr = builder.CreateGEP (closure_data_arg, position); - [_bodyContext locallySetBindingValue:local_closure_value_ptr + Value *local_closure_value = builder.CreateLoad (local_closure_value_ptr, + [MLKPrintToString(symbol) UTF8String]); + [_bodyContext locallySetBindingValue:local_closure_value forSymbol:symbol]; closure_data_size++; @@ -754,7 +758,7 @@ static Constant builder.SetInsertPoint (outerBlock); argv[0] = function; - argv[1] = closure_data; + argv[1] = builder.CreateBitCast (closure_data, PointerTy); argv.push_back (builder.CreateIntToPtr (ConstantInt::get(Type::Int32Ty, closure_data_size, false), |