summaryrefslogtreecommitdiff
path: root/MLKLLVMCompiler.mm
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-17 19:53:42 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-17 22:05:16 +0200
commit0c789f22fae8c0d318a189e8b8b73f5e5ef81976 (patch)
treee25a08a2df54962d69dee0141497af60bc741c58 /MLKLLVMCompiler.mm
parent975487368a75e6762fa4a7a2721595ba253bd420 (diff)
LLVM compiler: Implement SETQ.
Diffstat (limited to 'MLKLLVMCompiler.mm')
-rw-r--r--MLKLLVMCompiler.mm35
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