From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53136 invoked by alias); 24 Nov 2015 17:10:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 53104 invoked by uid 89); 24 Nov 2015 17:10:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_20,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 24 Nov 2015 17:10:26 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 07D313CB267; Tue, 24 Nov 2015 17:10:24 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAOHAMlS025278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 24 Nov 2015 12:10:24 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id tAOHALur013494; Tue, 24 Nov 2015 18:10:21 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id tAOHAJTU013493; Tue, 24 Nov 2015 18:10:19 +0100 Date: Tue, 24 Nov 2015 17:22:00 -0000 From: Jakub Jelinek To: Pierre-Marie de Rodat Cc: Jason Merrill , gcc-patches@gcc.gnu.org, Alexandre Oliva Subject: Re: [PATCH, PING*4] Track indirect calls for call site information in debug info. Message-ID: <20151124171019.GR5675@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <55ACED68.5050205@adacore.com> <55B5F472.6040109@adacore.com> <55BF2951.60107@adacore.com> <55C5D19D.8020703@adacore.com> <55E40238.4050401@adacore.com> <565380EE.1070203@redhat.com> <565490CF.9000101@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <565490CF.9000101@adacore.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg02935.txt.bz2 On Tue, Nov 24, 2015 at 05:31:11PM +0100, Pierre-Marie de Rodat wrote: > On 11/23/2015 10:11 PM, Jason Merrill wrote: > >Jakub, since DW_TAG_GNU_call_site is your feature, could you review this? > > As Jeff Law suggested in the “GCC 6 Status Report” thread, I’ve added > Alexandre Oliva to the discussion to review the var-tracking part. > > Also, I’ve rebased+bootstrapped+regtested the patch: the updated version is > attached. > > Thanks in advance for your review! The new pass is IMNSHO completely useless and undesirable, both for compile time (another whole IL traversal) reasons and for the unnecessary creation of memory allocations. final.c already calls dwarf2out_var_location on all calls, so you can do is just add some code there: if (CALL_P (loc_note)) { call_site_count++; if (SIBLING_CALL_P (loc_note)) tail_call_site_count++; + if (optimize == 0 && !flag_var_tracking) + { + ... + } } Detect the case you are interested in (indirect calls), set up a few vars and jump through down to the label creation (and arrange for that case to understand that the current insn is not the note, but the call itself). You'll need a small change on the final.c side, because if (!DECL_IGNORED_P (current_function_decl)) debug_hooks->var_location (insn); is called for calls before output_asm_insn, while you want to call it after them (perhaps even after the unwind emit and final_postscan_insn), so also replace if (rtx_call_insn *call_insn = dyn_cast (insn)) with rtx_call_insn *call_insn = dyn_cast (insn); if (call_insn) and use that condition again for the var_location call. I'd say you can just leave call_arg_loc_note NULL in that case and use for (arg = (ca_loc->call_arg_loc_note ? NOTE_VAR_LOCATION (ca_loc->call_arg_loc_note) : NULL_RTX); arg; arg = next_arg) or so, no need to add any notes. > + /* Emit a not only for calls that have a pattern that is not: s/not/note/, but I hope this code is going away. Jakub