summaryrefslogtreecommitdiff
path: root/MLKLexicalContext-MLKLLVMCompilation.mm
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-16 18:44:46 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-16 22:01:47 +0200
commit82d94f911150e1c9df1d5a44aa52d85637227afa (patch)
tree1883258227e0f56b1b4710708849cc4971623bda /MLKLexicalContext-MLKLLVMCompilation.mm
parent79abb06fbce7ee8f72556ededeee3eb88baf2fc8 (diff)
%FSET, %FSETQ: Set global function bindings in a way that compiled code can understand.
Diffstat (limited to 'MLKLexicalContext-MLKLLVMCompilation.mm')
-rw-r--r--MLKLexicalContext-MLKLLVMCompilation.mm72
1 files changed, 39 insertions, 33 deletions
diff --git a/MLKLexicalContext-MLKLLVMCompilation.mm b/MLKLexicalContext-MLKLLVMCompilation.mm
index 8be1f24..2ff7ec0 100644
--- a/MLKLexicalContext-MLKLLVMCompilation.mm
+++ b/MLKLexicalContext-MLKLLVMCompilation.mm
@@ -22,8 +22,11 @@
#import <Foundation/NSValue.h>
#include <vector>
-#include <llvm/Value.h>
#include <llvm/BasicBlock.h>
+#include <llvm/Constants.h>
+#include <llvm/DerivedTypes.h>
+#include <llvm/Instructions.h>
+#include <llvm/Value.h>
using namespace llvm;
using namespace std;
@@ -45,56 +48,59 @@ using namespace std;
return (flag && [flag boolValue]);
}
--(Value *) functionCellForSymbol:(id)name
+-(Value *) functionCellValueForSymbol:(id)name
{
- return (Value *) [[self deepPropertyForFunction:name
- key:@"LLVM.function-cell"]
- pointerValue];
+ return (new IntToPtrInst (ConstantInt::get(Type::Int64Ty,
+ (uint64_t)[self functionCellForSymbol:name],
+ false),
+ PointerType::get(Type::Int8Ty, 0)));
}
--(Value *) closureDataPointerForSymbol:(id)name
+-(Value *) closureDataPointerValueForSymbol:(id)name
{
- return (Value *) [[self deepPropertyForFunction:name
- key:@"LLVM.closure-data-pointer"]
- pointerValue];
+ return (new IntToPtrInst (ConstantInt::get(Type::Int64Ty,
+ (uint64_t)[self closureDataPointerForSymbol:name],
+ false),
+ PointerType::get(Type::Int8Ty, 0)));
}
--(Value *) bindingForSymbol:(id)name
+-(Value *) bindingValueForSymbol:(id)name
{
- return (Value *) [[self deepPropertyForVariable:name
- key:@"LLVM.variable-binding"]
- pointerValue];
+ return (new IntToPtrInst (ConstantInt::get(Type::Int64Ty,
+ (uint64_t)[self bindingForSymbol:name],
+ false),
+ PointerType::get(Type::Int8Ty, 0)));
}
--(Value *) valueForSymbol:(id)name
+-(Value *) valueValueForSymbol:(id)name
{
return (Value *) [[self deepPropertyForVariable:name
key:@"LLVM.variable-value"]
pointerValue];
}
--(void) setFunctionCell:(Value *)cellPtr forSymbol:(id)name
-{
- [self setDeepProperty:[NSValue valueWithPointer:cellPtr]
- forFunction:name
- key:@"LLVM.function-cell"];
-}
+// -(void) setFunctionCellValue:(Value *)cellPtr forSymbol:(id)name
+// {
+// [self setDeepProperty:[NSValue valueWithPointer:cellPtr]
+// forFunction:name
+// key:@"LLVM.function-cell"];
+// }
--(void) setClosureDataPointer:(Value *)pointer forSymbol:(id)name
-{
- [self setDeepProperty:[NSValue valueWithPointer:pointer]
- forFunction:name
- key:@"LLVM.closure-data"];
-}
+// -(void) setClosureDataPointerValue:(Value *)pointer forSymbol:(id)name
+// {
+// [self setDeepProperty:[NSValue valueWithPointer:pointer]
+// forFunction:name
+// key:@"LLVM.closure-data"];
+// }
--(void) setBinding:(Value *)binding forSymbol:(id)name
-{
- [self setDeepProperty:[NSValue valueWithPointer:binding]
- forVariable:name
- key:@"LLVM.variable-binding"];
-}
+// -(void) setBindingValue:(Value *)binding forSymbol:(id)name
+// {
+// [self setDeepProperty:[NSValue valueWithPointer:binding]
+// forVariable:name
+// key:@"LLVM.variable-binding"];
+// }
--(void) setValue:(Value *)value forSymbol:(id)name
+-(void) setValueValue:(Value *)value forSymbol:(id)name
{
[self setDeepProperty:[NSValue valueWithPointer:value]
forVariable:name