From: Trevor Saunders Date: Fri, 21 Aug 2015 01:15:33 +0000 (+0000) Subject: add default for CONSTANT_ALIGNMENT X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b00e42da3a26fae6f878e3b83baffbda7f79227;p=gcc.git add default for CONSTANT_ALIGNMENT gcc/ChangeLog: 2015-08-20 Trevor Saunders * defaults.h (CONSTANT_ALIGNMENT): New macro definition. * builtins.c (get_object_alignment_2): Adjust. * varasm.c (align_variable): Likewise. (get_variable_align): Likewise. (build_constant_desc): Likewise. (force_const_mem): Likewise. * doc/tm.texi.in: Likewise. * doc/tm.texi: Regenerate. From-SVN: r227052 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 294350144c8..20638852b9f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-08-20 Trevor Saunders + + * defaults.h (CONSTANT_ALIGNMENT): New macro definition. + * builtins.c (get_object_alignment_2): Adjust. + * varasm.c (align_variable): Likewise. + (get_variable_align): Likewise. + (build_constant_desc): Likewise. + (force_const_mem): Likewise. + * doc/tm.texi.in: Likewise. + * doc/tm.texi: Regenerate. + 2015-08-20 Trevor Saunders * genconfig.c (main): Always define HAVE_cc0. diff --git a/gcc/builtins.c b/gcc/builtins.c index 31969ca3e53..635ba544133 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -314,10 +314,9 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, /* The alignment of a CONST_DECL is determined by its initializer. */ exp = DECL_INITIAL (exp); align = TYPE_ALIGN (TREE_TYPE (exp)); -#ifdef CONSTANT_ALIGNMENT if (CONSTANT_CLASS_P (exp)) align = (unsigned) CONSTANT_ALIGNMENT (exp, align); -#endif + known_alignment = true; } else if (DECL_P (exp)) @@ -393,10 +392,9 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, /* STRING_CST are the only constant objects we allow to be not wrapped inside a CONST_DECL. */ align = TYPE_ALIGN (TREE_TYPE (exp)); -#ifdef CONSTANT_ALIGNMENT if (CONSTANT_CLASS_P (exp)) align = (unsigned) CONSTANT_ALIGNMENT (exp, align); -#endif + known_alignment = true; } diff --git a/gcc/defaults.h b/gcc/defaults.h index 4fe8eb17f48..d4d3a565c17 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -1273,6 +1273,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define WORD_REGISTER_OPERATIONS 0 #endif +#ifndef CONSTANT_ALIGNMENT +#define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN +#endif + #ifdef GCC_INSN_FLAGS_H /* Dependent default target macro definitions diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f95646c4798..f5a1f84793e 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1098,7 +1098,7 @@ that is being placed in memory. @var{constant} is the constant and have. The value of this macro is used instead of that alignment to align the object. -If this macro is not defined, then @var{basic-align} is used. +The default definition just returns @var{basic-align}. The typical use of this macro is to increase alignment for string constants to be word aligned so that @code{strcpy} calls that copy diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 2383fb97a96..9d5ac0a10e4 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -1048,7 +1048,7 @@ that is being placed in memory. @var{constant} is the constant and have. The value of this macro is used instead of that alignment to align the object. -If this macro is not defined, then @var{basic-align} is used. +The default definition just returns @var{basic-align}. The typical use of this macro is to increase alignment for string constants to be word aligned so that @code{strcpy} calls that copy diff --git a/gcc/varasm.c b/gcc/varasm.c index 2ebac89f99e..7fa2e7be8e4 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1043,7 +1043,6 @@ align_variable (tree decl, bool dont_output_data) if (! DECL_THREAD_LOCAL_P (decl) || data_align <= BITS_PER_WORD) align = data_align; #endif -#ifdef CONSTANT_ALIGNMENT if (DECL_INITIAL (decl) != 0 /* In LTO we have no errors in program; error_mark_node is used to mark offlined constructors. */ @@ -1056,7 +1055,6 @@ align_variable (tree decl, bool dont_output_data) if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD) align = const_align; } -#endif } } @@ -1097,7 +1095,6 @@ get_variable_align (tree decl) if (! DECL_THREAD_LOCAL_P (decl) || data_align <= BITS_PER_WORD) align = data_align; #endif -#ifdef CONSTANT_ALIGNMENT if (DECL_INITIAL (decl) != 0 /* In LTO we have no errors in program; error_mark_node is used to mark offlined constructors. */ @@ -1110,7 +1107,6 @@ get_variable_align (tree decl) if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD) align = const_align; } -#endif } return align; @@ -3286,9 +3282,7 @@ build_constant_desc (tree exp) architectures so use DATA_ALIGNMENT as well, except for strings. */ if (TREE_CODE (exp) == STRING_CST) { -#ifdef CONSTANT_ALIGNMENT DECL_ALIGN (decl) = CONSTANT_ALIGNMENT (exp, DECL_ALIGN (decl)); -#endif } else align_variable (decl, 0); @@ -3743,13 +3737,10 @@ force_const_mem (machine_mode mode, rtx x) /* Align the location counter as required by EXP's data type. */ align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode); -#ifdef CONSTANT_ALIGNMENT - { - tree type = lang_hooks.types.type_for_mode (mode, 0); - if (type != NULL_TREE) - align = CONSTANT_ALIGNMENT (make_tree (type, x), align); - } -#endif + + tree type = lang_hooks.types.type_for_mode (mode, 0); + if (type != NULL_TREE) + align = CONSTANT_ALIGNMENT (make_tree (type, x), align); pool->offset += (align / BITS_PER_UNIT) - 1; pool->offset &= ~ ((align / BITS_PER_UNIT) - 1);