diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-17 19:53:42 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-17 22:05:16 +0200 |
commit | 0c789f22fae8c0d318a189e8b8b73f5e5ef81976 (patch) | |
tree | e25a08a2df54962d69dee0141497af60bc741c58 | |
parent | 975487368a75e6762fa4a7a2721595ba253bd420 (diff) |
LLVM compiler: Implement SETQ.
-rw-r--r-- | MLKLLVMCompiler.mm | 35 |
1 files changed, 35 insertions, 0 deletions
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<Value *> args (1, value); + + [_compiler insertVoidMethodCall:@"setValue:" + onObject:binding + withArgumentVector:&args]; + } + else + { + builder.CreateStore (value, [_context valueValueForSymbol:variable]); + } + } + + return value; +} +@end |