From patchwork Tue Dec 4 07:29:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Senthil Kumar Selvaraj X-Patchwork-Id: 203572 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 348E62C008A for ; Tue, 4 Dec 2012 18:31:34 +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=1355211095; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=MYVUdVHO/WTbeycsTUO2oTHmXbg=; b=k3Cx/87DGVDmKPFiIJADKSS+iOddi99JXQO47IjUr3wGvieaIrigKfrlfj5x9A 1BRERjX5EXUHXQb7dXcfnE0+mi+WnHFx/gogVgWEKPxLbai/PDl69+PIR0SfgO8L 4c6CE+jDfdlnmMstEqvt6G5QqX9e5KfYOYKsfruv6B6KE= 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:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=DSoXN52XiWAXvFz5bYnqgrg6/WfT01rDfYYBu87Say0bVyafLHoPvbzVWSb6Tp WzK4AoDg0HupZstMhAV/GtPtv0Il608bkyRyUkozQM371Xv4kwzm41k++d6ElItb sdaRWiaKyn/H9BteFNva7/0XagYZEkC+eX9b5YFE3pIcE=; Received: (qmail 3045 invoked by alias); 4 Dec 2012 07:31:14 -0000 Received: (qmail 3015 invoked by uid 22791); 4 Dec 2012 07:31:10 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, KHOP_SPAMHAUS_DROP, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nasmtp01.atmel.com (HELO DVREDG01.corp.atmel.com) (192.199.1.245) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Dec 2012 07:31:04 +0000 Received: from apsmtp01.atmel.com (10.168.254.31) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server (TLS) id 14.2.318.1; Tue, 4 Dec 2012 00:30:59 -0700 Received: from PENCHT01.corp.atmel.com (10.168.5.161) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server (TLS) id 14.2.318.1; Tue, 4 Dec 2012 15:35:31 +0800 Received: from atmel.com (10.168.5.13) by cas-ap.atmel.com (10.168.5.161) with Microsoft SMTP Server (TLS) id 14.2.318.1; Tue, 4 Dec 2012 15:29:11 +0800 Date: Tue, 4 Dec 2012 12:59:11 +0530 From: Senthil Kumar Selvaraj To: Subject: Emitting correct DWARF location descriptor for multi-reg frame pointer Message-ID: <20121204072906.GA5086@atmel.com> MIME-Version: 1.0 Content-Disposition: inline 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 As a follow-up to this discussion (http://gcc.gnu.org/ml/gcc/2012-11/msg00307.html), I have a patch that makes dwarf2out.c emit correct location information for a FP register spanning multiple hard regs. Before the patch, the DW_AT_location for a local variable on the AVR target (whose FP spans registers R29 and R28) looks like this <4f> DW_AT_location : 2 byte block: 8c 1 (DW_OP_breg28 (r28): 1) After the patch, it looks like this <4f> DW_AT_location : 11 byte block: 6c 93 1 6d 93 1 11 1 22 94 2 (DW_OP_reg28 (r28); DW_OP_piece: 1; DW_OP_reg29 (r29); DW_OP_piece: 1; DW_OP_consts: 1; DW_OP_plus; DW_OP_deref_size: 2) What do you guys think? Regards Senthil diff --git gcc/dwarf2out.c gcc/dwarf2out.c index f0256ae..53a4e56 100644 --- gcc/dwarf2out.c +++ gcc/dwarf2out.c @@ -10875,11 +10875,25 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset, return new_loc_descr (DW_OP_fbreg, offset, 0); } - if (regno <= 31) - result = new_loc_descr ((enum dwarf_location_atom) (DW_OP_breg0 + regno), - offset, 0); + rtx regs = targetm.dwarf_register_span (reg); + + if (hard_regno_nregs[REGNO (reg)][GET_MODE (reg)] > 1 || regs) + { + result = multiple_reg_loc_descriptor (reg, regs, initialized); + add_loc_descr (&result, new_loc_descr (DW_OP_consts, offset, 0)); + add_loc_descr (&result, new_loc_descr (DW_OP_plus, 0, 0)); + add_loc_descr (&result, new_loc_descr (DW_OP_deref_size, + GET_MODE_SIZE (GET_MODE (reg)), + 0)); + } else - result = new_loc_descr (DW_OP_bregx, regno, offset); + { + if (regno <= 31) + result = new_loc_descr ((enum dwarf_location_atom) (DW_OP_breg0 + regno), + offset, 0); + else + result = new_loc_descr (DW_OP_bregx, regno, offset); + } if (initialized == VAR_INIT_STATUS_UNINITIALIZED) add_loc_descr (&result, new_loc_descr (DW_OP_GNU_uninit, 0, 0));