diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-01-17 19:48:50 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-01-17 11:48:50 -0800 |
commit | 95727fb877e650d1d4be5798151a2cde09cd0553 (patch) | |
tree | a0ab8ee208b07c4e48ee3c5ef3d40bc702369877 /gcc | |
parent | 4bfaff4d24177c907f1ecb4062501a422f63c6e0 (diff) | |
download | gcc-95727fb877e650d1d4be5798151a2cde09cd0553.zip gcc-95727fb877e650d1d4be5798151a2cde09cd0553.tar.gz gcc-95727fb877e650d1d4be5798151a2cde09cd0553.tar.bz2 |
re PR target/10781 (wrong class size and alignment with static class member)
2004-01-17 Andrew Pinski <pinskia@physics.uc.edu>
PR target/10781
* config/rs6000/rs6000-protos.h (rs6000_special_round_type_align):
Prototype.
* config/rs6000/rs6000.c (rs6000_special_round_type_align):
New function.
* config/rs6000/linux64.h (ROUND_TYPE_ALIGN): Use it.
* config/rs6000/aix.h (ROUND_TYPE_ALIGN): Likewise.
* config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Likewise.
2004-01-17 Andrew Pinski <pinskia@physics.uc.edu>
PR target/10781
* encoding.c (rs6000_special_round_type_align): Define.
From-SVN: r76043
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/config/rs6000/aix.h | 14 | ||||
-rw-r--r-- | gcc/config/rs6000/darwin.h | 19 | ||||
-rw-r--r-- | gcc/config/rs6000/linux64.h | 22 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 22 |
6 files changed, 59 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1f443c..ee0da69 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2004-01-17 Andrew Pinski <pinskia@physics.uc.edu> + + PR target/10781 + * config/rs6000/rs6000-protos.h (rs6000_special_round_type_align): + Prototype. + * config/rs6000/rs6000.c (rs6000_special_round_type_align): + New function. + * config/rs6000/linux64.h (ROUND_TYPE_ALIGN): Use it. + * config/rs6000/aix.h (ROUND_TYPE_ALIGN): Likewise. + * config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Likewise. + 2004-01-17 Jan Hubicka <jh@suse.cz> * toplev.c (rest_of_handle_reorder_blocks): Fix pasto in previous diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 3318621..69a0a01 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -139,14 +139,12 @@ /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ -#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ - ((TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ - && TYPE_FIELDS (STRUCT) != 0 \ - && TARGET_ALIGN_NATURAL == 0 \ - && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \ - ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ +#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ + ((TREE_CODE (STRUCT) == RECORD_TYPE \ + || TREE_CODE (STRUCT) == UNION_TYPE \ + || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && TARGET_ALIGN_NATURAL == 0 \ + ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ : MAX ((COMPUTED), (SPECIFIED))) /* The AIX ABI isn't explicit on whether aggregates smaller than a diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index c77279d..6db0006 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -295,16 +295,14 @@ do { \ /* Darwin increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ -#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ - ((TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ - && TYPE_FIELDS (STRUCT) != 0 \ - && TARGET_ALIGN_NATURAL == 0 \ - && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \ - ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ - : (TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \ - ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ +#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ + ((TREE_CODE (STRUCT) == RECORD_TYPE \ + || TREE_CODE (STRUCT) == UNION_TYPE \ + || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && TARGET_ALIGN_NATURAL == 0 \ + ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ + : (TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \ + ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ : MAX ((COMPUTED), (SPECIFIED))) /* XXX: Darwin supports neither .quad, or .llong, but it also doesn't @@ -322,3 +320,4 @@ do { \ #undef REGISTER_TARGET_PRAGMAS #define REGISTER_TARGET_PRAGMAS DARWIN_REGISTER_TARGET_PRAGMAS + diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index d56c106..d36aef4 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -224,19 +224,17 @@ : (COMPUTED)) /* PowerPC64 Linux increases natural record alignment to doubleword if - the first field is an FP double. */ + the first field is an FP double, only if in power alignment mode. */ #undef ROUND_TYPE_ALIGN -#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ - ((TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \ - ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ - : (TARGET_64BIT \ - && (TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ - && TYPE_FIELDS (STRUCT) != 0 \ - && TARGET_ALIGN_NATURAL == 0 \ - && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode) \ - ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ +#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ + ((TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \ + ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ + : (TARGET_64BIT \ + && (TREE_CODE (STRUCT) == RECORD_TYPE \ + || TREE_CODE (STRUCT) == UNION_TYPE \ + || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && TARGET_ALIGN_NATURAL == 0) \ + ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ : MAX ((COMPUTED), (SPECIFIED))) /* Indicate that jump tables go in the text section. */ diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index abf39c6..b98027e 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -144,6 +144,7 @@ extern rtx rs6000_machopic_legitimize_pic_address (rtx orig, #endif /* RTX_CODE */ #ifdef TREE_CODE +extern int rs6000_special_round_type_align (tree, int, int); extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern int function_arg_boundary (enum machine_mode, tree); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 183cf21..0a5de53 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2317,6 +2317,28 @@ input_operand (rtx op, enum machine_mode mode) return 0; } + +/* Darwin, AIX increases natural record alignment to doubleword if the first + field is an FP double while the FP fields remain word aligned. */ + +int +rs6000_special_round_type_align (tree type, int computed, int specified) +{ + tree field = TYPE_FIELDS (type); + if (!field) + return MAX (computed, specified); + + /* Skip all the static variables only if ABI is greater than + 1 or equal to 0. */ + while (TREE_CODE (field) == VAR_DECL) + field = TREE_CHAIN (field); + + if (field == type || DECL_MODE (field) != DFmode) + return MAX (computed, specified); + + return MAX (MAX (computed, specified), 64); +} + /* Return 1 for an operand in small memory on V.4/eabi. */ int |