diff options
author | Kevin B. Hendricks <kevin.hendricks@sympatico.ca> | 2003-05-19 17:39:51 +0000 |
---|---|---|
committer | David Edelsohn <dje@gcc.gnu.org> | 2003-05-19 13:39:51 -0400 |
commit | 025d9908d3e3816f06a045d936c569361522ec6e (patch) | |
tree | bdec5aa95ee24c05c7dde6f4af182d9ee60f3d45 /gcc | |
parent | 52a8b7b838128c142fdf8d26ae1d7f073797a7fa (diff) | |
download | gcc-025d9908d3e3816f06a045d936c569361522ec6e.zip gcc-025d9908d3e3816f06a045d936c569361522ec6e.tar.gz gcc-025d9908d3e3816f06a045d936c569361522ec6e.tar.bz2 |
rs6000.c (rs6000_alignment_string, [...]): New variables.
2003-05-18 Kevin B. Hendricks <kevin.hendricks@sympatico.ca>
David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_alignment_string,
rs6000_alignment_flags): New variables.
(rs6000_parse_alignment_option): New function.
(rs6000_override_options): Call it.
* config/rs6000/rs6000.h (TARGET_OPTIONS): Add -malign-XXX option.
(MASK_ALIGN_POWER, MASK_ALIGN_NATURAL, TARGET_ALIGN_NATURAL): New
macros.
* config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Always use COMPUTED
natural alignment if TARGET_NATURAL_ALIGNMENT
(ROUND_TYPE_ALIGN): Always use default record alignment if
TAGET_NATURAL_ALIGNMENT.
* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Same
(ROUND_TYPE_ALIGN): Same.
* config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Same
(ROUND_TYPE_ALIGN): Same.
Co-Authored-By: David Edelsohn <edelsohn@gnu.org>
From-SVN: r66967
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/config/rs6000/aix.h | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/darwin.h | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/linux64.h | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 23 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.h | 21 |
6 files changed, 75 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 484a2d8..797e9d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2003-05-19 Kevin B. Hendricks <kevin.hendricks@sympatico.ca> + David Edelsohn <edelsohn@gnu.org> + + * config/rs6000/rs6000.c (rs6000_alignment_string, + rs6000_alignment_flags): New variables. + (rs6000_parse_alignment_option): New function. + (rs6000_override_options): Call it. + * config/rs6000/rs6000.h (TARGET_OPTIONS): Add -malign-XXX option. + (MASK_ALIGN_POWER, MASK_ALIGN_NATURAL, TARGET_ALIGN_NATURAL): New + macros. + * config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Always use COMPUTED + natural alignment if TARGET_NATURAL_ALIGNMENT + (ROUND_TYPE_ALIGN): Always use default record alignment if + TAGET_NATURAL_ALIGNMENT. + * config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Same + (ROUND_TYPE_ALIGN): Same. + * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Same + (ROUND_TYPE_ALIGN): Same. + 2003-05-19 J"orn Rennecke <joern.rennecke@superh.com> * c-decl.c (finish_decl): When setting the DECL_ASSEMBLER_NAME diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 53425bd..0ca22cd 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -128,12 +128,14 @@ #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc" +/* This now supports a natural alignment mode. */ /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ + (TARGET_ALIGN_NATURAL ? (COMPUTED) : \ (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ ? get_inner_array_type (FIELD) \ : TREE_TYPE (FIELD)) == DFmode \ - ? MIN ((COMPUTED), 32) : (COMPUTED)) + ? MIN ((COMPUTED), 32) : (COMPUTED))) /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ @@ -142,6 +144,7 @@ || 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) \ : MAX ((COMPUTED), (SPECIFIED))) diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 20f1ca2..478b9a6 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -250,12 +250,14 @@ do { \ /* Fix for emit_group_load (): force large constants to be pushed via regs. */ #define ALWAYS_PUSH_CONSTS_USING_REGS_P 1 +/* This now supports a natural alignment mode */ /* Darwin word-aligns FP doubles but doubleword-aligns 64-bit ints. */ #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ + (TARGET_ALIGN_NATURAL ? (COMPUTED) : \ (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ ? get_inner_array_type (FIELD) \ : TREE_TYPE (FIELD)) == DFmode \ - ? MIN ((COMPUTED), 32) : (COMPUTED)) + ? MIN ((COMPUTED), 32) : (COMPUTED))) /* Darwin increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ @@ -264,6 +266,7 @@ do { \ || 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) \ diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 128e3b7..bd3a6a8 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -119,13 +119,15 @@ #define USER_LABEL_PREFIX "" +/* This now supports a natural alignment mode. */ /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ + (TARGET_ALIGN_NATURAL ? (COMPUTED) : \ (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ ? get_inner_array_type (FIELD) \ : TREE_TYPE (FIELD)) == DFmode \ - ? MIN ((COMPUTED), 32) : (COMPUTED)) + ? MIN ((COMPUTED), 32) : (COMPUTED))) /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ @@ -135,6 +137,7 @@ || 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) \ : MAX ((COMPUTED), (SPECIFIED))) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 770df4f..ff7cec6 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -178,6 +178,11 @@ static int rs6000_sr_alias_set; int rs6000_default_long_calls; const char *rs6000_longcall_switch; +/* Control alignment for fields within structures. */ +/* String from -malign-XXXXX. */ +const char *rs6000_alignment_string; +int rs6000_alignment_flags; + struct builtin_description { /* mask is not const because we're going to alter it below. This @@ -290,6 +295,7 @@ static rtx altivec_expand_abs_builtin PARAMS ((enum insn_code, tree, rtx)); static rtx altivec_expand_predicate_builtin PARAMS ((enum insn_code, const char *, tree, rtx)); static rtx altivec_expand_stv_builtin PARAMS ((enum insn_code, tree)); static void rs6000_parse_abi_options PARAMS ((void)); +static void rs6000_parse_alignment_option PARAMS ((void)); static void rs6000_parse_tls_size_option PARAMS ((void)); static void rs6000_parse_yes_no_option (const char *, const char *, int *); static int first_altivec_reg_to_save PARAMS ((void)); @@ -739,6 +745,9 @@ rs6000_override_options (default_cpu) /* Handle -mabi= options. */ rs6000_parse_abi_options (); + /* Handle -malign-XXXXX option. */ + rs6000_parse_alignment_option (); + /* Handle generic -mFOO=YES/NO options. */ rs6000_parse_yes_no_option ("vrsave", rs6000_altivec_vrsave_string, &rs6000_altivec_vrsave); @@ -888,6 +897,20 @@ rs6000_parse_abi_options () error ("unknown ABI specified: '%s'", rs6000_abi_string); } +/* Handle -malign-XXXXXX options. */ +static void +rs6000_parse_alignment_option () +{ + if (rs6000_alignment_string == 0 + || ! strcmp (rs6000_alignment_string, "power")) + rs6000_alignment_flags = MASK_ALIGN_POWER; + else if (! strcmp (rs6000_alignment_string, "natural")) + rs6000_alignment_flags = MASK_ALIGN_NATURAL; + else + error ("unknown -malign-XXXXX option specified: '%s'", + rs6000_alignment_string); +} + /* Validate and record the size specified with the -mtls-size option. */ static void diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 8cd28ac..4eaae01 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -402,6 +402,8 @@ extern enum processor_type rs6000_cpu; {"longcall", &rs6000_longcall_switch, \ N_("Avoid all range limits on call instructions"), 0}, \ {"no-longcall", &rs6000_longcall_switch, "", 0}, \ + {"align-", &rs6000_alignment_string, \ + N_("Specify alignment of structure fields default/natural"), 0}, \ SUBTARGET_OPTIONS \ } @@ -443,6 +445,25 @@ extern const char *rs6000_altivec_vrsave_string; extern int rs6000_altivec_vrsave; extern const char *rs6000_longcall_switch; extern int rs6000_default_long_calls; +extern const char* rs6000_alignment_string; +extern int rs6000_alignment_flags; + +/* Alignment options for fields in structures for sub-targets following + AIX-like ABI. + ALIGN_POWER word-aligns FP doubles (default AIX ABI). + ALIGN_NATURAL doubleword-aligns FP doubles (align to object size). + + Override the macro definitions when compiling libobjc to avoid undefined + reference to rs6000_alignment_flags due to library's use of GCC alignment + macros which use the macros below. */ + +#ifndef IN_TARGET_LIBS +#define MASK_ALIGN_POWER 0x00000000 +#define MASK_ALIGN_NATURAL 0x00000001 +#define TARGET_ALIGN_NATURAL (rs6000_alignment_flags & MASK_ALIGN_NATURAL) +#else +#define TARGET_ALIGN_NATURAL 0 +#endif #define TARGET_LONG_DOUBLE_128 (rs6000_long_double_type_size == 128) #define TARGET_ALTIVEC_ABI rs6000_altivec_abi |