diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-23 03:46:30 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-23 03:46:30 +0000 |
commit | 8f2926b73ed635afecd020da787af6a837601a2b (patch) | |
tree | 3bd447986dfc84c49d567dd60b5a7f2434901c2d /lib/CodeGen/CGExpr.cpp | |
parent | 9299f3fa85796613cc787a2062c9562d07c8613e (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/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 4a80269230..c5b1f28618 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -776,7 +776,15 @@ RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, QualType FnType, // type. FnType = FnType->getAsPointerType()->getPointeeType(); QualType ResultType = FnType->getAsFunctionType()->getResultType(); + return EmitCallExprExt(Callee, ResultType, ArgBeg, ArgEnd, 0, 0); +} +RValue CodeGenFunction::EmitCallExprExt(llvm::Value *Callee, + QualType ResultType, + CallExpr::const_arg_iterator ArgBeg, + CallExpr::const_arg_iterator ArgEnd, + llvm::Value **ExtraArgs, + unsigned NumExtraArgs) { llvm::SmallVector<llvm::Value*, 16> Args; // Handle struct-return functions by passing a pointer to the location that @@ -787,6 +795,8 @@ RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, QualType FnType, // FIXME: set the stret attribute on the argument. } + Args.insert(Args.end(), ExtraArgs, ExtraArgs + NumExtraArgs); + for (CallExpr::const_arg_iterator I = ArgBeg; I != ArgEnd; ++I) { QualType ArgTy = I->getType(); @@ -812,7 +822,7 @@ RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, QualType FnType, if (hasAggregateLLVMType(ResultType)) ParamAttrList.push_back( llvm::ParamAttrsWithIndex::get(1, llvm::ParamAttr::StructRet)); - unsigned increment = hasAggregateLLVMType(ResultType) ? 2 : 1; + unsigned increment = NumExtraArgs + (hasAggregateLLVMType(ResultType) ? 2 : 1); unsigned i = 0; for (CallExpr::const_arg_iterator I = ArgBeg; I != ArgEnd; ++I, ++i) { |