Add inreg attributes to reference arguments.

llvm-svn: 145189
This commit is contained in:
Rafael Espindola 2011-11-27 18:35:39 +00:00
parent 251d827d2c
commit 32d8a275b9
2 changed files with 8 additions and 1 deletions

View File

@ -831,7 +831,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
// FALL THROUGH
case ABIArgInfo::Direct:
if (RegParm > 0 &&
(ParamType->isIntegerType() || ParamType->isPointerType())) {
(ParamType->isIntegerType() || ParamType->isPointerType() ||
ParamType->isReferenceType())) {
RegParm -=
(Context.getTypeSize(ParamType) + PointerWidth - 1) / PointerWidth;
if (RegParm >= 0)

View File

@ -0,0 +1,6 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
// CHECK: _Z3fooRi(i32* inreg
void __attribute__ ((regparm (1))) foo(int &a) {
}