From 0c789f22fae8c0d318a189e8b8b73f5e5ef81976 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 17 Aug 2008 19:53:42 +0200 Subject: LLVM compiler: Implement SETQ. --- MLKLLVMCompiler.mm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index aba2bf1..cfa50c3 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -702,3 +702,38 @@ static Constant return value; } @end + + +@implementation MLKSetQForm (MLKLLVMCompilation) +-(Value *) processForLLVM +{ + NSEnumerator *var_e, *value_e; + MLKForm *valueForm; + Value *value = ConstantPointerNull::get (PointerTy); + id variable; + + var_e = [_variables objectEnumerator]; + value_e = [_valueForms objectEnumerator]; + while ((valueForm = [value_e nextObject])) + { + variable = [var_e nextObject]; + value = [valueForm processForLLVM]; + if ([_context variableHeapAllocationForSymbol:variable]) + { + Value *binding = builder.CreateLoad ([_context + bindingValueForSymbol:variable]); + std::vector args (1, value); + + [_compiler insertVoidMethodCall:@"setValue:" + onObject:binding + withArgumentVector:&args]; + } + else + { + builder.CreateStore (value, [_context valueValueForSymbol:variable]); + } + } + + return value; +} +@end -- cgit v1.2.3