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
This commit is contained in:
Kevin B. Hendricks 2003-05-19 17:39:51 +00:00 committed by David Edelsohn
parent 52a8b7b838
commit 025d9908d3
6 changed files with 75 additions and 3 deletions

View File

@ -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

View File

@ -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)))

View File

@ -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) \

View File

@ -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)))

View File

@ -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

View File

@ -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