From patchwork Mon Jan 10 20:31:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 78214 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 54122B710C for ; Tue, 11 Jan 2011 07:34:56 +1100 (EST) Received: (qmail 20693 invoked by alias); 10 Jan 2011 20:33:08 -0000 Received: (qmail 20596 invoked by uid 22791); 10 Jan 2011 20:33:05 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (140.186.70.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Jan 2011 20:32:59 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcOQC-0007BN-Bl for gcc-patches@gcc.gnu.org; Mon, 10 Jan 2011 15:32:57 -0500 Received: from a.mail.sonic.net ([64.142.16.245]:54821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcOQC-0007B5-3U for gcc-patches@gcc.gnu.org; Mon, 10 Jan 2011 15:32:56 -0500 Received: from are.twiddle.net (are.twiddle.net [75.101.38.216]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id p0AKWtso015871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 10 Jan 2011 12:32:55 -0800 Received: from anchor.twiddle.home (anchor.twiddle.home [172.31.0.4]) by are.twiddle.net (8.14.4/8.14.4) with ESMTP id p0AKWsUN006808; Mon, 10 Jan 2011 12:32:54 -0800 Received: from anchor.twiddle.home (localhost.localdomain [127.0.0.1]) by anchor.twiddle.home (8.14.4/8.14.4) with ESMTP id p0AKWq7C019741; Mon, 10 Jan 2011 12:32:52 -0800 Received: (from rth@localhost) by anchor.twiddle.home (8.14.4/8.14.4/Submit) id p0AKWp16019740; Mon, 10 Jan 2011 12:32:51 -0800 From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: nickc@redhat.com, law@redhat.com, Richard Henderson Subject: [PATCH 23/28] mn10300: Add delegitimize_address hook. Date: Mon, 10 Jan 2011 12:31:52 -0800 Message-Id: <1294691517-19580-24-git-send-email-rth@redhat.com> In-Reply-To: <1294691517-19580-1-git-send-email-rth@redhat.com> References: <1294691517-19580-1-git-send-email-rth@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 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 From: Richard Henderson This suppresses warnings generated by the dwarf2 output routines about uninterpretable addresses. --- gcc/config/mn10300/mn10300.c | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index c56b896..17e58fe 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -2080,6 +2080,66 @@ mn10300_legitimate_constant_p (rtx x) return true; } +/* Undo pic address legitimization for the benefit of debug info. */ + +static rtx +mn10300_delegitimize_address (rtx orig_x) +{ + rtx x = orig_x, ret, addend = NULL; + bool need_mem; + + if (MEM_P (x)) + x = XEXP (x, 0); + if (GET_CODE (x) != PLUS || GET_MODE (x) != Pmode) + return orig_x; + + if (XEXP (x, 0) == pic_offset_table_rtx) + ; + /* With the REG+REG addressing of AM33, var-tracking can re-assemble + some odd-looking "addresses" that were never valid in the first place. + We need to look harder to avoid warnings being emitted. */ + else if (GET_CODE (XEXP (x, 0)) == PLUS) + { + rtx x0 = XEXP (x, 0); + rtx x00 = XEXP (x0, 0); + rtx x01 = XEXP (x0, 1); + + if (x00 == pic_offset_table_rtx) + addend = x01; + else if (x01 == pic_offset_table_rtx) + addend = x00; + else + return orig_x; + + } + else + return orig_x; + x = XEXP (x, 1); + + if (GET_CODE (x) != CONST) + return orig_x; + x = XEXP (x, 0); + if (GET_CODE (x) != UNSPEC) + return orig_x; + + ret = XVECEXP (x, 0, 0); + if (XINT (x, 1) == UNSPEC_GOTOFF) + need_mem = false; + else if (XINT (x, 1) == UNSPEC_GOT) + need_mem = true; + else + return orig_x; + + gcc_assert (GET_CODE (ret) == SYMBOL_REF); + if (need_mem != MEM_P (orig_x)) + return orig_x; + if (need_mem && addend) + return orig_x; + if (addend) + ret = gen_rtx_PLUS (Pmode, addend, ret); + return ret; +} + /* For addresses, costs are relative to "MOV (Rm),Rn". For AM33 this is the 3-byte fully general instruction; for MN103 this is the 2-byte form with an address register. */ @@ -2915,6 +2975,8 @@ mn10300_split_and_operand_count (rtx op) #undef TARGET_LEGITIMATE_ADDRESS_P #define TARGET_LEGITIMATE_ADDRESS_P mn10300_legitimate_address_p +#undef TARGET_DELEGITIMIZE_ADDRESS +#define TARGET_DELEGITIMIZE_ADDRESS mn10300_delegitimize_address #undef TARGET_PREFERRED_RELOAD_CLASS #define TARGET_PREFERRED_RELOAD_CLASS mn10300_preferred_reload_class