aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-23 03:46:30 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-23 03:46:30 +0000
commit8f2926b73ed635afecd020da787af6a837601a2b (patch)
tree3bd447986dfc84c49d567dd60b5a7f2434901c2d /lib/CodeGen/CGObjC.cpp
parent9299f3fa85796613cc787a2062c9562d07c8613e (diff)
Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue. - Reduced to only taking the CodeGenFunction, Expr, and Receiver. - Becomes responsible for emitting the arguments. Add CodeGenFunction::EmitCallExprExt - Takes optional extra arguments to insert at the head of the call. - This allows the Obj-C runtimes to call into this and isolates the argument and call instruction generation code to one place. Upshot is that we now pass structures (more) correctly. Also, fix one aspect of generating methods which take structure arguments (for NeXT). This probably needs to be merged with the SetFunctionAttributes code in CodeGenModule.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r--lib/CodeGen/CGObjC.cpp34
1 files changed, 5 insertions, 29 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 5e4b958807..b086f4f10c 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -42,7 +42,7 @@ llvm::Value *CodeGenFunction::EmitObjCProtocolExpr(const ObjCProtocolExpr *E) {
}
-llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
+RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
// Only the lookup mechanism and first two arguments of the method
// implementation vary between runtimes. We can get the receiver and
// arguments in generic code.
@@ -74,38 +74,14 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
Receiver = EmitScalarExpr(E->getReceiver());
}
- // Process the arguments
- unsigned ArgC = E->getNumArgs();
- llvm::SmallVector<llvm::Value*, 16> Args;
- for (unsigned i = 0; i != ArgC; ++i) {
- const Expr *ArgExpr = E->getArg(i);
- QualType ArgTy = ArgExpr->getType();
- if (!hasAggregateLLVMType(ArgTy)) {
- // Scalar argument is passed by-value.
- Args.push_back(EmitScalarExpr(ArgExpr));
- } else if (ArgTy->isAnyComplexType()) {
- // Make a temporary alloca to pass the argument.
- llvm::Value *DestMem = CreateTempAlloca(ConvertType(ArgTy));
- EmitComplexExprIntoAddr(ArgExpr, DestMem, false);
- Args.push_back(DestMem);
- } else {
- llvm::Value *DestMem = CreateTempAlloca(ConvertType(ArgTy));
- EmitAggExpr(ArgExpr, DestMem, false);
- Args.push_back(DestMem);
- }
- }
-
if (isSuperMessage) {
// super is only valid in an Objective-C method
const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
- return Runtime.GenerateMessageSendSuper(Builder, ConvertType(E->getType()),
- OMD->getClassInterface()->getSuperClass(),
- Receiver, E->getSelector(),
- &Args[0], Args.size());
+ return Runtime.GenerateMessageSendSuper(*this, E,
+ OMD->getClassInterface()->getSuperClass(),
+ Receiver);
}
- return Runtime.GenerateMessageSend(Builder, ConvertType(E->getType()),
- Receiver, E->getSelector(),
- &Args[0], Args.size());
+ return Runtime.GenerateMessageSend(*this, E, Receiver);
}
/// Generate an Objective-C method. An Objective-C method is a C function with