C++/Darwin/x86: Teach IRgen it can pass reference types in registers.

llvm-svn: 103761
This commit is contained in:
Daniel Dunbar 2010-05-14 03:40:53 +00:00
parent cd67c21407
commit 6b45b67b26
2 changed files with 6 additions and 2 deletions

View File

@ -188,7 +188,7 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) {
}
static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
if (!Ty->getAs<BuiltinType>() && !Ty->isAnyPointerType() &&
if (!Ty->getAs<BuiltinType>() && !Ty->hasPointerRepresentation() &&
!Ty->isAnyComplexType() && !Ty->isEnumeralType() &&
!Ty->isBlockPointerType())
return false;
@ -388,7 +388,7 @@ bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty,
}
// If this is a builtin, pointer, enum, or complex type, it is ok.
if (Ty->getAs<BuiltinType>() || Ty->isAnyPointerType() ||
if (Ty->getAs<BuiltinType>() || Ty->hasPointerRepresentation() ||
Ty->isAnyComplexType() || Ty->isEnumeralType() ||
Ty->isBlockPointerType())
return true;

View File

@ -83,3 +83,7 @@ struct s4_0 { float x; };
struct s4_1 { float x; };
struct s4_2 : s4_0, s4_1 { };
s4_2 f4() { return s4_2(); }
// CHECK: define i32 @_Z2f5v()
struct s5 { s5(); int &x; };
s5 f5() { return s5(); }