diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-14 03:40:53 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-14 03:40:53 +0000 |
commit | a1842d32a1964712e42078e9b389dce9258c6a8c (patch) | |
tree | eb68301bbd65af815b5bf535b50314427a9974a0 | |
parent | eb840bd0e473ee11622e084a0d6ff276ee7aa5c6 (diff) |
C++/Darwin/x86: Teach IRgen it can pass reference types in registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103761 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/TargetInfo.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/x86_32-arguments.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index bcd332ac95..09baf2e833 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -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; diff --git a/test/CodeGenCXX/x86_32-arguments.cpp b/test/CodeGenCXX/x86_32-arguments.cpp index 3af2746345..a92ba78b9f 100644 --- a/test/CodeGenCXX/x86_32-arguments.cpp +++ b/test/CodeGenCXX/x86_32-arguments.cpp @@ -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(); } |