From patchwork Fri Feb 8 20:03:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 219288 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 747B82C0089 for ; Sat, 9 Feb 2013 07:03:59 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1360958640; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=c9x+aWy S50vg2aDBsnJCNVpDwdA=; b=L9yFsryuMNzIfVa8PClYG8XFnaJMQKjIqTf7AzG SlINDgxiOuunH40vOOvlYK501gTzuJfFMQ07QnU9KmziCN+nafeEHd6bmswFeOvR qHuxe5+sPbHrB3aSinNzeeufq3XDe1OTxkTOweotkdXb37N5Mt/tEe3ALjeO0uNY xdEU= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=iKGdnUQgufyJXud8XfeSQqVejtdxtfgso66RkYWdMF4hD7tqH2VmyN0R3vqILL XRirLyIaBsPnxZcPpcMyMRAau1WXZuW9pxzCdN3sVc6vaDectVKHxo7auMEv+/Q0 +neYVeET9xHUAWEL3McZOGdd4C3Q2nz6do/V+I1xPIVsA=; Received: (qmail 6235 invoked by alias); 8 Feb 2013 20:03:51 -0000 Received: (qmail 6167 invoked by uid 22791); 8 Feb 2013 20:03:45 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Fri, 08 Feb 2013 20:03:39 +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 (8.14.4/8.14.4) with ESMTP id r18K3cmi022672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 8 Feb 2013 15:03:38 -0500 Received: from stumpy.slc.redhat.com (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r18K3cqw012380 for ; Fri, 8 Feb 2013 15:03:38 -0500 Message-ID: <51155A19.5060007@redhat.com> Date: Fri, 08 Feb 2013 13:03:37 -0700 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: gcc-patches Subject: [PATCH] Improve debugging info (PR debug/53948 P1 regression) 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 Based on feedback from Jakub, I updated the testcase for this PR. Updated patch attached. Installed onto the trunk. Jeff commit 48b3095f4ef7da1a06ad2fa96db3967762ce4f0b Author: Jeff Law Date: Fri Feb 8 09:57:43 2013 -0700 PR debug/53948 * emit-rtl.c (reg_is_parm_p): New function. * regs.h (reg_is_parm_p): New prototype. * ira-conflicts.c (ira_build_conflicts): Allow parameters in callee-clobbered registers. PR debug/53948 * gcc.dg/debug/dwarf2/pr53948.c: New test. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9d66888..2693b7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-02-08 Jeff Law + + PR debug/53948 + * emit-rtl.c (reg_is_parm_p): New function. + * regs.h (reg_is_parm_p): New prototype. + * ira-conflicts.c (ira_build_conflicts): Allow parameters in + callee-clobbered registers. + 2013-02-08 Michael Meissner PR target/56043 diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index f997e5d..2c70fb1 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -919,6 +919,18 @@ gen_reg_rtx (enum machine_mode mode) return val; } +/* Return TRUE if REG is a PARM_DECL, FALSE otherwise. */ + +bool +reg_is_parm_p (rtx reg) +{ + tree decl; + + gcc_assert (REG_P (reg)); + decl = REG_EXPR (reg); + return (decl && TREE_CODE (decl) == PARM_DECL); +} + /* Update NEW with the same attributes as REG, but with OFFSET added to the REG_OFFSET. */ diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c index 711db0f..710986b 100644 --- a/gcc/ira-conflicts.c +++ b/gcc/ira-conflicts.c @@ -895,8 +895,12 @@ ira_build_conflicts (void) if ((! flag_caller_saves && ALLOCNO_CALLS_CROSSED_NUM (a) != 0) /* For debugging purposes don't put user defined variables in - callee-clobbered registers. */ - || (optimize == 0 && REG_USERVAR_P (allocno_reg))) + callee-clobbered registers. However, do allow parameters + in callee-clobbered registers to improve debugging. This + is a bit of a fragile hack. */ + || (optimize == 0 + && REG_USERVAR_P (allocno_reg) + && ! reg_is_parm_p (allocno_reg))) { IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), call_used_reg_set); diff --git a/gcc/regs.h b/gcc/regs.h index 0532d08..090d6b6 100644 --- a/gcc/regs.h +++ b/gcc/regs.h @@ -89,6 +89,8 @@ REG_N_SETS (int regno) #define SET_REG_N_SETS(N,V) (regstat_n_sets_and_refs[N].sets = V) #define INC_REG_N_SETS(N,V) (regstat_n_sets_and_refs[N].sets += V) +/* Given a REG, return TRUE if the reg is a PARM_DECL, FALSE otherwise. */ +extern bool reg_is_parm_p (rtx); /* Functions defined in regstat.c. */ extern void regstat_init_n_sets_and_refs (void); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 583e7d5..83843b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-08 Jeff Law + + PR debug/53948 + * gcc.dg/debug/dwarf2/pr53948.c: New test. + 2013-02-08 Michael Meissner PR target/56043 diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr53948.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr53948.c new file mode 100644 index 0000000..f0600b7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr53948.c @@ -0,0 +1,10 @@ +/* Test that we have line information for the line + with local variable initializations. */ +/* { dg-options "-O0 -g -dA" } */ +/* { dg-final { scan-assembler ".loc 1 8 0|# line 8" } } */ + + +int f (register int a, register int b) { + register int x = b, y = a; + return x + y; } +