From patchwork Thu Oct 2 19:24:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 396096 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3E84B140180 for ; Fri, 3 Oct 2014 05:25:00 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=U+Po4gy0FJnrri5Nk Ig9JOqUkxhNc+hO9pIIQ9ZJh8PQkiIqW9jAvihDI8xsadSuVP6c0lIoxEN5EBYaN /DdTYz9aH3WtGfB+cqfR65+oO/TgpFLrgR+bxEC+au+y8OTM40laploiqcipNDNQ Mpp8cESQUsKLG2aAPwi/sioS7A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=6ACVzC5kIguYxUkx9RVoj93 +LJ8=; b=QOZIUhFYp2feOvwbc2sYU3F2dGMm7f1kYIHJaTkacDe6iDz119oobI/ S4INNjklTaV9hzxPAcM4mO5swygRMLkgknGo1uIl0oeFb/xN2IOXxbhJWIO7DI3A PypDdJQf15CFcfEEUUSNXemtMyye0ORRanmto3bZncdQMrsow13A= Received: (qmail 13355 invoked by alias); 2 Oct 2014 19:24:54 -0000 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 Received: (qmail 13346 invoked by uid 89); 2 Oct 2014 19:24:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_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; Thu, 02 Oct 2014 19:24:53 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s92JOp78008774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 2 Oct 2014 15:24:51 -0400 Received: from reynosa.quesejoda.com (vpn-62-137.rdu2.redhat.com [10.10.62.137]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s92JOnIZ023905; Thu, 2 Oct 2014 15:24:50 -0400 Message-ID: <542DA680.6010606@redhat.com> Date: Thu, 02 Oct 2014 12:24:48 -0700 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Jason Merrill , gcc-patches Subject: Re: [debug-early] do not add location info/etc to abstract instances References: <542AF9CF.2070208@redhat.com> <542D74FB.4080501@redhat.com> In-Reply-To: <542D74FB.4080501@redhat.com> On 10/02/14 08:53, Jason Merrill wrote: > On 09/30/2014 02:43 PM, Aldy Hernandez wrote: >> + if (parm_die >> + /* Make sure the function to which this parameter belongs to is >> + not an abstract instance. If it is, we can't reuse anything. >> + We must create a new DW_TAG_formal_parameter with a >> + corresponding DW_AT_abstract_origin. */ >> + && !get_AT (context_die, DW_AT_abstract_origin)) > > Can we use the same test here that we do later in this function, namely > origin && origin != node? Actually yes. But I think you mean "!origin", for the parm_die==true case anyhow. So something like the following (as in the attached patch): /* If we have a previously generated DIE, use it, unless this is an abstract instance (origin != NULL), in which case we need a new DIE with a corresponding DW_AT_abstract_origin. */ bool reusing_die; if (parm_die && origin == NULL) reusing_die = true; else { parm_die = new_die (DW_TAG_formal_parameter, context_die, node); reusing_die = false; } > >> - if (origin != NULL && origin != decl) >> + if (origin != NULL && (origin != decl || old_die)) > > Don't we want to go back to "if (origin != NULL)" here too? Sure. If you are ok with this incremental patch, I will push it to the branch. Thanks for your comments. Aldy commit 96593217826a123b907c600c205fd46b012c77e4 Author: Aldy Hernandez Date: Thu Oct 2 12:21:12 2014 -0700 * dwarf2out.c (gen_formal_parameter_die): Simplify check for abstract instance. (gen_subprogram_die): Same. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6830abd..16998c5 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17786,13 +17786,11 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, } } + /* If we have a previously generated DIE, use it, unless this is an + abstract instance (origin != NULL), in which case we need a new + DIE with a corresponding DW_AT_abstract_origin. */ bool reusing_die; - if (parm_die - /* Make sure the function to which this parameter belongs to is - not an abstract instance. If it is, we can't reuse anything. - We must create a new DW_TAG_formal_parameter with a - corresponding DW_AT_abstract_origin. */ - && !get_AT (context_die, DW_AT_abstract_origin)) + if (parm_die && origin == NULL) reusing_die = true; else { @@ -18349,7 +18347,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) && debug_info_level > DINFO_LEVEL_TERSE) old_die = force_decl_die (decl); - if (origin != NULL && (origin != decl || old_die)) + if (origin != NULL) { gcc_assert (!declaration || local_scope_p (context_die));