From 1d741f977203814b9c5b0b5d524af25eff27a3c1 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 13 Aug 2008 01:00:09 +0200 Subject: LLVM compiler: Bind the lambda list. --- MLKLLVMCompiler.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 3ad0c10..72571a7 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -108,7 +108,6 @@ static Constant forCompiler:self]]; builder.CreateRet (v); - function->dump(); verifyFunction (*function); fpm->run (*function); @@ -400,6 +399,8 @@ static Constant Value *nsmutablearray = [_compiler insertClassLookup:@"NSMutableArray"]; Value *mlkcons = [_compiler insertClassLookup:@"MLKCons"]; + + // FIXME: Heap-allocate if appropriate. Value *lambdaList = builder.CreateAlloca (PointerTy, NULL, "lambda_list"); builder.CreateStore ([_compiler insertMethodCall:@"array" @@ -451,6 +452,7 @@ static Constant while ((form = [e nextObject])) { //NSLog (@"%LAMBDA: Processing subform."); + [form->_context setValue:lambdaList forSymbol:_lambdaListName]; value = [form processForLLVM]; } -- cgit v1.2.3 From 207427cfa0c42a511ef677cf456430855c86c319 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 15 Aug 2008 23:16:55 +0200 Subject: LLVM compiler: Implement Objective-C message sending for the GNU runtime. --- MLKLLVMCompiler.mm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 72571a7..b902bbe 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -175,16 +175,24 @@ static Constant { std::vector argtypes (2, PointerTy); FunctionType *ftype = FunctionType::get (PointerTy, argtypes, true); - Constant *function = - module->getOrInsertFunction ( + + Value *sel = [self insertSelectorLookup:messageName]; + #ifdef __NEXT_RUNTIME__ - "objc_msgSend", + Constant *function = + module->getOrInsertFunction ("objc_msgSend", + ftype); #else - "objc_msg_send", + std::vector lookup_argtypes (2, PointerTy); + FunctionType *lookup_ftype = FunctionType::get (PointerType::get (ftype, 0), + lookup_argtypes, + false); + Constant *lookup_function = + module->getOrInsertFunction ("objc_msg_lookup", + lookup_ftype); + Value *function = + builder.CreateCall2 (lookup_function, object, sel, "method_impl"); #endif - ftype); - - Value *sel = [self insertSelectorLookup:messageName]; // XXX The following doesn't work. Why? // std::deque argd (*argv); -- cgit v1.2.3 From ae6e74608bfb068a431ba397f4b69cabc31d06e2 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 15 Aug 2008 23:21:41 +0200 Subject: LLVM compiler: Add trace messages to compiled code. --- MLKLLVMCompiler.mm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index b902bbe..8c837ef 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include @@ -81,7 +83,17 @@ static Constant fpm->add (createInstructionCombiningPass()); fpm->add (createReassociatePass()); fpm->add (createGVNPass()); - fpm->add (createCFGSimplificationPass()); + // fpm->add (createVerifierPass()); + // fpm->add (createLowerSetJmpPass()); + // fpm->add (createRaiseAllocationsPass()); + // fpm->add (createCFGSimplificationPass()); + // fpm->add (createPromoteMemoryToRegisterPass()); + // fpm->add (createGlobalOptimizerPass()); + // fpm->add (createGlobalDCEPass()); + // fpm->add (createFunctionInliningPass()); + + // Utilities. + // fpm->add (createUnifyFunctionExitNodesPass()); } +(id) compile:(id)object @@ -107,16 +119,22 @@ static Constant inContext:context forCompiler:self]]; + [self insertTrace:@"Bla.\n"]; + builder.CreateRet (v); verifyFunction (*function); fpm->run (*function); // JIT-compile. fn = (id (*)()) execution_engine->getPointerToFunction (function); + module->dump(); + NSLog (@"%p", fn); // Execute. lambdaForm = fn(); + NSLog (@"Closure built."); + return lambdaForm; } @@ -247,6 +265,23 @@ static Constant Constant *nameptr = createGlobalStringPtr (cname); return builder.CreateCall (function, nameptr, cname); } + ++(void) insertTrace:(NSString *)message +{ + Constant *function = + module->getOrInsertFunction ("puts", + Type::Int32Ty, + PointerTy, + NULL); + + builder.CreateCall (function, createGlobalStringPtr ([message UTF8String])); + + Constant *function2 = + module->getOrInsertFunction ("fflush", + Type::Int32Ty, + PointerTy, + NULL); +} @end @@ -341,13 +376,14 @@ static Constant Value *functionCell = builder.CreateLoad ([_context functionCellForSymbol:_head]); Value *functionPtr = builder.CreateLoad (functionCell); - Value *closureDataPointer = builder.CreateLoad ([_context closureDataPointerForSymbol:_head]); + Value *closureDataCell = builder.CreateLoad ([_context closureDataPointerForSymbol:_head]); + Value *closureDataPtr = builder.CreateLoad (closureDataCell); NSEnumerator *e = [_argumentForms objectEnumerator]; MLKForm *form; std::vector args; - args.push_back (closureDataPointer); + args.push_back (closureDataPtr); while ((form = [e nextObject])) { @@ -391,6 +427,7 @@ static Constant BasicBlock *joinBlock = BasicBlock::Create ("function_body"); builder.SetInsertPoint (initBlock); + [_compiler insertTrace:@"In function."]; Value *endmarker = builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, (uint64_t)MLKEndOfArgumentsMarker, @@ -404,6 +441,7 @@ static Constant PointerTy, NULL), ap); + [_compiler insertTrace:@"After va_start."]; Value *nsmutablearray = [_compiler insertClassLookup:@"NSMutableArray"]; Value *mlkcons = [_compiler insertClassLookup:@"MLKCons"]; @@ -419,12 +457,14 @@ static Constant builder.SetInsertPoint (loopInitBlock); function->getBasicBlockList().push_back (loopInitBlock); + [_compiler insertTrace:@"In loop."]; Value *arg = builder.CreateVAArg (ap, PointerTy, "arg"); Value *cond = builder.CreateICmpEQ (arg, endmarker); builder.CreateCondBr (cond, joinBlock, loopBlock); builder.SetInsertPoint (loopBlock); function->getBasicBlockList().push_back (loopBlock); + [_compiler insertTrace:@"Adding argument."]; std::vector argv (1, arg); builder.CreateStore ([_compiler insertMethodCall:@"addObject:" onObject:builder.CreateLoad(lambdaList) @@ -435,6 +475,7 @@ static Constant builder.SetInsertPoint (joinBlock); function->getBasicBlockList().push_back (joinBlock); + [_compiler insertTrace:@"After loop."]; builder.CreateCall (module->getOrInsertFunction ("llvm.va_end", Type::VoidTy, PointerTy, @@ -464,6 +505,7 @@ static Constant value = [form processForLLVM]; } + [_compiler insertTrace:@"Returning."]; builder.CreateRet (value); function->dump(); @@ -471,7 +513,10 @@ static Constant verifyFunction (*function); NSLog (@"Optimise..."); fpm->run (*function); + //NSLog (@"Assemble..."); + //id (*function_code)(...) = (id (*)(...)) execution_engine->getPointerToFunction (function); NSLog (@"Done."); + //function_code (0, MLKEndOfArgumentsMarker); function->dump(); NSLog (@"Function built."); @@ -480,6 +525,10 @@ static Constant Value *closure_data = ConstantPointerNull::get (PointerTy); argv[0] = function; + // argv[0] = (builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, + // (uint64_t)function_code, + // false), + // PointerTy)); argv.push_back (closure_data); argv.push_back (builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, 0, -- cgit v1.2.3 From 95c1ccd0b1d863e8a7f3643b025dc80000af5aa8 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 13:44:57 +0200 Subject: MLKLLVMCompiler: Make compilable with the latest unstable version of LLVM. --- MLKLLVMCompiler.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 8c837ef..72b1c3d 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -47,7 +47,7 @@ using namespace llvm; static ExecutionEngine *execution_engine; static llvm::Module *module; -static IRBuilder builder; +static IRBuilder builder; static FunctionPassManager *fpm; static PointerType *PointerTy; static ModuleProvider *module_provider; -- cgit v1.2.3 From 9464d1a63f4d2d30b1db08ffbcc4a4994ca16f22 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 13:46:35 +0200 Subject: MLKLLVMCompiler: Cleanups. --- MLKLLVMCompiler.mm | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 72b1c3d..93c0640 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -80,6 +80,7 @@ static Constant module_provider = new ExistingModuleProvider (module); fpm = new FunctionPassManager (module_provider); fpm->add (new TargetData (*execution_engine->getTargetData())); + //fpm->add (new TargetData (module)); fpm->add (createInstructionCombiningPass()); fpm->add (createReassociatePass()); fpm->add (createGVNPass()); @@ -119,7 +120,7 @@ static Constant inContext:context forCompiler:self]]; - [self insertTrace:@"Bla.\n"]; + [self insertTrace:@"Bla."]; builder.CreateRet (v); verifyFunction (*function); @@ -275,12 +276,6 @@ static Constant NULL); builder.CreateCall (function, createGlobalStringPtr ([message UTF8String])); - - Constant *function2 = - module->getOrInsertFunction ("fflush", - Type::Int32Ty, - PointerTy, - NULL); } @end @@ -525,10 +520,6 @@ static Constant Value *closure_data = ConstantPointerNull::get (PointerTy); argv[0] = function; - // argv[0] = (builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, - // (uint64_t)function_code, - // false), - // PointerTy)); argv.push_back (closure_data); argv.push_back (builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, 0, @@ -541,6 +532,8 @@ static Constant onObject:mlkcompiledclosure withArgumentVector:&argv]; + //function->viewCFG(); + return closure; } @end -- cgit v1.2.3 From 2aebd102c5cd0d18858495da77d5287666995f36 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 15:24:29 +0200 Subject: MLKLLVMCompiler: Directly build argument lists without first constructing an array. --- MLKLLVMCompiler.mm | 88 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 24 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 93c0640..0a55972 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -187,28 +187,50 @@ static Constant name:@""]; } ++(Value *) insertVoidMethodCall:(NSString *)messageName + onObject:(Value *)object + withArgumentVector:(std::vector *)argv +{ + return [self insertMethodCall:messageName + onObject:object + withArgumentVector:argv + name:@"" + returnType:(Type::VoidTy)]; +} + ++(Value *) insertMethodCall:(NSString *)messageName + onObject:(Value *)object + withArgumentVector:(std::vector *)argv + name:(NSString *)name +{ + return [self insertMethodCall:messageName + onObject:object + withArgumentVector:argv + name:@"" + returnType:PointerTy]; +} + +(Value *) insertMethodCall:(NSString *)messageName onObject:(Value *)object withArgumentVector:(std::vector *)argv - name:(NSString *)name; + name:(NSString *)name + returnType:(const Type *)returnType { std::vector argtypes (2, PointerTy); - FunctionType *ftype = FunctionType::get (PointerTy, argtypes, true); + FunctionType *ftype = FunctionType::get (returnType, argtypes, true); Value *sel = [self insertSelectorLookup:messageName]; #ifdef __NEXT_RUNTIME__ Constant *function = - module->getOrInsertFunction ("objc_msgSend", - ftype); + module->getOrInsertFunction ("objc_msgSend", ftype); #else std::vector lookup_argtypes (2, PointerTy); FunctionType *lookup_ftype = FunctionType::get (PointerType::get (ftype, 0), lookup_argtypes, false); Constant *lookup_function = - module->getOrInsertFunction ("objc_msg_lookup", - lookup_ftype); + module->getOrInsertFunction ("objc_msg_lookup", lookup_ftype); Value *function = builder.CreateCall2 (lookup_function, object, sel, "method_impl"); #endif @@ -420,6 +442,8 @@ static Constant BasicBlock *loopBlock = BasicBlock::Create ("load_args"); BasicBlock *loopInitBlock = BasicBlock::Create ("load_args_prelude"); BasicBlock *joinBlock = BasicBlock::Create ("function_body"); + BasicBlock *lambdaListNewBlock = BasicBlock::Create ("lambda_list_new"); + BasicBlock *lambdaListUpdateBlock = BasicBlock::Create ("lambda_list_update"); builder.SetInsertPoint (initBlock); [_compiler insertTrace:@"In function."]; @@ -438,15 +462,14 @@ static Constant ap); [_compiler insertTrace:@"After va_start."]; - Value *nsmutablearray = [_compiler insertClassLookup:@"NSMutableArray"]; Value *mlkcons = [_compiler insertClassLookup:@"MLKCons"]; // FIXME: Heap-allocate if appropriate. Value *lambdaList = builder.CreateAlloca (PointerTy, NULL, "lambda_list"); + Value *lambdaListTail = builder.CreateAlloca (PointerTy, NULL, "lambda_list_tail"); - builder.CreateStore ([_compiler insertMethodCall:@"array" - onObject:nsmutablearray], - lambdaList); + builder.CreateStore (ConstantPointerNull::get (PointerTy), lambdaList); + builder.CreateStore (ConstantPointerNull::get (PointerTy), lambdaListTail); builder.CreateBr (loopInitBlock); builder.SetInsertPoint (loopInitBlock); @@ -460,13 +483,35 @@ static Constant function->getBasicBlockList().push_back (loopBlock); [_compiler insertTrace:@"Adding argument."]; + builder.CreateCondBr (builder.CreateICmpEQ (builder.CreateLoad (lambdaList), + ConstantPointerNull::get (PointerTy)), + lambdaListNewBlock, + lambdaListUpdateBlock); + + builder.SetInsertPoint (lambdaListNewBlock); + function->getBasicBlockList().push_back (lambdaListNewBlock); std::vector argv (1, arg); - builder.CreateStore ([_compiler insertMethodCall:@"addObject:" - onObject:builder.CreateLoad(lambdaList) - withArgumentVector:&argv], - lambdaList); + argv.push_back (ConstantPointerNull::get (PointerTy)); + Value *newLambdaList = [_compiler insertMethodCall:@"cons:with:" + onObject:mlkcons + withArgumentVector:&argv]; + builder.CreateStore (newLambdaList, lambdaList); + builder.CreateStore (newLambdaList, lambdaListTail); + builder.CreateBr (loopInitBlock); + builder.SetInsertPoint (lambdaListUpdateBlock); + function->getBasicBlockList().push_back (lambdaListUpdateBlock); + + Value *newCons = [_compiler insertMethodCall:@"cons:with:" + onObject:mlkcons + withArgumentVector:&argv]; + std::vector setcdr_argv (1, newCons); + [_compiler insertVoidMethodCall:@"setCdr:" + onObject:builder.CreateLoad(lambdaListTail) + withArgumentVector:&setcdr_argv]; + builder.CreateStore (newCons, lambdaListTail); builder.CreateBr (loopInitBlock); + builder.SetInsertPoint (joinBlock); function->getBasicBlockList().push_back (joinBlock); @@ -477,12 +522,6 @@ static Constant NULL), ap); - argv[0] = builder.CreateLoad(lambdaList); - builder.CreateStore ([_compiler insertMethodCall:@"listWithArray:" - onObject:mlkcons - withArgumentVector:&argv], - lambdaList); - NSEnumerator *e = [_bodyForms objectEnumerator]; MLKForm *form; Value *value = NULL; @@ -508,10 +547,11 @@ static Constant verifyFunction (*function); NSLog (@"Optimise..."); fpm->run (*function); - //NSLog (@"Assemble..."); - //id (*function_code)(...) = (id (*)(...)) execution_engine->getPointerToFunction (function); + NSLog (@"Assemble..."); + // Assembling explicitly is needed in order to allow libffi to call + // the function. + execution_engine->getPointerToFunction (function); NSLog (@"Done."); - //function_code (0, MLKEndOfArgumentsMarker); function->dump(); NSLog (@"Function built."); @@ -520,7 +560,7 @@ static Constant Value *closure_data = ConstantPointerNull::get (PointerTy); argv[0] = function; - argv.push_back (closure_data); + argv[1] = closure_data; argv.push_back (builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, 0, false), -- cgit v1.2.3 From be719f278f6b7c58cb2f0dfbd6edce19a3df85cc Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 15:28:10 +0200 Subject: LLVM compiler: Remove various debugging messages. --- MLKLLVMCompiler.mm | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 0a55972..11001dc 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -120,8 +120,6 @@ static Constant inContext:context forCompiler:self]]; - [self insertTrace:@"Bla."]; - builder.CreateRet (v); verifyFunction (*function); fpm->run (*function); @@ -446,7 +444,6 @@ static Constant BasicBlock *lambdaListUpdateBlock = BasicBlock::Create ("lambda_list_update"); builder.SetInsertPoint (initBlock); - [_compiler insertTrace:@"In function."]; Value *endmarker = builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, (uint64_t)MLKEndOfArgumentsMarker, @@ -460,7 +457,6 @@ static Constant PointerTy, NULL), ap); - [_compiler insertTrace:@"After va_start."]; Value *mlkcons = [_compiler insertClassLookup:@"MLKCons"]; @@ -475,14 +471,12 @@ static Constant builder.SetInsertPoint (loopInitBlock); function->getBasicBlockList().push_back (loopInitBlock); - [_compiler insertTrace:@"In loop."]; Value *arg = builder.CreateVAArg (ap, PointerTy, "arg"); Value *cond = builder.CreateICmpEQ (arg, endmarker); builder.CreateCondBr (cond, joinBlock, loopBlock); builder.SetInsertPoint (loopBlock); function->getBasicBlockList().push_back (loopBlock); - [_compiler insertTrace:@"Adding argument."]; builder.CreateCondBr (builder.CreateICmpEQ (builder.CreateLoad (lambdaList), ConstantPointerNull::get (PointerTy)), lambdaListNewBlock, @@ -515,7 +509,6 @@ static Constant builder.SetInsertPoint (joinBlock); function->getBasicBlockList().push_back (joinBlock); - [_compiler insertTrace:@"After loop."]; builder.CreateCall (module->getOrInsertFunction ("llvm.va_end", Type::VoidTy, PointerTy, @@ -539,21 +532,20 @@ static Constant value = [form processForLLVM]; } - [_compiler insertTrace:@"Returning."]; builder.CreateRet (value); function->dump(); - NSLog (@"Verify..."); + //NSLog (@"Verify..."); verifyFunction (*function); - NSLog (@"Optimise..."); + //NSLog (@"Optimise..."); fpm->run (*function); - NSLog (@"Assemble..."); - // Assembling explicitly is needed in order to allow libffi to call + //NSLog (@"Assemble..."); + // Explicit assembly is needed in order to allow libffi to call // the function. execution_engine->getPointerToFunction (function); - NSLog (@"Done."); + //NSLog (@"Done."); function->dump(); - NSLog (@"Function built."); + //NSLog (@"Function built."); builder.SetInsertPoint (outerBlock); -- cgit v1.2.3 From e4718a30d1b9253035555392753185855692bdca Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 16:57:16 +0200 Subject: MLKLLVMCompiler: Enable more optimisation passes. --- MLKLLVMCompiler.mm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 11001dc..969d12c 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -85,13 +85,13 @@ static Constant fpm->add (createReassociatePass()); fpm->add (createGVNPass()); // fpm->add (createVerifierPass()); - // fpm->add (createLowerSetJmpPass()); - // fpm->add (createRaiseAllocationsPass()); - // fpm->add (createCFGSimplificationPass()); - // fpm->add (createPromoteMemoryToRegisterPass()); - // fpm->add (createGlobalOptimizerPass()); - // fpm->add (createGlobalDCEPass()); - // fpm->add (createFunctionInliningPass()); + //fpm->add (createLowerSetJmpPass()); + //fpm->add (createRaiseAllocationsPass()); + fpm->add (createCFGSimplificationPass()); + fpm->add (createPromoteMemoryToRegisterPass()); + //fpm->add (createGlobalOptimizerPass()); + //fpm->add (createGlobalDCEPass()); + //fpm->add (createFunctionInliningPass()); // Utilities. // fpm->add (createUnifyFunctionExitNodesPass()); -- cgit v1.2.3 From 82d94f911150e1c9df1d5a44aa52d85637227afa Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 18:44:46 +0200 Subject: %FSET, %FSETQ: Set global function bindings in a way that compiled code can understand. --- MLKLLVMCompiler.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 969d12c..e9507a9 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -366,12 +366,12 @@ static Constant if ([_context variableHeapAllocationForSymbol:_form]) { - Value *binding = builder.CreateLoad ([_context bindingForSymbol:_form]); + Value *binding = builder.CreateLoad ([_context bindingValueForSymbol:_form]); value = [_compiler insertMethodCall:@"value" onObject:binding]; } else { - value = builder.CreateLoad ([_context valueForSymbol:_form], + value = builder.CreateLoad ([_context valueValueForSymbol:_form], [MLKPrintToString(_form) UTF8String]); } @@ -389,9 +389,9 @@ static Constant // XXX Issue a style warning. } - Value *functionCell = builder.CreateLoad ([_context functionCellForSymbol:_head]); + Value *functionCell = builder.CreateLoad ([_context functionCellValueForSymbol:_head]); Value *functionPtr = builder.CreateLoad (functionCell); - Value *closureDataCell = builder.CreateLoad ([_context closureDataPointerForSymbol:_head]); + Value *closureDataCell = builder.CreateLoad ([_context closureDataPointerValueForSymbol:_head]); Value *closureDataPtr = builder.CreateLoad (closureDataCell); NSEnumerator *e = [_argumentForms objectEnumerator]; @@ -528,7 +528,7 @@ static Constant while ((form = [e nextObject])) { //NSLog (@"%LAMBDA: Processing subform."); - [form->_context setValue:lambdaList forSymbol:_lambdaListName]; + [form->_context setValueValue:lambdaList forSymbol:_lambdaListName]; value = [form processForLLVM]; } -- cgit v1.2.3 From 40ee78a3229146beecdc16ce64e8270b7fdc7513 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 16 Aug 2008 21:58:26 +0200 Subject: MLKFunctionCallForm(MLKLLVMCompilation): Remove spurious load instructions. Simple function calls work now. --- MLKLLVMCompiler.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MLKLLVMCompiler.mm') diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index e9507a9..4313ac9 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -389,9 +389,9 @@ static Constant // XXX Issue a style warning. } - Value *functionCell = builder.CreateLoad ([_context functionCellValueForSymbol:_head]); + Value *functionCell = builder.Insert ([_context functionCellValueForSymbol:_head]); Value *functionPtr = builder.CreateLoad (functionCell); - Value *closureDataCell = builder.CreateLoad ([_context closureDataPointerValueForSymbol:_head]); + Value *closureDataCell = builder.Insert ([_context closureDataPointerValueForSymbol:_head]); Value *closureDataPtr = builder.CreateLoad (closureDataCell); NSEnumerator *e = [_argumentForms objectEnumerator]; -- cgit v1.2.3