diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2013-11-22 16:19:21 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@gcc.gnu.org> | 2013-11-22 16:19:21 +0000 |
commit | fceec4d3d738b29c5e5c6d5dadd64c096f053f6a (patch) | |
tree | 6046b2c41ea50ac794232280ab4a1997a352faa9 /gcc | |
parent | 2fb9a547b4c0a5abb0dedb0ffd8848cd7f86bd82 (diff) |
hooks.h (hook_uint_mode_0): Add Prototype.
* hooks.h (hook_uint_mode_0): Add Prototype.
* hooks.c (hook_uint_mode_0): New default function.
* target.def (atomic_align_for_mode): New target hook.
* tree.c (build_atomic_base): Add alignment override parameter.
(build_common_tree_nodes): Use atomic alignment override.
* doc/tm.texi.in (TARGET_ATOMIC_ALIGN_FOR_MODE): Define.
* doc/tm.texi (TARGET_ATOMIC_ALIGN_FOR_MODE): Add description.
From-SVN: r205273
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 4 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 2 | ||||
-rw-r--r-- | gcc/hooks.c | 7 | ||||
-rw-r--r-- | gcc/hooks.h | 1 | ||||
-rw-r--r-- | gcc/target.def | 11 | ||||
-rw-r--r-- | gcc/tree.c | 31 |
7 files changed, 56 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cd1fbc52dbb..4a5c9a1dc24 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2013-11-22 Andrew MacLeod <amacleod@redhat.com> + * hooks.h (hook_uint_mode_0): Add Prototype. + * hooks.c (hook_uint_mode_0): New default function. + * target.def (atomic_align_for_mode): New target hook. + * tree.c (build_atomic_base): Add alignment override parameter. + (build_common_tree_nodes): Use atomic alignment override. + * doc/tm.texi.in (TARGET_ATOMIC_ALIGN_FOR_MODE): Define. + * doc/tm.texi (TARGET_ATOMIC_ALIGN_FOR_MODE): Add description. + +2013-11-22 Andrew MacLeod <amacleod@redhat.com> + * gimple.h: Remove all includes. (recalculate_side_effects): Move prototype to gimplify.h. * Makefile.in (PLUGIN_HEADERS): Add flattened gimple.h includes. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 35cfa995583..925d93f6c26 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -11500,6 +11500,10 @@ The support includes the assembler, linker and dynamic linker. The default value of this hook is based on target's libc. @end deftypefn +@deftypefn {Target Hook} {unsigned int} TARGET_ATOMIC_ALIGN_FOR_MODE (enum machine_mode @var{mode}) +If defined, this function returns an appropriate alignment in bits for an atomic object of machine_mode @var{mode}. If 0 is returned then the default alignment for the specified mode is used. +@end deftypefn + @deftypefn {Target Hook} void TARGET_ATOMIC_ASSIGN_EXPAND_FENV (tree *@var{hold}, tree *@var{clear}, tree *@var{update}) ISO C11 requires atomic compound assignments that may raise floating-point exceptions to raise exceptions corresponding to the arithmetic operation whose result was successfully stored in a compare-and-exchange sequence. This requires code equivalent to calls to @code{feholdexcept}, @code{feclearexcept} and @code{feupdateenv} to be generated at appropriate points in the compare-and-exchange sequence. This hook should set @code{*@var{hold}} to an expression equivalent to the call to @code{feholdexcept}, @code{*@var{clear}} to an expression equivalent to the call to @code{feclearexcept} and @code{*@var{update}} to an expression equivalent to the call to @code{feupdateenv}. The three expressions are @code{NULL_TREE} on entry to the hook and may be left as @code{NULL_TREE} if no code is required in a particular place. The default implementation leaves all three expressions as @code{NULL_TREE}. The @code{__atomic_feraiseexcept} function from @code{libatomic} may be of use as part of the code generated in @code{*@var{update}}. @end deftypefn diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index b10ecd7dda8..edca60089c2 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -8407,4 +8407,6 @@ and the associated definitions of those functions. @hook TARGET_HAS_IFUNC_P +@hook TARGET_ATOMIC_ALIGN_FOR_MODE + @hook TARGET_ATOMIC_ASSIGN_EXPAND_FENV diff --git a/gcc/hooks.c b/gcc/hooks.c index 9f53007337d..ce59503cc07 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -358,6 +358,13 @@ hook_rtx_tree_int_null (tree a ATTRIBUTE_UNUSED, int b ATTRIBUTE_UNUSED) return NULL; } +/* Generic hook that takes a machine mode and returns an unsigned int 0. */ +unsigned int +hook_uint_mode_0 (enum machine_mode m ATTRIBUTE_UNUSED) +{ + return 0; +} + /* Generic hook that takes three trees and returns the last one as is. */ tree hook_tree_tree_tree_tree_3rd_identity (tree a ATTRIBUTE_UNUSED, diff --git a/gcc/hooks.h b/gcc/hooks.h index 38454fbe10a..43191c0ac72 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -92,6 +92,7 @@ extern tree hook_tree_tree_tree_tree_3rd_identity (tree, tree, tree); extern tree hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool); extern unsigned hook_uint_void_0 (void); +extern unsigned int hook_uint_mode_0 (enum machine_mode); extern bool default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT, HOST_WIDE_INT, const_tree); diff --git a/gcc/target.def b/gcc/target.def index f6e42a17b0e..cde4fb49a07 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -5297,6 +5297,17 @@ DEFHOOKPOD @code{bool} @code{true}.", unsigned char, 1) +/* Return an unsigned int representing the alignment (in bits) of the atomic + type which maps to machine MODE. This allows alignment to be overridden + as needed. */ +DEFHOOK +(atomic_align_for_mode, +"If defined, this function returns an appropriate alignment in bits for an\ + atomic object of machine_mode @var{mode}. If 0 is returned then the\ + default alignment for the specified mode is used. ", + unsigned int, (enum machine_mode mode), + hook_uint_mode_0) + DEFHOOK (atomic_assign_expand_fenv, "ISO C11 requires atomic compound assignments that may raise floating-point\ diff --git a/gcc/tree.c b/gcc/tree.c index e81662e7726..d363cfcee6e 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9550,10 +9550,11 @@ make_or_reuse_accum_type (unsigned size, int unsignedp, int satp) during initialization of data types to create the 5 basic atomic types. The generic build_variant_type function requires these to already be set up in order to function properly, so cannot be - called from there. */ + called from there. If ALIGN is non-zero, then ensure alignment is + overridden to this value. */ static tree -build_atomic_base (tree type) +build_atomic_base (tree type, unsigned int align) { tree t; @@ -9564,6 +9565,9 @@ build_atomic_base (tree type) t = build_variant_type_copy (type); set_type_quals (t, TYPE_QUAL_ATOMIC); + if (align) + TYPE_ALIGN (t) = align; + return t; } @@ -9651,14 +9655,21 @@ build_common_tree_nodes (bool signed_char, bool short_double) /* Don't call build_qualified type for atomics. That routine does special processing for atomics, and until they are initialized - it's better not to make that call. */ - - atomicQI_type_node = build_atomic_base (unsigned_intQI_type_node); - atomicHI_type_node = build_atomic_base (unsigned_intHI_type_node); - atomicSI_type_node = build_atomic_base (unsigned_intSI_type_node); - atomicDI_type_node = build_atomic_base (unsigned_intDI_type_node); - atomicTI_type_node = build_atomic_base (unsigned_intTI_type_node); - + it's better not to make that call. + + Check to see if there is a target override for atomic types. */ + + atomicQI_type_node = build_atomic_base (unsigned_intQI_type_node, + targetm.atomic_align_for_mode (QImode)); + atomicHI_type_node = build_atomic_base (unsigned_intHI_type_node, + targetm.atomic_align_for_mode (HImode)); + atomicSI_type_node = build_atomic_base (unsigned_intSI_type_node, + targetm.atomic_align_for_mode (SImode)); + atomicDI_type_node = build_atomic_base (unsigned_intDI_type_node, + targetm.atomic_align_for_mode (DImode)); + atomicTI_type_node = build_atomic_base (unsigned_intTI_type_node, + targetm.atomic_align_for_mode (TImode)); + access_public_node = get_identifier ("public"); access_protected_node = get_identifier ("protected"); access_private_node = get_identifier ("private"); |