From patchwork Wed Jun 1 14:25:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 98195 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 4D552B6F80 for ; Thu, 2 Jun 2011 00:25:55 +1000 (EST) Received: (qmail 31509 invoked by alias); 1 Jun 2011 14:25:50 -0000 Received: (qmail 31489 invoked by uid 22791); 1 Jun 2011 14:25:49 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Jun 2011 14:25:34 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p51EPYQ0001180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Jun 2011 10:25:34 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p51EPXS8029638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Jun 2011 10:25:34 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p51EPXQe016282; Wed, 1 Jun 2011 16:25:33 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p51EPWql016281; Wed, 1 Jun 2011 16:25:32 +0200 Date: Wed, 1 Jun 2011 16:25:32 +0200 From: Jakub Jelinek To: Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] ENTRY_VALUE fixes (PR debug/48203) Message-ID: <20110601142532.GW17079@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20110320125738.GQ30899@tyan-ft48-01.lab.bos.redhat.com> <4D90BE3E.2020203@redhat.com> <20110328173209.GJ18914@tyan-ft48-01.lab.bos.redhat.com> <4D90CA56.6070408@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4D90CA56.6070408@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 Mon, Mar 28, 2011 at 10:50:14AM -0700, Richard Henderson wrote: > > I will look into creating helper inlines to reduce code duplication. > > Please. You can do this as a follow-up if you prefer. Sorry it took so long, here it is. Bootstrapped/regtested on x86_64-linux and i686-linux, makes zero difference on cc1plus nor gcc.dg/guality/*.c generated debug info. Ok for trunk? 2011-06-01 Jakub Jelinek * var-tracking.c (create_entry_value): New function. (vt_add_function_parameter): Use it. Jakub --- gcc/var-tracking.c.jj 2011-06-01 10:20:03.000000000 +0200 +++ gcc/var-tracking.c 2011-06-01 10:51:30.000000000 +0200 @@ -8378,6 +8378,39 @@ vt_get_decl_and_offset (rtx rtl, tree *d return false; } +/* Helper function for vt_add_function_parameter. RTL is + the expression and VAL corresponding cselib_val pointer + for which ENTRY_VALUE should be created. */ + +static void +create_entry_value (rtx rtl, cselib_val *val) +{ + cselib_val *val2; + struct elt_loc_list *el; + el = (struct elt_loc_list *) ggc_alloc_cleared_atomic (sizeof (*el)); + el->next = val->locs; + el->loc = gen_rtx_ENTRY_VALUE (GET_MODE (rtl)); + ENTRY_VALUE_EXP (el->loc) = rtl; + el->setting_insn = get_insns (); + val->locs = el; + val2 = cselib_lookup_from_insn (el->loc, GET_MODE (rtl), true, + VOIDmode, get_insns ()); + if (val2 + && val2 != val + && val2->locs + && rtx_equal_p (val2->locs->loc, el->loc)) + { + struct elt_loc_list *el2; + + preserve_value (val2); + el2 = (struct elt_loc_list *) ggc_alloc_cleared_atomic (sizeof (*el2)); + el2->next = val2->locs; + el2->loc = val->val_rtx; + el2->setting_insn = get_insns (); + val2->locs = el2; + } +} + /* Insert function parameter PARM in IN and OUT sets of ENTRY_BLOCK. */ static void @@ -8501,32 +8534,8 @@ vt_add_function_parameter (tree parm) VAR_INIT_STATUS_INITIALIZED, NULL, INSERT); if (dv_is_value_p (dv)) { - cselib_val *val = CSELIB_VAL_PTR (dv_as_value (dv)), *val2; - struct elt_loc_list *el; - el = (struct elt_loc_list *) - ggc_alloc_cleared_atomic (sizeof (*el)); - el->next = val->locs; - el->loc = gen_rtx_ENTRY_VALUE (GET_MODE (incoming)); - ENTRY_VALUE_EXP (el->loc) = incoming; - el->setting_insn = get_insns (); - val->locs = el; - val2 = cselib_lookup_from_insn (el->loc, GET_MODE (incoming), - true, VOIDmode, get_insns ()); - if (val2 - && val2 != val - && val2->locs - && rtx_equal_p (val2->locs->loc, el->loc)) - { - struct elt_loc_list *el2; - - preserve_value (val2); - el2 = (struct elt_loc_list *) - ggc_alloc_cleared_atomic (sizeof (*el2)); - el2->next = val2->locs; - el2->loc = dv_as_value (dv); - el2->setting_insn = get_insns (); - val2->locs = el2; - } + cselib_val *val = CSELIB_VAL_PTR (dv_as_value (dv)); + create_entry_value (incoming, val); if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (TREE_TYPE (parm)))) { @@ -8538,31 +8547,7 @@ vt_add_function_parameter (tree parm) if (val) { preserve_value (val); - el = (struct elt_loc_list *) - ggc_alloc_cleared_atomic (sizeof (*el)); - el->next = val->locs; - el->loc = gen_rtx_ENTRY_VALUE (indmode); - ENTRY_VALUE_EXP (el->loc) = mem; - el->setting_insn = get_insns (); - val->locs = el; - val2 = cselib_lookup_from_insn (el->loc, GET_MODE (mem), - true, VOIDmode, - get_insns ()); - if (val2 - && val2 != val - && val2->locs - && rtx_equal_p (val2->locs->loc, el->loc)) - { - struct elt_loc_list *el2; - - preserve_value (val2); - el2 = (struct elt_loc_list *) - ggc_alloc_cleared_atomic (sizeof (*el2)); - el2->next = val2->locs; - el2->loc = val->val_rtx; - el2->setting_insn = get_insns (); - val2->locs = el2; - } + create_entry_value (mem, val); } } }