From patchwork Wed Mar 16 22:38:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 87312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B9A66B700A for ; Thu, 17 Mar 2011 09:38:42 +1100 (EST) Received: (qmail 2202 invoked by alias); 16 Mar 2011 22:38:36 -0000 Received: (qmail 1949 invoked by uid 22791); 16 Mar 2011 22:38:33 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_BJ, TW_JC X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Mar 2011 22:38:27 +0000 Received: by iwn10 with SMTP id 10so2225675iwn.20 for ; Wed, 16 Mar 2011 15:38:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.145.71 with SMTP id e7mr808919icv.314.1300315105680; Wed, 16 Mar 2011 15:38:25 -0700 (PDT) Received: by 10.43.135.9 with HTTP; Wed, 16 Mar 2011 15:38:25 -0700 (PDT) In-Reply-To: <20110315111908.GW30899@tyan-ft48-01.lab.bos.redhat.com> References: <20110315111908.GW30899@tyan-ft48-01.lab.bos.redhat.com> Date: Wed, 16 Mar 2011 15:38:25 -0700 Message-ID: Subject: Re: [PATCH] Updated DW_OP_GNU_entry_value/DW_TAG_GNU_call_site patch From: "H.J. Lu" To: Jakub Jelinek Cc: Richard Henderson , Cary Coutant , Jason Merrill , gcc-patches@gcc.gnu.org, Roland McGrath X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Tue, Mar 15, 2011 at 4:19 AM, Jakub Jelinek wrote: > Hi! > > Now that we are back in stage 1, I'd like move on with the > entry_value/call_site debug info extensions. > > Here is the http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01793.html > patch updated to current trunk, bootstrapped/regtested on x86_64-linux > and i686-linux.  Ok for trunk? > > 2011-03-15  Jakub Jelinek   > >        * final.c (final_scan_insn): Handle NOTE_INSN_CALL_ARG_LOCATION. >        Call var_location debug hook even on CALL_INSNs. >        (rest_of_clean_state): Don't print NOTE_INSN_CALL_ARG_LOCATION. >        * rtl.def (ENTRY_VALUE): New. >        * dwarf2out.c: Include cfglayout.h. >        (dwarf_stack_op_name, size_of_loc_descr, output_loc_operands, >        output_loc_operands_raw): Handle DW_OP_GNU_entry_value. >        (struct call_arg_loc_node): New type. >        (call_arg_locations, call_arg_loc_last, block_map, call_site_count, >        tail_call_site_count): New variables. >        (dwarf_tag_name): Handle DW_TAG_GNU_call_site and >        DW_TAG_GNU_call_site_parameter. >        (dwarf_attr_name): Handle DW_AT_GNU_call_site_value, >        DW_AT_GNU_call_site_data_value, DW_AT_GNU_call_site_target, >        DW_AT_GNU_call_site_target_clobbered, DW_AT_GNU_tail_call, >        DW_AT_GNU_all_tail_call_sites, DW_AT_GNU_all_call_sites >        and DW_AT_GNU_all_source_call_sites. >        (mem_loc_descriptor): Handle ENTRY_VALUE. >        (add_src_coords_attributes): Don't add enything if >        DECL_SOURCE_LOCATION is UNKNOWN_LOCATION. >        (dwarf2out_abstract_function): Save and clear call_arg_location, >        call_site_count and tail_call_site_count around dwarf2out_decl call. >        (gen_call_site_die): New function. >        (gen_subprogram_die): Emit DW_TAG_GNU_call_site DIEs for call sites. >        (gen_lexical_block_die, gen_inlined_subroutine_die): Update block_map. >        (dwarf2out_function_decl): Clear call_arg_locations, >        call_arg_loc_last, set call_site_count and tail_call_site_count >        to -1 and free block_map. >        (dwarf2out_var_location): Handle NOTE_INSN_CALL_ARG_LOCATION and >        CALL_INSNs.  Add NOTE_DURING_CALL_P var location notes even when not >        followed by any real instructions. >        (dwarf2out_begin_function): Set call_site_count and >        tail_call_site_count to 0. >        (resolve_addr): If DW_AT_abstract_origin of DW_TAG_GNU_call_site >        is dw_val_class_addr, attempt to look it up again, for DECL_EXTERNAL >        attempt to force a DIE for it and worst case remove the attribute. >        (resolve_one_addr): For TREE_CONSTANT_POOL_ADDRESS_P SYMBOL_REFs >        check TREE_ASM_WRITTEN of DECL_INITIAL of the decl instead of >        the decl itself. >        * var-tracking.c: Include tm_p.h. >        (vt_stack_adjustments): For calls call note_register_arguments. >        (argument_reg_set): New variable. >        (add_stores): For MO_VAL_SET of non-tracked regs from argument_reg_set >        ensure the VALUE is resolved. >        (call_arguments): New variable. >        (prepare_call_arguments): New function. >        (add_with_sets): For MO_CALL set u.loc from call_arguments and clear it. >        (struct expand_loc_callback_data): Add ignore_cur_loc field. >        (vt_expand_loc_callback): If ignore_cur_loc, don't look at cur_loc and >        always use the best expression. >        (vt_expand_loc): Add ignore_cur_loc argument. >        (vt_expand_loc_dummy): Clear ignore_cur_loc field. >        (emit_note_insn_var_location): Adjust vt_expand_loc callers. >        (emit_notes_in_bb) : Add NOTE_INSN_CALL_ARG_LOCATION >        note for all calls. >        (vt_add_function_parameter): Use cselib_lookup_from_insn. >        If dv is a VALUE, enter into hash table also ENTRY_VALUE for the >        argument.  Don't call cselib_preserve_only_values and >        cselib_reset_table. >        (note_register_arguments): New function. >        (vt_initialize): Compute argument_reg_set.  Call >        vt_add_function_parameters before processing basic blocks instead of >        afterwards.  For calls call prepare_call_arguments before calling >        cselib_process_insn. >        * print-rtl.c (print_rtx): Handle NOTE_INSN_CALL_ARG_LOCATION. >        * Makefile.in (dwarf2out.o): Depend on $(CFGLAYOUT_H). >        (var-tracking.o): Depend on $(TM_P_H). >        * cfglayout.h (insn_scope): New prototype. >        * gengtype.c (adjust_field_rtx_def): Handle NOTE_INSN_CALL_ARG_LOCATION. >        * cfglayout.c (insn_scope): No longer static. >        * insn-notes.def (CALL_ARG_LOCATION): New. >        * calls.c (expand_call, emit_library_call_value_1): Put USEs for >        MEM arguments into CALL_INSN_FUNCTION_USAGE unconditionally. >        * integrate.c (set_block_origin_self, set_block_abstract_flags): Do >        nothing for DECL_EXTERNAL BLOCK_VARS. > cp/ >        * cp-objcp-common.c (cp_function_decl_explicit_p): Don't crash if >        DECL_LANG_SPECIFIC is NULL. > include/ >        * dwarf2.h (DW_TAG_GNU_call_site, DW_TAG_GNU_call_site_parameter, >        DW_AT_GNU_call_site_value, DW_AT_GNU_call_site_data_value, >        DW_AT_GNU_call_site_target, DW_AT_GNU_call_site_target_clobbered, >        DW_AT_GNU_tail_call, DW_AT_GNU_all_tail_call_sites, >        DW_AT_GNU_all_call_sites,, DW_AT_GNU_all_source_call_sites, >        DW_OP_GNU_entry_value): New. > It caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48160 Here is a patch. OK for trunk? Thanks. diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32 index 764e3de..45db256 100644 --- a/gcc/ChangeLog.x32 +++ b/gcc/ChangeLog.x32 @@ -1,5 +1,9 @@ 2011-03-16 H.J. Lu + * var-tracking.c (prepare_call_arguments): Check SUBREG. + +2011-03-16 H.J. Lu + PR rtl-optimization/48155 * reload1.c (gen_reload): Check if XEXP (in, 0/1) is SUBREG of REG in PLUS. diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 266f11f..cfa74a6 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -5763,7 +5763,11 @@ prepare_call_arguments (basic_block bb, rtx insn) /* Try harder, when passing address of a constant pool integer it can be easily read back. */ - val = CSELIB_VAL_PTR (XEXP (item, 1)); + item = XEXP (item, 1); + if (GET_CODE (item) == SUBREG) + item = SUBREG_REG (item); + gcc_assert (GET_CODE (item) == VALUE); + val = CSELIB_VAL_PTR (item); for (l = val->locs; l; l = l->next) if (GET_CODE (l->loc) == SYMBOL_REF && TREE_CONSTANT_POOL_ADDRESS_P (l->loc)