forked from OSchip/llvm-project
API for message dispatch of methods returning floats
to match gcc's closely. llvm-svn: 70493
This commit is contained in:
parent
62e0cb0a22
commit
18c435a17d
|
@ -5002,11 +5002,18 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend(
|
|||
Name += "objc_msgSend_stret_fixup";
|
||||
}
|
||||
}
|
||||
else if (ResultType->isFloatingType() &&
|
||||
// Selection of frret API only happens in 32bit nonfragile ABI.
|
||||
CGM.getTargetData().getTypePaddedSize(ObjCTypes.LongTy) == 4) {
|
||||
Fn = ObjCTypes.getMessageSendFpretFixupFn();
|
||||
Name += "objc_msgSend_fpret_fixup";
|
||||
else if (!IsSuper && ResultType->isFloatingType()) {
|
||||
if (const BuiltinType *BT = ResultType->getAsBuiltinType()) {
|
||||
BuiltinType::Kind k = BT->getKind();
|
||||
if (k == BuiltinType::LongDouble) {
|
||||
Fn = ObjCTypes.getMessageSendFpretFixupFn();
|
||||
Name += "objc_msgSend_fpret_fixup";
|
||||
}
|
||||
else {
|
||||
Fn = ObjCTypes.getMessageSendFixupFn();
|
||||
Name += "objc_msgSend_fixup";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
// RUN: grep '@"\\01l_objc_msgSend_fixup_alloc" = weak hidden global .* section "__DATA, __objc_msgrefs, coalesced", align 16' %t &&
|
||||
// RUN: grep '@_objc_empty_cache = external global' %t &&
|
||||
// RUN: grep '@_objc_empty_vtable = external global' %t &&
|
||||
// RUN: grep '@objc_msgSend_fixup(' %t &&
|
||||
// RUN: grep '@objc_msgSend_fpret_fixup(' %t &&
|
||||
|
||||
// RUN: true
|
||||
|
||||
|
@ -94,7 +96,36 @@ llvm-gcc -m64 -emit-llvm -S -o - metadata-symbols-64.m | \
|
|||
}
|
||||
@end
|
||||
|
||||
// Test for FP dispatch method APIs
|
||||
@interface Example
|
||||
@end
|
||||
|
||||
float FLOAT;
|
||||
double DOUBLE;
|
||||
long double LONGDOUBLE;
|
||||
id ID;
|
||||
|
||||
@implementation Example
|
||||
- (double) RET_DOUBLE
|
||||
{
|
||||
return DOUBLE;
|
||||
}
|
||||
- (float) RET_FLOAT
|
||||
{
|
||||
return FLOAT;
|
||||
}
|
||||
- (long double) RET_LONGDOUBLE
|
||||
{
|
||||
return LONGDOUBLE;
|
||||
}
|
||||
@end
|
||||
|
||||
void *f0(id x) {
|
||||
Example* pe;
|
||||
double dd = [pe RET_DOUBLE];
|
||||
dd = [pe RET_FLOAT];
|
||||
dd = [pe RET_LONGDOUBLE];
|
||||
|
||||
[B im0];
|
||||
[C im1];
|
||||
[D alloc];
|
||||
|
|
Loading…
Reference in New Issue