aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorMichael Matz <matz@gcc.gnu.org>2016-04-18 20:36:27 +0000
committerMichael Matz <matz@gcc.gnu.org>2016-04-18 20:36:27 +0000
commitfe37c7afd16ae44daf4256d6bf7bd630382989e4 (patch)
tree2398405f72dc6325d5af24a3f44a44c84a2c9a33 /gcc/stor-layout.c
parent91a47c39bfc0e58ac8fea59ba485d220665eca28 (diff)
downloadgcc-fe37c7afd16ae44daf4256d6bf7bd630382989e4.zip
gcc-fe37c7afd16ae44daf4256d6bf7bd630382989e4.tar.gz
gcc-fe37c7afd16ae44daf4256d6bf7bd630382989e4.tar.bz2
tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount.
* tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount. (SET_TYPE_ALIGN, SET_DECL_ALIGN): New. * tree-core.h (tree_type_common.align): Use bit-field. (tree_type_common.spare): New. (tree_decl_common.off_align): Make smaller. (tree_decl_common.align): Use bit-field. * expr.c (expand_expr_addr_expr_1): Use SET_TYPE_ALIGN. * omp-low.c (install_var_field): Use SET_DECL_ALIGN. (scan_sharing_clauses): Ditto. (finish_taskreg_scan): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (omp_finish_file): Ditto. * stor-layout.c (do_type_align): Use SET_DECL_ALIGN. (layout_decl): Ditto. (relayout_decl): Ditto. (finalize_record_size): Use SET_TYPE_ALIGN. (finalize_type_size): Ditto. (finish_builtin_struct): Ditto. (layout_type): Ditto. (initialize_sizetypes): Ditto. * targhooks.c (std_gimplify_va_arg_expr): Use SET_TYPE_ALIGN. * tree-nested.c (insert_field_into_struct): Use SET_TYPE_ALIGN. (lookup_field_for_decl): Use SET_DECL_ALIGN. (get_chain_field): Ditto. (get_trampoline_type): Ditto. (get_nl_goto_field): Ditto. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use SET_DECL_ALIGN. (unpack_ts_type_common_value_fields): Use SET_TYPE_ALIGN. * gimple-expr.c (copy_var_decl): Use SET_DECL_ALIGN. * tree.c (make_node_stat): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (build_qualified_type): Use SET_TYPE_ALIGN. (build_aligned_type, build_range_type_1): Ditto. (build_atomic_base): Ditto. (build_common_tree_nodes): Ditto. * cfgexpand.c (align_local_variable): Use SET_DECL_ALIGN. (expand_one_stack_var_at): Ditto. * coverage.c (build_var): Use SET_DECL_ALIGN. * except.c (init_eh): Ditto. * function.c (assign_parm_setup_block): Ditto. * symtab.c (increase_alignment_1): Ditto. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Ditto. * tree-vect-stmts.c (ensure_base_align): Ditto. * varasm.c (align_variable): Ditto. (assemble_variable): Ditto. (build_constant_desc): Ditto. (output_constant_def_contents): Ditto. * config/arm/arm.c (arm_relayout_function): Use SET_DECL_ALIGN. * config/avr/avr.c (avr_adjust_type_node): Use SET_TYPE_ALIGN. * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Ditto. * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Ditto. * config/spu/spu.c (spu_build_builtin_va_list): Use SET_DECL_ALIGN. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use SET_TYPE_ALIGN. (gnat_to_gnu_field): Ditto. (components_to_record): Ditto. (create_variant_part_from): Ditto. (copy_and_substitute_in_size): Ditto. (substitute_in_type): Ditto. * gcc-interface/utils.c (make_aligning_type): Use SET_TYPE_ALIGN. (make_packable_type): Ditto. (maybe_pad_type): Ditto. (finish_fat_pointer_type): Ditto. (finish_record_type): Ditto and use SET_DECL_ALIGN. (rest_of_record_type_compilation): Use SET_TYPE_ALIGN. (create_field_decl): Use SET_DECL_ALIGN. c-family/ * c-common.c (handle_aligned_attribute): Use SET_TYPE_ALIGN and SET_DECL_ALIGN. c/ * c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (grokdeclarator, parser_xref_tag, finish_enum): Use SET_TYPE_ALIGN. cp/ * class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (layout_class_type): Ditto. (build_base_field): Use SET_DECL_ALIGN. (fixup_attribute_variants): Use SET_TYPE_ALIGN. * decl.c (duplicate_decls): Use SET_DECL_ALIGN. (record_unknown_type): Use SET_TYPE_ALIGN. (cxx_init_decl_processing): Ditto. (copy_type_enum): Ditto. (grokfndecl): Use SET_DECL_ALIGN. (copy_type_enum): Use SET_TYPE_ALIGN. * pt.c (instantiate_class_template_1): Use SET_TYPE_ALIGN. (tsubst): Ditto. * tree.c (cp_build_qualified_type_real): Use SET_TYPE_ALIGN. * lambda.c (maybe_add_lambda_conv_op): Use SET_DECL_ALIGN. * method.c (implicitly_declare_fn): Use SET_DECL_ALIGN. * rtti.c (emit_tinfo_decl): Ditto. fortran/ * trans-io.c (gfc_build_io_library_fndecls): Use SET_TYPE_ALIGN. * trans-common.c (build_common_decl): Use SET_DECL_ALIGN. * trans-types.c (gfc_add_field_to_struct): Use SET_DECL_ALIGN. go/ * go-gcc.cc (Gcc_backend::implicit_variable): Use SET_DECL_ALIGN. java/ * class.c (add_method_1): Use SET_DECL_ALIGN. (make_class_data): Ditto. (emit_register_classes_in_jcr_section): Ditto. * typeck.c (build_java_array_type): Ditto. objc/ * objc-act.c (objc_build_struct): Use SET_DECL_ALIGN. libcc1/ * plugin.cc (plugin_finish_record_or_union): Use SET_TYPE_ALIGN. From-SVN: r235172
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index d1738d2..5bae23b 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -579,7 +579,7 @@ do_type_align (tree type, tree decl)
{
if (TYPE_ALIGN (type) > DECL_ALIGN (decl))
{
- DECL_ALIGN (decl) = TYPE_ALIGN (type);
+ SET_DECL_ALIGN (decl, TYPE_ALIGN (type));
if (TREE_CODE (decl) == FIELD_DECL)
DECL_USER_ALIGN (decl) = TYPE_USER_ALIGN (type);
}
@@ -672,7 +672,7 @@ layout_decl (tree decl, unsigned int known_align)
#ifdef EMPTY_FIELD_BOUNDARY
if (EMPTY_FIELD_BOUNDARY > DECL_ALIGN (decl))
{
- DECL_ALIGN (decl) = EMPTY_FIELD_BOUNDARY;
+ SET_DECL_ALIGN (decl, EMPTY_FIELD_BOUNDARY);
DECL_USER_ALIGN (decl) = 0;
}
#endif
@@ -694,7 +694,7 @@ layout_decl (tree decl, unsigned int known_align)
&& !(xalign > BITS_PER_UNIT && DECL_PACKED (decl))
&& (known_align == 0 || known_align >= xalign))
{
- DECL_ALIGN (decl) = MAX (xalign, DECL_ALIGN (decl));
+ SET_DECL_ALIGN (decl, MAX (xalign, DECL_ALIGN (decl)));
DECL_MODE (decl) = xmode;
DECL_BIT_FIELD (decl) = 0;
}
@@ -719,7 +719,7 @@ layout_decl (tree decl, unsigned int known_align)
DECL_USER_ALIGN, so we need to check old_user_align instead. */
if (packed_p
&& !old_user_align)
- DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
+ SET_DECL_ALIGN (decl, MIN (DECL_ALIGN (decl), BITS_PER_UNIT));
if (! packed_p && ! DECL_USER_ALIGN (decl))
{
@@ -727,11 +727,11 @@ layout_decl (tree decl, unsigned int known_align)
to a lower boundary than alignment of variables unless
it was overridden by attribute aligned. */
#ifdef BIGGEST_FIELD_ALIGNMENT
- DECL_ALIGN (decl)
- = MIN (DECL_ALIGN (decl), (unsigned) BIGGEST_FIELD_ALIGNMENT);
+ SET_DECL_ALIGN (decl, MIN (DECL_ALIGN (decl),
+ (unsigned) BIGGEST_FIELD_ALIGNMENT));
#endif
#ifdef ADJUST_FIELD_ALIGN
- DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl));
+ SET_DECL_ALIGN (decl, ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl)));
#endif
}
@@ -741,7 +741,7 @@ layout_decl (tree decl, unsigned int known_align)
mfa = maximum_field_alignment;
/* Should this be controlled by DECL_USER_ALIGN, too? */
if (mfa != 0)
- DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), mfa);
+ SET_DECL_ALIGN (decl, MIN (DECL_ALIGN (decl), mfa));
}
/* Evaluate nonconstant size only once, either now or as soon as safe. */
@@ -791,7 +791,7 @@ relayout_decl (tree decl)
DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0;
DECL_MODE (decl) = VOIDmode;
if (!DECL_USER_ALIGN (decl))
- DECL_ALIGN (decl) = 0;
+ SET_DECL_ALIGN (decl, 0);
SET_DECL_RTL (decl, 0);
layout_decl (decl, 0);
@@ -1572,10 +1572,10 @@ finalize_record_size (record_layout_info rli)
/* Determine the desired alignment. */
#ifdef ROUND_TYPE_ALIGN
- TYPE_ALIGN (rli->t) = ROUND_TYPE_ALIGN (rli->t, TYPE_ALIGN (rli->t),
- rli->record_align);
+ SET_TYPE_ALIGN (rli->t, ROUND_TYPE_ALIGN (rli->t, TYPE_ALIGN (rli->t),
+ rli->record_align));
#else
- TYPE_ALIGN (rli->t) = MAX (TYPE_ALIGN (rli->t), rli->record_align);
+ SET_TYPE_ALIGN (rli->t, MAX (TYPE_ALIGN (rli->t), rli->record_align));
#endif
/* Compute the size so far. Be sure to allow for extra bits in the
@@ -1732,15 +1732,15 @@ finalize_type_size (tree type)
alignment of one of the fields. */
if (mode_align >= TYPE_ALIGN (type))
{
- TYPE_ALIGN (type) = mode_align;
+ SET_TYPE_ALIGN (type, mode_align);
TYPE_USER_ALIGN (type) = 0;
}
}
/* Do machine-dependent extra alignment. */
#ifdef ROUND_TYPE_ALIGN
- TYPE_ALIGN (type)
- = ROUND_TYPE_ALIGN (type, TYPE_ALIGN (type), BITS_PER_UNIT);
+ SET_TYPE_ALIGN (type,
+ ROUND_TYPE_ALIGN (type, TYPE_ALIGN (type), BITS_PER_UNIT));
#endif
/* If we failed to find a simple way to calculate the unit size
@@ -1793,7 +1793,7 @@ finalize_type_size (tree type)
valign = MAX (valign, TYPE_ALIGN (variant));
else
TYPE_USER_ALIGN (variant) = user_align;
- TYPE_ALIGN (variant) = valign;
+ SET_TYPE_ALIGN (variant, valign);
TYPE_PRECISION (variant) = precision;
SET_TYPE_MODE (variant, mode);
}
@@ -2087,7 +2087,7 @@ finish_builtin_struct (tree type, const char *name, tree fields,
if (align_type)
{
- TYPE_ALIGN (type) = TYPE_ALIGN (align_type);
+ SET_TYPE_ALIGN (type, TYPE_ALIGN (align_type));
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (align_type);
}
@@ -2200,7 +2200,7 @@ layout_type (tree type)
Instead, query a target hook, defaulting to natural alignment.
This prevents ABI changes depending on whether or not native
vector modes are supported. */
- TYPE_ALIGN (type) = targetm.vector_alignment (type);
+ SET_TYPE_ALIGN (type, targetm.vector_alignment (type));
/* However, if the underlying mode requires a bigger alignment than
what the target hook provides, we cannot use the mode. For now,
@@ -2212,7 +2212,7 @@ layout_type (tree type)
case VOID_TYPE:
/* This is an incomplete type and so doesn't have a size. */
- TYPE_ALIGN (type) = 1;
+ SET_TYPE_ALIGN (type, 1);
TYPE_USER_ALIGN (type) = 0;
SET_TYPE_MODE (type, VOIDmode);
break;
@@ -2337,7 +2337,7 @@ layout_type (tree type)
#else
align = MAX (align, BITS_PER_UNIT);
#endif
- TYPE_ALIGN (type) = align;
+ SET_TYPE_ALIGN (type, align);
SET_TYPE_MODE (type, BLKmode);
if (TYPE_SIZE (type) != 0
&& ! targetm.member_type_forces_blk (type, VOIDmode)
@@ -2609,13 +2609,13 @@ initialize_sizetypes (void)
/* Now layout both types manually. */
SET_TYPE_MODE (sizetype, smallest_mode_for_size (precision, MODE_INT));
- TYPE_ALIGN (sizetype) = GET_MODE_ALIGNMENT (TYPE_MODE (sizetype));
+ SET_TYPE_ALIGN (sizetype, GET_MODE_ALIGNMENT (TYPE_MODE (sizetype)));
TYPE_SIZE (sizetype) = bitsize_int (precision);
TYPE_SIZE_UNIT (sizetype) = size_int (GET_MODE_SIZE (TYPE_MODE (sizetype)));
set_min_and_max_values_for_integral_type (sizetype, precision, UNSIGNED);
SET_TYPE_MODE (bitsizetype, smallest_mode_for_size (bprecision, MODE_INT));
- TYPE_ALIGN (bitsizetype) = GET_MODE_ALIGNMENT (TYPE_MODE (bitsizetype));
+ SET_TYPE_ALIGN (bitsizetype, GET_MODE_ALIGNMENT (TYPE_MODE (bitsizetype)));
TYPE_SIZE (bitsizetype) = bitsize_int (bprecision);
TYPE_SIZE_UNIT (bitsizetype)
= size_int (GET_MODE_SIZE (TYPE_MODE (bitsizetype)));