aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-09 23:48:28 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-09 23:48:28 +0000
commit3913f184c84135fb4612743f1faa6c1edd2dd055 (patch)
treea7dfb8e64fbd0e54cde2df6c8521d81a399b8726 /lib/CodeGen/CGObjCMac.cpp
parent9e922b1663ecb95dc7eee03002fd66ed18fb3192 (diff)
Add CodeGenFunction::ReturnTypeUsesSret
- Hook so NeXT runtime doesn't depend on ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index a64b16041a..ff7717dad3 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -158,7 +158,8 @@ public:
ObjCTypesHelper(CodeGen::CodeGenModule &cgm);
~ObjCTypesHelper();
- llvm::Value *getMessageSendFn(bool IsSuper, const llvm::Type *ReturnTy);
+ llvm::Value *getMessageSendFn(bool IsSuper, bool isStret,
+ const llvm::Type *ReturnTy);
};
class CGObjCMac : public CodeGen::CGObjCRuntime {
@@ -528,13 +529,11 @@ CodeGen::RValue CGObjCMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF,
CGF.getContext().getObjCSelType()));
ActualArgs.insert(ActualArgs.end(), CallArgs.begin(), CallArgs.end());
- // FIXME: This is a hack, we are implicitly coordinating with
- // EmitCall, which will move the return type to the first parameter
- // and set the structure return flag. See getMessageSendFn().
-
- const llvm::Type *ReturnTy = CGM.getTypes().ConvertType(ResultType);
- return CGF.EmitCall(ObjCTypes.getMessageSendFn(IsSuper, ReturnTy),
- ResultType, ActualArgs);
+ llvm::Value *Fn =
+ ObjCTypes.getMessageSendFn(IsSuper,
+ CGF.ReturnTypeUsesSret(ResultType),
+ CGM.getTypes().ConvertType(ResultType));
+ return CGF.EmitCall(Fn, ResultType, ActualArgs);
}
llvm::Value *CGObjCMac::GenerateProtocolRef(llvm::IRBuilder<> &Builder,
@@ -2249,12 +2248,13 @@ ObjCTypesHelper::~ObjCTypesHelper() {
}
llvm::Value *ObjCTypesHelper::getMessageSendFn(bool IsSuper,
+ bool IsStret,
const llvm::Type *ReturnTy) {
llvm::Function *F;
llvm::FunctionType *CallFTy;
// FIXME: Should we be caching any of this?
- if (!ReturnTy->isSingleValueType()) {
+ if (IsStret) {
F = IsSuper ? MessageSendSuperStretFn : MessageSendStretFn;
std::vector<const llvm::Type*> Params(3);
Params[0] = llvm::PointerType::getUnqual(ReturnTy);