aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
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/cp
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/cp')
-rw-r--r--gcc/cp/ChangeLog19
-rw-r--r--gcc/cp/class.c10
-rw-r--r--gcc/cp/decl.c12
-rw-r--r--gcc/cp/lambda.c2
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/cp/rtti.c2
-rw-r--r--gcc/cp/tree.c2
8 files changed, 36 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 104da7b..c50c6ab 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,22 @@
+2016-04-18 Michael Matz <matz@suse.de>
+
+ * 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.
+
2016-04-18 Jason Merrill <jason@redhat.com>
PR c++/70690
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 2c5ce73..2705e18 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -801,7 +801,7 @@ build_vtable (tree class_type, tree name, tree vtable_type)
TREE_STATIC (decl) = 1;
TREE_READONLY (decl) = 1;
DECL_VIRTUAL_P (decl) = 1;
- DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN;
+ SET_DECL_ALIGN (decl, TARGET_VTABLE_ENTRY_ALIGN);
DECL_USER_ALIGN (decl) = true;
DECL_VTABLE_OR_VTT_P (decl) = 1;
set_linkage_according_to_type (class_type, decl);
@@ -2035,7 +2035,7 @@ fixup_attribute_variants (tree t)
valign = MAX (valign, TYPE_ALIGN (variants));
else
TYPE_USER_ALIGN (variants) = user_align;
- TYPE_ALIGN (variants) = valign;
+ SET_TYPE_ALIGN (variants, valign);
if (may_alias)
fixup_may_alias (variants);
}
@@ -4484,7 +4484,7 @@ build_base_field (record_layout_info rli, tree binfo,
{
DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
- DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
+ SET_DECL_ALIGN (decl, CLASSTYPE_ALIGN (basetype));
DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype);
DECL_MODE (decl) = TYPE_MODE (basetype);
DECL_FIELD_IS_BASE (decl) = 1;
@@ -6404,7 +6404,7 @@ layout_class_type (tree t, tree *virtuals_p)
}
DECL_SIZE (field) = TYPE_SIZE (integer_type);
- DECL_ALIGN (field) = TYPE_ALIGN (integer_type);
+ SET_DECL_ALIGN (field, TYPE_ALIGN (integer_type));
DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type);
layout_nonempty_base_or_field (rli, field, NULL_TREE,
empty_base_offsets);
@@ -6539,7 +6539,7 @@ layout_class_type (tree t, tree *virtuals_p)
size_binop (MULT_EXPR,
fold_convert (bitsizetype, eoc),
bitsize_int (BITS_PER_UNIT)));
- TYPE_ALIGN (base_t) = rli->record_align;
+ SET_TYPE_ALIGN (base_t, rli->record_align);
TYPE_USER_ALIGN (base_t) = TYPE_USER_ALIGN (t);
/* Copy the fields from T. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 38e6bd8..461822b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2066,7 +2066,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (TYPE_USER_ALIGN (tem))
{
if (TYPE_ALIGN (tem) > TYPE_ALIGN (newtype))
- TYPE_ALIGN (newtype) = TYPE_ALIGN (tem);
+ SET_TYPE_ALIGN (newtype, TYPE_ALIGN (tem));
TYPE_USER_ALIGN (newtype) = true;
}
@@ -2490,7 +2490,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Likewise for DECL_ALIGN, DECL_USER_ALIGN and DECL_PACKED. */
if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
{
- DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
+ SET_DECL_ALIGN (newdecl, DECL_ALIGN (olddecl));
DECL_USER_ALIGN (newdecl) |= DECL_USER_ALIGN (olddecl);
}
DECL_USER_ALIGN (olddecl) = DECL_USER_ALIGN (newdecl);
@@ -3919,7 +3919,7 @@ record_unknown_type (tree type, const char* name)
DECL_IGNORED_P (decl) = 1;
TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
TYPE_SIZE (type) = TYPE_SIZE (void_type_node);
- TYPE_ALIGN (type) = 1;
+ SET_TYPE_ALIGN (type, 1);
TYPE_USER_ALIGN (type) = 0;
SET_TYPE_MODE (type, TYPE_MODE (void_type_node));
}
@@ -4174,7 +4174,7 @@ cxx_init_decl_processing (void)
TYPE_UNSIGNED (nullptr_type_node) = 1;
TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
if (abi_version_at_least (9))
- TYPE_ALIGN (nullptr_type_node) = GET_MODE_ALIGNMENT (ptr_mode);
+ SET_TYPE_ALIGN (nullptr_type_node, GET_MODE_ALIGNMENT (ptr_mode));
SET_TYPE_MODE (nullptr_type_node, ptr_mode);
record_builtin_type (RID_MAX, "decltype(nullptr)", nullptr_type_node);
nullptr_node = build_int_cst (nullptr_type_node, 0);
@@ -7924,7 +7924,7 @@ grokfndecl (tree ctype,
parms = parm;
/* Allocate space to hold the vptr bit if needed. */
- DECL_ALIGN (decl) = MINIMUM_METHOD_BOUNDARY;
+ SET_DECL_ALIGN (decl, MINIMUM_METHOD_BOUNDARY);
}
DECL_ARGUMENTS (decl) = parms;
for (t = parms; t; t = DECL_CHAIN (t))
@@ -13115,7 +13115,7 @@ copy_type_enum (tree dst, tree src)
valign = MAX (valign, TYPE_ALIGN (t));
else
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (src);
- TYPE_ALIGN (t) = valign;
+ SET_TYPE_ALIGN (t, valign);
TYPE_UNSIGNED (t) = TYPE_UNSIGNED (src);
}
}
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index cdc11fe..374a78b 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -1006,7 +1006,7 @@ maybe_add_lambda_conv_op (tree type)
tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype);
tree fn = convfn;
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);
- DECL_ALIGN (fn) = MINIMUM_METHOD_BOUNDARY;
+ SET_DECL_ALIGN (fn, MINIMUM_METHOD_BOUNDARY);
SET_OVERLOADED_OPERATOR_CODE (fn, TYPE_EXPR);
grokclassfn (type, fn, NO_SPECIAL);
set_linkage_according_to_type (type, fn);
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 38f2a54..862451f 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1865,7 +1865,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR);
}
- DECL_ALIGN (fn) = MINIMUM_METHOD_BOUNDARY;
+ SET_DECL_ALIGN (fn, MINIMUM_METHOD_BOUNDARY);
/* Create the explicit arguments. */
if (rhs_parm_type)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 325351f..a6d56d1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9856,7 +9856,7 @@ instantiate_class_template_1 (tree type)
DECL_SOURCE_LOCATION (typedecl);
TYPE_PACKED (type) = TYPE_PACKED (pattern);
- TYPE_ALIGN (type) = TYPE_ALIGN (pattern);
+ SET_TYPE_ALIGN (type, TYPE_ALIGN (pattern));
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (pattern);
TYPE_FOR_JAVA (type) = TYPE_FOR_JAVA (pattern); /* For libjava's JArray<T> */
if (ANON_AGGR_TYPE_P (pattern))
@@ -13403,7 +13403,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (TYPE_USER_ALIGN (t))
{
- TYPE_ALIGN (r) = TYPE_ALIGN (t);
+ SET_TYPE_ALIGN (r, TYPE_ALIGN (t));
TYPE_USER_ALIGN (r) = 1;
}
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 244c34d..43d5f15 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1603,7 +1603,7 @@ emit_tinfo_decl (tree decl)
/* Avoid targets optionally bumping up the alignment to improve
vector instruction accesses, tinfo are never accessed this way. */
#ifdef DATA_ABI_ALIGNMENT
- DECL_ALIGN (decl) = DATA_ABI_ALIGNMENT (decl, TYPE_ALIGN (TREE_TYPE (decl)));
+ SET_DECL_ALIGN (decl, DATA_ABI_ALIGNMENT (decl, TYPE_ALIGN (TREE_TYPE (decl))));
DECL_USER_ALIGN (decl) = true;
#endif
return true;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index e34215c..112c8c7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1074,7 +1074,7 @@ cp_build_qualified_type_real (tree type,
{
t = build_variant_type_copy (t);
TYPE_NAME (t) = TYPE_NAME (type);
- TYPE_ALIGN (t) = TYPE_ALIGN (type);
+ SET_TYPE_ALIGN (t, TYPE_ALIGN (type));
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (type);
}
}