[llvm-commits] [llvm-gcc-4.2] r46381 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp
Evan Cheng
evan.cheng at apple.com
Fri Jan 25 16:17:32 PST 2008
Author: evancheng
Date: Fri Jan 25 18:17:32 2008
New Revision: 46381
URL: http://llvm.org/viewvc/llvm-project?rev=46381&view=rev
Log:
Also drop zero-sized aggregates during type conversion.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
llvm-gcc-4.2/trunk/gcc/llvm-internal.h
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
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=46381&r1=46380&r2=46381&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Fri Jan 25 18:17:32 2008
@@ -120,13 +120,6 @@
}
}
-/// isAggregareOfSizeZero - Returns true if this is an aggregate with size zero.
-///
-static bool isAggregareOfSizeZero(tree type) {
- if (!isAggregateTreeType(type)) return false;
- return int_size_in_bytes(type) == 0;
-}
-
// LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR - Return true if this aggregate
// value should be passed by value, i.e. passing its address with the byval
// attribute bit set. The default is false.
@@ -234,7 +227,7 @@
PassInMixedRegisters(type, Ty, Elts);
} else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
PassInIntegerRegisters(type, Ty);
- } else if (isAggregareOfSizeZero(type)) {
+ } else if (isAggregateOfSizeZero(type)) {
// Zero sized aggregare, just drop it!
;
} else if (TREE_CODE(type) == RECORD_TYPE) {
Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=46381&r1=46380&r2=46381&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Fri Jan 25 18:17:32 2008
@@ -118,6 +118,10 @@
/// element added to match llvm struct type size and gcc struct type size.
bool isPaddingElement(const Type *T, unsigned N);
+/// isAggregateOfSizeZero - Returns true if this is an aggregate with size zero.
+///
+bool isAggregateOfSizeZero(union tree_node*);
+
/// TypeConverter - Implement the converter from GCC types to LLVM types.
///
class TypeConverter {
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=46381&r1=46380&r2=46381&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Jan 25 18:17:32 2008
@@ -1610,6 +1610,14 @@
}
+/// isAggregateOfSizeZero - Returns true if this is an aggregate with size zero.
+///
+bool isAggregateOfSizeZero(tree type) {
+ if (!isAggregateTreeType(type)) return false;
+ return int_size_in_bytes(type) == 0;
+}
+
+
/// Mapping from type to type-used-as-base-class and back.
static DenseMap<tree, tree> BaseTypesMap;
@@ -2044,6 +2052,9 @@
unsigned FieldOffsetInBits = getFieldOffsetInBits(Field);
tree FieldType = getDeclaredType(Field);
+ if (isAggregateOfSizeZero(FieldType))
+ continue;
+
// If this is a bitfield, we may want to adjust the FieldOffsetInBits to
// produce safe code. In particular, bitfields will be loaded/stored as
// their *declared* type, not the smallest integer type that contains
More information about the llvm-commits
mailing list