[llvm-commits] [llvm-gcc-4.2] r46966 - in /llvm-gcc-4.2/trunk/gcc: config/i386/i386.h config/rs6000/rs6000.h llvm-abi.h
Dale Johannesen
dalej at apple.com
Mon Feb 11 11:45:48 PST 2008
Author: johannes
Date: Mon Feb 11 13:45:46 2008
New Revision: 46966
URL: http://llvm.org/viewvc/llvm-project?rev=46966&view=rev
Log:
Treat struct { long long: 29; }; as int sized and
aligned, rather than long long. ABI issue.
Remove nonfunctional target-specific versions of
LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS.
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=46966&r1=46965&r2=46966&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Mon Feb 11 13:45:46 2008
@@ -3744,13 +3744,6 @@
/* LLVM ABI definition macros. */
-/* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if we should
- * "bitconvert" the specified aggregate tree type info a sequence of integer
- * values.
- */
-#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type) \
- !isSingleElementStructOrArray(type)
-
/* When -m64 is specified, set the architecture to x86_64-os-blah even if the
* compiler was configured for i[3456]86-os-blah.
*/
Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h?rev=46966&r1=46965&r2=46966&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h Mon Feb 11 13:45:46 2008
@@ -3458,13 +3458,6 @@
F.AddFeature("64bit", TARGET_POWERPC64); \
}
-/* GCC passes single-element structs and arrays in registers. Other structs
- * are forced into integer registers, e.g. complex float is passed in two
- * 32-bit GPR's.
- */
-#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type) \
- !isSingleElementStructOrArray(type)
-
/* When -m64 is specified, set the architecture to powerpc64-os-blah even if the
* compiler was configured for powerpc-os-blah.
*/
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=46966&r1=46965&r2=46966&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Feb 11 13:45:46 2008
@@ -87,8 +87,9 @@
/// isSingleElementStructOrArray - If this is (recursively) a structure with one
/// field or an array with one element, return the field type, otherwise return
-/// null.
-static tree isSingleElementStructOrArray(tree type) {
+/// null. If rejectFatBitField, and the single element is a bitfield of a type
+/// that's bigger than the struct, return null anyway.
+static tree isSingleElementStructOrArray(tree type, bool rejectFatBitfield) {
// Scalars are good.
if (!isAggregateTreeType(type)) return type;
@@ -106,17 +107,22 @@
for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
if (TREE_CODE(Field) == FIELD_DECL) {
- if (!FoundField)
+ if (!FoundField) {
+ if (rejectFatBitfield &&
+ TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST &&
+ TREE_INT_CST_LOW(TYPE_SIZE(getDeclaredType(Field))) >
+ TREE_INT_CST_LOW(TYPE_SIZE(type)))
+ return 0;
FoundField = getDeclaredType(Field);
- else
+ } else
return 0; // More than one field.
}
- return FoundField ? isSingleElementStructOrArray(FoundField) : 0;
+ return FoundField ? isSingleElementStructOrArray(FoundField, false) : 0;
case ARRAY_TYPE:
const ArrayType *Ty = dyn_cast<ArrayType>(ConvertType(type));
if (!Ty || Ty->getNumElements() != 1)
return 0;
- return isSingleElementStructOrArray(TREE_TYPE(type));
+ return isSingleElementStructOrArray(TREE_TYPE(type), false);
}
}
@@ -151,10 +157,12 @@
// value should be passed in integer registers. By default, we do this for all
// values that are not single-element structs. This ensures that things like
// {short,short} are passed in one 32-bit chunk, not as two arguments (which
-// would often be 64-bits).
+// would often be 64-bits). We also do it for single-element structs when the
+// single element is a bitfield of a type bigger than the struct; the code
+// for field-by-field struct passing does not handle this one right.
#ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
- !isSingleElementStructOrArray(X)
+ !isSingleElementStructOrArray(X, true)
#endif
/// DefaultABI - This class implements the default LLVM ABI where structures are
@@ -184,7 +192,7 @@
// FIXME: this is a hack around returning 'complex double' by-val
// which returns in r3/r4/r5/r6 on PowerPC.
TREE_INT_CST_LOW(TYPE_SIZE_UNIT(type)) <= 8) {
- if (tree SingleElt = isSingleElementStructOrArray(type)) {
+ if (tree SingleElt = isSingleElementStructOrArray(type, false)) {
C.HandleAggregateResultAsScalar(ConvertType(SingleElt));
} else {
// Otherwise return as an integer value large enough to hold the entire
More information about the llvm-commits
mailing list