[cfe-commits] r145189 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGenCXX/regparm.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sun Nov 27 10:35:39 PST 2011
Author: rafael
Date: Sun Nov 27 12:35:39 2011
New Revision: 145189
URL: http://llvm.org/viewvc/llvm-project?rev=145189&view=rev
Log:
Add inreg attributes to reference arguments.
Added:
cfe/trunk/test/CodeGenCXX/regparm.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=145189&r1=145188&r2=145189&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Sun Nov 27 12:35:39 2011
@@ -831,7 +831,8 @@
// 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)
Added: cfe/trunk/test/CodeGenCXX/regparm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/regparm.cpp?rev=145189&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/regparm.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/regparm.cpp Sun Nov 27 12:35:39 2011
@@ -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) {
+}
More information about the cfe-commits
mailing list