From 5338c10b9580a8666a38fde006a9e9b9fadc4868 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Thu, 28 Aug 2014 06:23:09 +0000 Subject: [PATCH] gcc/ * dwarf2out.c (resolve_one_addr): Remove unused data parameter. Return a bool, inverting the result so that 0/false means "not ok". Use FOR_EACH_SUBRTX_PTR instead of for_each_rtx to iterate over subrtxes of a CONST. (mem_loc_descriptor, add_const_value_attribute) (resolve_addr_in_expr): Update calls accordingly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214637 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/dwarf2out.c | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01a7915..cd9fb2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2014-08-28 Richard Sandiford + * dwarf2out.c (resolve_one_addr): Remove unused data parameter. + Return a bool, inverting the result so that 0/false means "not ok". + Use FOR_EACH_SUBRTX_PTR instead of for_each_rtx to iterate over + subrtxes of a CONST. + (mem_loc_descriptor, add_const_value_attribute) + (resolve_addr_in_expr): Update calls accordingly. + +2014-08-28 Richard Sandiford + * dwarf2out.c: Include rtl-iter.h. (const_ok_for_output_1): Take the rtx instead of a pointer to it. Remove unused data parameter. Return a bool, inverting the result diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6e040f5..39b28a9 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3158,7 +3158,7 @@ static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx, static dw_loc_descr_ref based_loc_descr (rtx, HOST_WIDE_INT, enum var_init_status); static int is_based_loc (const_rtx); -static int resolve_one_addr (rtx *, void *); +static bool resolve_one_addr (rtx *); static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx, enum var_init_status); static dw_loc_descr_ref loc_descriptor (rtx, enum machine_mode mode, @@ -13220,7 +13220,7 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode, break; case CONST_STRING: - resolve_one_addr (&rtl, NULL); + resolve_one_addr (&rtl); goto symref; default: @@ -15275,7 +15275,7 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) if (dwarf_version >= 4 || !dwarf_strict) { dw_loc_descr_ref loc_result; - resolve_one_addr (&rtl, NULL); + resolve_one_addr (&rtl); rtl_addr: loc_result = new_addr_loc_descr (rtl, dtprel_false); add_loc_descr (&loc_result, new_loc_descr (DW_OP_stack_value, 0, 0)); @@ -23111,11 +23111,11 @@ move_marked_base_types (void) } /* Helper function for resolve_addr, attempt to resolve - one CONST_STRING, return non-zero if not successful. Similarly verify that + one CONST_STRING, return true if successful. Similarly verify that SYMBOL_REFs refer to variables emitted in the current CU. */ -static int -resolve_one_addr (rtx *addr, void *data ATTRIBUTE_UNUSED) +static bool +resolve_one_addr (rtx *addr) { rtx rtl = *addr; @@ -23128,15 +23128,15 @@ resolve_one_addr (rtx *addr, void *data ATTRIBUTE_UNUSED) = build_array_type (char_type_node, build_index_type (tlen)); rtl = lookup_constant_def (t); if (!rtl || !MEM_P (rtl)) - return 1; + return false; rtl = XEXP (rtl, 0); if (GET_CODE (rtl) == SYMBOL_REF && SYMBOL_REF_DECL (rtl) && !TREE_ASM_WRITTEN (SYMBOL_REF_DECL (rtl))) - return 1; + return false; vec_safe_push (used_rtx_array, rtl); *addr = rtl; - return 0; + return true; } if (GET_CODE (rtl) == SYMBOL_REF @@ -23145,17 +23145,21 @@ resolve_one_addr (rtx *addr, void *data ATTRIBUTE_UNUSED) if (TREE_CONSTANT_POOL_ADDRESS_P (rtl)) { if (!TREE_ASM_WRITTEN (DECL_INITIAL (SYMBOL_REF_DECL (rtl)))) - return 1; + return false; } else if (!TREE_ASM_WRITTEN (SYMBOL_REF_DECL (rtl))) - return 1; + return false; } - if (GET_CODE (rtl) == CONST - && for_each_rtx (&XEXP (rtl, 0), resolve_one_addr, NULL)) - return 1; + if (GET_CODE (rtl) == CONST) + { + subrtx_ptr_iterator::array_type array; + FOR_EACH_SUBRTX_PTR (iter, array, &XEXP (rtl, 0), ALL) + if (!resolve_one_addr (*iter)) + return false; + } - return 0; + return true; } /* For STRING_CST, return SYMBOL_REF of its constant pool entry, @@ -23267,7 +23271,7 @@ resolve_addr_in_expr (dw_loc_descr_ref loc) switch (loc->dw_loc_opc) { case DW_OP_addr: - if (resolve_one_addr (&loc->dw_loc_oprnd1.v.val_addr, NULL)) + if (!resolve_one_addr (&loc->dw_loc_oprnd1.v.val_addr)) { if ((prev == NULL || prev->dw_loc_opc == DW_OP_piece @@ -23286,7 +23290,7 @@ resolve_addr_in_expr (dw_loc_descr_ref loc) || (loc->dw_loc_opc == DW_OP_GNU_const_index && loc->dtprel)) { rtx rtl = loc->dw_loc_oprnd1.val_entry->addr.rtl; - if (resolve_one_addr (&rtl, NULL)) + if (!resolve_one_addr (&rtl)) return false; remove_addr_table_entry (loc->dw_loc_oprnd1.val_entry); loc->dw_loc_oprnd1.val_entry = @@ -23296,7 +23300,7 @@ resolve_addr_in_expr (dw_loc_descr_ref loc) case DW_OP_const4u: case DW_OP_const8u: if (loc->dtprel - && resolve_one_addr (&loc->dw_loc_oprnd1.v.val_addr, NULL)) + && !resolve_one_addr (&loc->dw_loc_oprnd1.v.val_addr)) return false; break; case DW_OP_plus_uconst: @@ -23314,7 +23318,7 @@ resolve_addr_in_expr (dw_loc_descr_ref loc) break; case DW_OP_implicit_value: if (loc->dw_loc_oprnd2.val_class == dw_val_class_addr - && resolve_one_addr (&loc->dw_loc_oprnd2.v.val_addr, NULL)) + && !resolve_one_addr (&loc->dw_loc_oprnd2.v.val_addr)) return false; break; case DW_OP_GNU_implicit_pointer: @@ -23571,7 +23575,7 @@ resolve_addr (dw_die_ref die) break; case dw_val_class_addr: if (a->dw_attr == DW_AT_const_value - && resolve_one_addr (&a->dw_attr_val.v.val_addr, NULL)) + && !resolve_one_addr (&a->dw_attr_val.v.val_addr)) { if (AT_index (a) != NOT_INDEXED) remove_addr_table_entry (a->dw_attr_val.val_entry); -- 2.7.4