add default for CONSTANT_ALIGNMENT
gcc/ChangeLog: 2015-08-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * 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
This commit is contained in:
parent
70b0dcce28
commit
6b00e42da3
@ -1,3 +1,14 @@
|
||||
2015-08-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* 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 <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* genconfig.c (main): Always define HAVE_cc0.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
17
gcc/varasm.c
17
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user