summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-15 23:16:55 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-15 23:16:55 +0200
commit207427cfa0c42a511ef677cf456430855c86c319 (patch)
tree557dceab786737460ec47eae789918a7447d2e52
parenta8a3de11ce7219d9567fb5d341276325f8df04be (diff)
LLVM compiler: Implement Objective-C message sending for the GNU runtime.
-rw-r--r--MLKLLVMCompiler.mm22
1 files changed, 15 insertions, 7 deletions
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 <const Type *> 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 <const Type *> 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 <Value *> argd (*argv);