From 899ca90e6defb9d63e03764ceb9afe0fc94fbdb1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 18 Nov 2016 10:03:12 +0000 Subject: [PATCH] Add SET_DECL_MODE This may no longer be necessary with the current version of the SVE patches, but it does at least make things consistent with the TYPE_MODE/SET_TYPE_MODE split. gcc/ada/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * gcc-interface/utils.c (create_label_decl): Use SET_DECL_MODE. gcc/c/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * c-decl.c (merge_decls): Use SET_DECL_MODE. (make_label, finish_struct): Likewise. gcc/cp/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * class.c (finish_struct_bits): Use SET_DECL_MODE. (build_base_field_1, layout_class_type, finish_struct_1): Likewise. * decl.c (make_label_decl): Likewise. * pt.c (tsubst_decl): Likewise. gcc/fortran/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * trans-common.c (build_common_decl): Use SET_DECL_MODE. * trans-decl.c (gfc_build_label_decl): Likewise. * trans-types.c (gfc_get_array_descr_info): Likewise. gcc/lto/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * lto.c (offload_handle_link_vars): Use SET_DECL_MODE. gcc/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * tree.h (SET_DECL_MODE): New macro. * cfgexpand.c (avoid_deep_ter_for_debug): Use SET_DECL_MODE. (expand_gimple_basic_block): Likewise. * function.c (split_complex_args): Likeise. * ipa-prop.c (ipa_modify_call_arguments): Likewise. * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise. * stor-layout.c (layout_decl, relayout_decl): Likewise. (finish_bitfield_representative): Likewise. * tree.c (make_node_stat): Likewise. * tree-inline.c (remap_ssa_name): Likewise. (tree_function_versioning): Likewise. * tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise. * tree-sra.c (sra_ipa_reset_debug_stmts): Likewise. * tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise. * tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise. * tree-ssa.c (insert_debug_temp_for_var_def): Likewise. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise. * varasm.c (make_debug_expr_from_rtl): Likewise. libcc1/ 2016-11-16 Richard Sandiford Alan Hayward David Sherwood * plugin.cc (plugin_build_add_field): Use SET_DECL_MODE. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r242585 --- gcc/ChangeLog | 23 +++++++++++++++++++++++ gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/utils.c | 2 +- gcc/c/ChangeLog | 7 +++++++ gcc/c/c-decl.c | 6 +++--- gcc/cfgexpand.c | 4 ++-- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/class.c | 8 ++++---- gcc/cp/decl.c | 2 +- gcc/cp/pt.c | 2 +- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans-common.c | 2 +- gcc/fortran/trans-decl.c | 2 +- gcc/fortran/trans-types.c | 2 +- gcc/function.c | 2 +- gcc/ipa-prop.c | 2 +- gcc/lto/ChangeLog | 6 ++++++ gcc/lto/lto.c | 2 +- gcc/omp-simd-clone.c | 2 +- gcc/stor-layout.c | 10 +++++----- gcc/tree-inline.c | 6 +++--- gcc/tree-into-ssa.c | 2 +- gcc/tree-sra.c | 2 +- gcc/tree-ssa-ccp.c | 2 +- gcc/tree-ssa-loop-ivopts.c | 4 ++-- gcc/tree-ssa.c | 4 ++-- gcc/tree-streamer-in.c | 2 +- gcc/tree.c | 2 +- gcc/tree.h | 2 ++ gcc/varasm.c | 2 +- libcc1/ChangeLog | 6 ++++++ libcc1/plugin.cc | 2 +- 32 files changed, 105 insertions(+), 38 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c79a433ccc8..b4291641e67 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * tree.h (SET_DECL_MODE): New macro. + * cfgexpand.c (avoid_deep_ter_for_debug): Use SET_DECL_MODE. + (expand_gimple_basic_block): Likewise. + * function.c (split_complex_args): Likeise. + * ipa-prop.c (ipa_modify_call_arguments): Likewise. + * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise. + * stor-layout.c (layout_decl, relayout_decl): Likewise. + (finish_bitfield_representative): Likewise. + * tree.c (make_node_stat): Likewise. + * tree-inline.c (remap_ssa_name): Likewise. + (tree_function_versioning): Likewise. + * tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise. + * tree-sra.c (sra_ipa_reset_debug_stmts): Likewise. + * tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise. + * tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise. + * tree-ssa.c (insert_debug_temp_for_var_def): Likewise. + * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise. + * varasm.c (make_debug_expr_from_rtl): Likewise. + 2016-11-18 Segher Boessenkool PR rtl-optimization/71785 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 937f9243e80..c72ac09e148 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * gcc-interface/utils.c (create_label_decl): Use SET_DECL_MODE. + 2016-11-14 Eric Botcazou * gcc-interface/Makefile.in: Replace s-interr-hwint.adb with diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index c06721f03b1..fd6c2029d03 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -3111,7 +3111,7 @@ create_label_decl (tree name, Node_Id gnat_node) tree label_decl = build_decl (input_location, LABEL_DECL, name, void_type_node); - DECL_MODE (label_decl) = VOIDmode; + SET_DECL_MODE (label_decl, VOIDmode); /* Add this decl to the current binding level. */ gnat_pushdecl (label_decl, gnat_node); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e7b1b3ceb17..98bb93851d9 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * c-decl.c (merge_decls): Use SET_DECL_MODE. + (make_label, finish_struct): Likewise. + 2016-11-14 Prasad Ghangal Richard Biener diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 3e1b7a4016b..23581447a35 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2373,7 +2373,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) /* Since the type is OLDDECL's, make OLDDECL's size go with. */ DECL_SIZE (newdecl) = DECL_SIZE (olddecl); DECL_SIZE_UNIT (newdecl) = DECL_SIZE_UNIT (olddecl); - DECL_MODE (newdecl) = DECL_MODE (olddecl); + SET_DECL_MODE (newdecl, DECL_MODE (olddecl)); if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl)) { SET_DECL_ALIGN (newdecl, DECL_ALIGN (olddecl)); @@ -3521,7 +3521,7 @@ make_label (location_t location, tree name, bool defining, { tree label = build_decl (location, LABEL_DECL, name, void_type_node); DECL_CONTEXT (label) = current_function_decl; - DECL_MODE (label) = VOIDmode; + SET_DECL_MODE (label, VOIDmode); c_label_vars *label_vars = ggc_alloc (); label_vars->shadowed = NULL; @@ -7995,7 +7995,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, { TREE_TYPE (field) = c_build_bitfield_integer_type (width, TYPE_UNSIGNED (type)); - DECL_MODE (field) = TYPE_MODE (TREE_TYPE (field)); + SET_DECL_MODE (field, TYPE_MODE (TREE_TYPE (field))); } DECL_INITIAL (field) = 0; } diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 7ffb5585b76..9cca6111ee4 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4053,7 +4053,7 @@ avoid_deep_ter_for_debug (gimple *stmt, int depth) gimple *def_temp = gimple_build_debug_bind (vexpr, use, g); DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (use); - DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (use)); + SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (use))); gimple_stmt_iterator gsi = gsi_for_stmt (g); gsi_insert_after (&gsi, def_temp, GSI_NEW_STMT); avoid_deep_ter_for_debug (def_temp, 0); @@ -5581,7 +5581,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) mode = DECL_MODE (value); else mode = TYPE_MODE (TREE_TYPE (value)); - DECL_MODE (vexpr) = mode; + SET_DECL_MODE (vexpr, mode); val = gen_rtx_VAR_LOCATION (mode, vexpr, (rtx)value, VAR_INIT_STATUS_INITIALIZED); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index afc2c164511..21a18306afd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * class.c (finish_struct_bits): Use SET_DECL_MODE. + (build_base_field_1, layout_class_type, finish_struct_1): Likewise. + * decl.c (make_label_decl): Likewise. + * pt.c (tsubst_decl): Likewise. + 2016-11-17 Jason Merrill PR c++/78193 - inherited ctor regressions on sparc32. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 5460ae5d626..df4d73c4d30 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2129,7 +2129,7 @@ finish_struct_bits (tree t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) { tree variants; - DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode; + SET_DECL_MODE (TYPE_MAIN_DECL (t), BLKmode); for (variants = t; variants; variants = TYPE_NEXT_VARIANT (variants)) { SET_TYPE_MODE (variants, BLKmode); @@ -4525,7 +4525,7 @@ build_base_field_1 (tree t, tree basetype, tree *&next_field) DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype); SET_DECL_ALIGN (decl, CLASSTYPE_ALIGN (basetype)); DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); - DECL_MODE (decl) = TYPE_MODE (basetype); + SET_DECL_MODE (decl, TYPE_MODE (basetype)); DECL_FIELD_IS_BASE (decl) = 1; /* Add the new FIELD_DECL to the list of fields for T. */ @@ -6502,7 +6502,7 @@ layout_class_type (tree t, tree *virtuals_p) field is effectively invisible. */ DECL_SIZE (field) = TYPE_SIZE (type); /* We must also reset the DECL_MODE of the field. */ - DECL_MODE (field) = TYPE_MODE (type); + SET_DECL_MODE (field, TYPE_MODE (type)); } else layout_nonempty_base_or_field (rli, field, NULL_TREE, @@ -7285,7 +7285,7 @@ finish_struct_1 (tree t) if (VAR_P (x) && TREE_STATIC (x) && TREE_TYPE (x) != error_mark_node && same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t)) - DECL_MODE (x) = TYPE_MODE (t); + SET_DECL_MODE (x, TYPE_MODE (t)); /* Done with FIELDS...now decide whether to sort these for faster lookups later. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2dc9314bc1e..19550f3e16e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2967,7 +2967,7 @@ make_label_decl (tree id, int local_p) decl = build_decl (input_location, LABEL_DECL, id, void_type_node); DECL_CONTEXT (decl) = current_function_decl; - DECL_MODE (decl) = VOIDmode; + SET_DECL_MODE (decl, VOIDmode); C_DECLARED_LABEL_FLAG (decl) = local_p; /* Say where one reference is to the label, for the sake of the diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7eeb27ddd1c..6a68de24bbb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12570,7 +12570,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) see [temp.inst]. */ DECL_INITIAL (r) = NULL_TREE; if (VAR_P (r)) - DECL_MODE (r) = VOIDmode; + SET_DECL_MODE (r, VOIDmode); if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL)) SET_DECL_RTL (r, NULL); DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0; diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6d7d415eae1..619da1baa20 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * trans-common.c (build_common_decl): Use SET_DECL_MODE. + * trans-decl.c (gfc_build_label_decl): Likewise. + * trans-types.c (gfc_get_array_descr_info): Likewise. + 2016-11-17 Janus Weil PR fortran/66227 diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index cd06e154ef3..3207105505d 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -408,7 +408,7 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init) { DECL_SIZE (decl) = TYPE_SIZE (union_type); DECL_SIZE_UNIT (decl) = size; - DECL_MODE (decl) = TYPE_MODE (union_type); + SET_DECL_MODE (decl, TYPE_MODE (union_type)); TREE_TYPE (decl) = union_type; layout_decl (decl, 0); } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 7c9730c7a85..ba71a21b788 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -274,7 +274,7 @@ gfc_build_label_decl (tree label_id) label_decl = build_decl (input_location, LABEL_DECL, label_id, void_type_node); DECL_CONTEXT (label_decl) = current_function_decl; - DECL_MODE (label_decl) = VOIDmode; + SET_DECL_MODE (label_decl, VOIDmode); /* We always define the label as used, even if the original source file never references the label. We don't want all kinds of diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 6f9bc381df6..354308f8d9d 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3188,7 +3188,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info) base_decl = make_node (DEBUG_EXPR_DECL); DECL_ARTIFICIAL (base_decl) = 1; TREE_TYPE (base_decl) = indirect ? build_pointer_type (ptype) : ptype; - DECL_MODE (base_decl) = TYPE_MODE (TREE_TYPE (base_decl)); + SET_DECL_MODE (base_decl, TYPE_MODE (TREE_TYPE (base_decl))); GFC_TYPE_ARRAY_BASE_DECL (type, indirect) = base_decl; } info->base_decl = base_decl; diff --git a/gcc/function.c b/gcc/function.c index 0b1d16805ac..491f3d1d2d6 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2322,7 +2322,7 @@ split_complex_args (vec *args) p = copy_node (p); TREE_TYPE (p) = subtype; DECL_ARG_TYPE (p) = TREE_TYPE (DECL_ARG_TYPE (p)); - DECL_MODE (p) = VOIDmode; + SET_DECL_MODE (p, VOIDmode); DECL_SIZE (p) = NULL; DECL_SIZE_UNIT (p) = NULL; /* If this arg must go in memory, put it in a pseudo here. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 6321fddb02c..90c19fc06c5 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -4344,7 +4344,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt, ddecl = make_node (DEBUG_EXPR_DECL); DECL_ARTIFICIAL (ddecl) = 1; TREE_TYPE (ddecl) = TREE_TYPE (origin); - DECL_MODE (ddecl) = DECL_MODE (origin); + SET_DECL_MODE (ddecl, DECL_MODE (origin)); vec_safe_push (*debug_args, origin); vec_safe_push (*debug_args, ddecl); diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index e350a13dc61..447c9698c15 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * lto.c (offload_handle_link_vars): Use SET_DECL_MODE. + 2016-10-31 Richard Biener PR lto/78129 diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index c1567ca2ca3..a01b4813f36 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -3242,7 +3242,7 @@ offload_handle_link_vars (void) TREE_TYPE (link_ptr_var) = type; TREE_USED (link_ptr_var) = 1; TREE_STATIC (link_ptr_var) = 1; - DECL_MODE (link_ptr_var) = TYPE_MODE (type); + SET_DECL_MODE (link_ptr_var, TYPE_MODE (type)); DECL_SIZE (link_ptr_var) = TYPE_SIZE (type); DECL_SIZE_UNIT (link_ptr_var) = TYPE_SIZE_UNIT (type); DECL_ARTIFICIAL (link_ptr_var) = 1; diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c index 50bce671b99..15f80ab0766 100644 --- a/gcc/omp-simd-clone.c +++ b/gcc/omp-simd-clone.c @@ -868,7 +868,7 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data) stmt = gimple_build_debug_source_bind (vexpr, repl, NULL); DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (repl); - DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (repl)); + SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (repl))); repl = vexpr; } else diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index f904d759e1d..9f8efcb8ab7 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -616,7 +616,7 @@ layout_decl (tree decl, unsigned int known_align) DECL_UNSIGNED (decl) = TYPE_UNSIGNED (type); if (DECL_MODE (decl) == VOIDmode) - DECL_MODE (decl) = TYPE_MODE (type); + SET_DECL_MODE (decl, TYPE_MODE (type)); if (DECL_SIZE (decl) == 0) { @@ -682,7 +682,7 @@ layout_decl (tree decl, unsigned int known_align) && (known_align == 0 || known_align >= xalign)) { SET_DECL_ALIGN (decl, MAX (xalign, DECL_ALIGN (decl))); - DECL_MODE (decl) = xmode; + SET_DECL_MODE (decl, xmode); DECL_BIT_FIELD (decl) = 0; } } @@ -776,7 +776,7 @@ void relayout_decl (tree decl) { DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0; - DECL_MODE (decl) = VOIDmode; + SET_DECL_MODE (decl, VOIDmode); if (!DECL_USER_ALIGN (decl)) SET_DECL_ALIGN (decl, 0); if (DECL_RTL_SET_P (decl)) @@ -1906,7 +1906,7 @@ finish_bitfield_representative (tree repr, tree field) [0, 15] HImode for a and b, [8, 23] HImode for c. */ DECL_SIZE (repr) = bitsize_int (bitsize); DECL_SIZE_UNIT (repr) = size_int (bitsize / BITS_PER_UNIT); - DECL_MODE (repr) = BLKmode; + SET_DECL_MODE (repr, BLKmode); TREE_TYPE (repr) = build_array_type_nelts (unsigned_char_type_node, bitsize / BITS_PER_UNIT); } @@ -1915,7 +1915,7 @@ finish_bitfield_representative (tree repr, tree field) unsigned HOST_WIDE_INT modesize = GET_MODE_BITSIZE (mode); DECL_SIZE (repr) = bitsize_int (modesize); DECL_SIZE_UNIT (repr) = size_int (modesize / BITS_PER_UNIT); - DECL_MODE (repr) = mode; + SET_DECL_MODE (repr, mode); TREE_TYPE (repr) = lang_hooks.types.type_for_mode (mode, 1); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 6899d2a8736..0de0b89dbbf 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -214,7 +214,7 @@ remap_ssa_name (tree name, copy_body_data *id) def_temp = gimple_build_debug_source_bind (vexpr, val, NULL); DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (name); - DECL_MODE (vexpr) = DECL_MODE (SSA_NAME_VAR (name)); + SET_DECL_MODE (vexpr, DECL_MODE (SSA_NAME_VAR (name))); gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT); return vexpr; @@ -6070,7 +6070,7 @@ tree_function_versioning (tree old_decl, tree new_decl, ddecl = make_node (DEBUG_EXPR_DECL); DECL_ARTIFICIAL (ddecl) = 1; TREE_TYPE (ddecl) = TREE_TYPE (parm); - DECL_MODE (ddecl) = DECL_MODE (parm); + SET_DECL_MODE (ddecl, DECL_MODE (parm)); vec_safe_push (*debug_args, DECL_ORIGIN (parm)); vec_safe_push (*debug_args, ddecl); } @@ -6102,7 +6102,7 @@ tree_function_versioning (tree old_decl, tree new_decl, parm = (**debug_args)[i]; DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (parm); - DECL_MODE (vexpr) = DECL_MODE (parm); + SET_DECL_MODE (vexpr, DECL_MODE (parm)); def_temp = gimple_build_debug_bind (var, vexpr, NULL); gsi_insert_before (&cgsi, def_temp, GSI_NEW_STMT); def_temp = gimple_build_debug_source_bind (vexpr, parm, NULL); diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 0e7884519d6..cf9c2a078e0 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -1229,7 +1229,7 @@ rewrite_debug_stmt_uses (gimple *stmt) def_temp = gimple_build_debug_source_bind (def, var, NULL); DECL_ARTIFICIAL (def) = 1; TREE_TYPE (def) = TREE_TYPE (var); - DECL_MODE (def) = DECL_MODE (var); + SET_DECL_MODE (def, DECL_MODE (var)); gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index d4ccd91f851..12dae4a365b 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -5000,7 +5000,7 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec adjustments) NULL); DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (name); - DECL_MODE (vexpr) = DECL_MODE (adj->base); + SET_DECL_MODE (vexpr, DECL_MODE (adj->base)); gsi_insert_before (gsip, def_temp, GSI_SAME_STMT); } if (vexpr) diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 167598f6eec..f89da708f42 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2905,7 +2905,7 @@ optimize_atomic_bit_test_and (gimple_stmt_iterator *gsip, tree temp = make_node (DEBUG_EXPR_DECL); DECL_ARTIFICIAL (temp) = 1; TREE_TYPE (temp) = TREE_TYPE (lhs); - DECL_MODE (temp) = TYPE_MODE (TREE_TYPE (lhs)); + SET_DECL_MODE (temp, TYPE_MODE (TREE_TYPE (lhs))); tree t = build2 (LSHIFT_EXPR, TREE_TYPE (lhs), new_lhs, bit); g = gimple_build_debug_bind (temp, t, g); gsi_insert_after (&gsi, g, GSI_NEW_STMT); diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index f9211ad1ff3..2655c2346cc 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -7589,9 +7589,9 @@ remove_unused_ivs (struct ivopts_data *data) DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (comp); if (SSA_NAME_VAR (def)) - DECL_MODE (vexpr) = DECL_MODE (SSA_NAME_VAR (def)); + SET_DECL_MODE (vexpr, DECL_MODE (SSA_NAME_VAR (def))); else - DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (vexpr)); + SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (vexpr))); gdebug *def_temp = gimple_build_debug_bind (vexpr, comp, NULL); gimple_stmt_iterator gsi; diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 135952bc339..62eea8bb8a4 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -432,9 +432,9 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (value); if (DECL_P (value)) - DECL_MODE (vexpr) = DECL_MODE (value); + SET_DECL_MODE (vexpr, DECL_MODE (value)); else - DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (value)); + SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (value))); if (gsi) gsi_insert_before (gsi, def_temp, GSI_SAME_STMT); diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index e5cc5a05045..3d8a7bb63d9 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -220,7 +220,7 @@ unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) static void unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { - DECL_MODE (expr) = bp_unpack_machine_mode (bp); + SET_DECL_MODE (expr, bp_unpack_machine_mode (bp)); DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); diff --git a/gcc/tree.c b/gcc/tree.c index c155d56d2c5..adf140fe94c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1020,7 +1020,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) if (code == FUNCTION_DECL) { SET_DECL_ALIGN (t, FUNCTION_ALIGNMENT (FUNCTION_BOUNDARY)); - DECL_MODE (t) = FUNCTION_MODE; + SET_DECL_MODE (t, FUNCTION_MODE); } else SET_DECL_ALIGN (t, 1); diff --git a/gcc/tree.h b/gcc/tree.h index 0a82a4aceb8..b0b3f05570c 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2350,6 +2350,8 @@ extern machine_mode element_mode (const_tree t); field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a FIELD_DECL. */ #define DECL_MODE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.mode) +#define SET_DECL_MODE(NODE, MODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.mode = (MODE)) /* For FUNCTION_DECL, if it is built-in, this identifies which built-in operation it is. Note, however, that this field is overloaded, with diff --git a/gcc/varasm.c b/gcc/varasm.c index 1c711b1d8c8..2c238950834 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -7628,7 +7628,7 @@ make_debug_expr_from_rtl (const_rtx exp) TREE_TYPE (ddecl) = type; else TREE_TYPE (ddecl) = lang_hooks.types.type_for_mode (mode, 1); - DECL_MODE (ddecl) = mode; + SET_DECL_MODE (ddecl, mode); dval = gen_rtx_DEBUG_EXPR (mode); DEBUG_EXPR_TREE_DECL (dval) = ddecl; SET_DECL_RTL (ddecl, dval); diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index fd1d85c38a7..95bdc43200c 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,9 @@ +2016-11-18 Richard Sandiford + Alan Hayward + David Sherwood + + * plugin.cc (plugin_build_add_field): Use SET_DECL_MODE. + 2016-06-07 Rainer Orth Update copyrights. diff --git a/libcc1/plugin.cc b/libcc1/plugin.cc index 0ea912f3759..5980b8b1487 100644 --- a/libcc1/plugin.cc +++ b/libcc1/plugin.cc @@ -511,7 +511,7 @@ plugin_build_add_field (cc1_plugin::connection *, = c_build_bitfield_integer_type (bitsize, TYPE_UNSIGNED (field_type)); } - DECL_MODE (decl) = TYPE_MODE (TREE_TYPE (decl)); + SET_DECL_MODE (decl, TYPE_MODE (TREE_TYPE (decl))); // There's no way to recover this from DWARF. SET_DECL_OFFSET_ALIGN (decl, TYPE_PRECISION (pointer_sized_int_node)); -- 2.30.2