From 207427cfa0c42a511ef677cf456430855c86c319 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 15 Aug 2008 23:16:55 +0200 Subject: LLVM compiler: Implement Objective-C message sending for the GNU runtime. --- MLKLLVMCompiler.mm | 22 +++++++++++++++------- 1 file 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 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 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 argd (*argv); -- cgit v1.2.3