From patchwork Thu Sep 27 22:56:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 187518 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 10A632C00B5 for ; Fri, 28 Sep 2012 08:57:16 +1000 (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=1349391437; 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=JGTvRjw PP4DsmQbYDp9+9O0K6ts=; b=yagH8qa+rgogen2R8i6C7pzqOLpaosOz53KWVLX 5W3mu4bQ+p4o1BKCTSevVKnhScTIALjS0Nw+nbRupiUSq2SoLxSFklgASPiLC1jQ +9DxfoSsWtkjEScf92JCLgSerolNedVH0zAHh09FACoXb1XDcVYtTiWBMmfbdiGg u8Pc= 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=ScwuzcB4Y3ZNOt9K7JPxRzWGvvhVnSN3liUQse7NKbO9p4U+802rMfuucAbOdD 9UOlACrLwo5+iQwPDmFGzXcN7wEYkauBYteNAHeL3Pm5TeQAQ6v9XVp2v5Yj8xJb 0RX7UA9MN3sUVY3Q7iH1IvodluOdqsWrj3ANkvcn88KFI=; Received: (qmail 13501 invoked by alias); 27 Sep 2012 22:57:10 -0000 Received: (qmail 13488 invoked by uid 22791); 27 Sep 2012 22:57:07 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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; Thu, 27 Sep 2012 22:56:57 +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 q8RMuuhQ031654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Sep 2012 18:56:57 -0400 Received: from ivy.local (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8RMuutA018313 for ; Thu, 27 Sep 2012 18:56:56 -0400 Message-ID: <5064D9B8.4070401@redhat.com> Date: Thu, 27 Sep 2012 18:56:56 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: GCC Patches Subject: RFC: LRA for x86/x86-64 [1/9] 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 The following patch adds a new argument for function alter_subreg. LRA will sometime call alter_subreg with different argument value. 2012-09-27 Vladimir Makarov * output.h (alter_subreg): Add new argument. * dbxout.c (dbxout_symbol_location): Pass new argument to alter_subreg. * sdbout.c (sdbout_symbol): Pass new argument to alter_subreg. * final.c (final_scan_insn, cleanup_subreg_operands): Pass new argument to alter_subreg. (walk_alter_subreg, output_operand): Ditto. (alter_subreg): Add new argument. * config/m32r/m32r.c (gen_split_move_double): Pass new argument to alter_subreg. * config/sh/sh.md: Ditto. * config/xtensa/xtensa.c (fixup_subreg_mem): Ditto. * config/m68k/m68k.c (emit_move_sequence): Ditto. * config/arm/arm.c (load_multiple_sequence): Ditto. (store_multiple_sequence): Ditto. * config/pa/pa.c (pa_emit_move_sequence): Ditto. * config/v850/v850.c (v850_reorg): Ditto. Index: dbxout.c =================================================================== --- dbxout.c (revision 191771) +++ dbxout.c (working copy) @@ -2994,7 +2994,7 @@ dbxout_symbol_location (tree decl, tree if (REGNO (value) >= FIRST_PSEUDO_REGISTER) return 0; } - home = alter_subreg (&home); + home = alter_subreg (&home, true); } if (REG_P (home)) { Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 191771) +++ config/pa/pa.c (working copy) @@ -1616,7 +1616,7 @@ pa_emit_move_sequence (rtx *operands, en rtx temp = gen_rtx_SUBREG (GET_MODE (operand0), reg_equiv_mem (REGNO (SUBREG_REG (operand0))), SUBREG_BYTE (operand0)); - operand0 = alter_subreg (&temp); + operand0 = alter_subreg (&temp, true); } if (scratch_reg @@ -1633,7 +1633,7 @@ pa_emit_move_sequence (rtx *operands, en rtx temp = gen_rtx_SUBREG (GET_MODE (operand1), reg_equiv_mem (REGNO (SUBREG_REG (operand1))), SUBREG_BYTE (operand1)); - operand1 = alter_subreg (&temp); + operand1 = alter_subreg (&temp, true); } if (scratch_reg && reload_in_progress && GET_CODE (operand0) == MEM Index: config/v850/v850.c =================================================================== --- config/v850/v850.c (revision 191771) +++ config/v850/v850.c (working copy) @@ -1301,11 +1301,11 @@ v850_reorg (void) if (GET_CODE (dest) == SUBREG && (GET_CODE (SUBREG_REG (dest)) == MEM || GET_CODE (SUBREG_REG (dest)) == REG)) - alter_subreg (&dest); + alter_subreg (&dest, true); if (GET_CODE (src) == SUBREG && (GET_CODE (SUBREG_REG (src)) == MEM || GET_CODE (SUBREG_REG (src)) == REG)) - alter_subreg (&src); + alter_subreg (&src, true); if (GET_CODE (dest) == MEM && GET_CODE (src) == MEM) mem = NULL_RTX; Index: config/sh/sh.md =================================================================== --- config/sh/sh.md (revision 191771) +++ config/sh/sh.md (working copy) @@ -7275,7 +7275,7 @@ label: rtx regop = operands[store_p], word0 ,word1; if (GET_CODE (regop) == SUBREG) - alter_subreg (®op); + alter_subreg (®op, true); if (REGNO (XEXP (addr, 0)) == REGNO (XEXP (addr, 1))) offset = 2; else @@ -7283,9 +7283,9 @@ label: mem = copy_rtx (mem); PUT_MODE (mem, SImode); word0 = gen_rtx_SUBREG (SImode, regop, 0); - alter_subreg (&word0); + alter_subreg (&word0, true); word1 = gen_rtx_SUBREG (SImode, regop, 4); - alter_subreg (&word1); + alter_subreg (&word1, true); if (store_p || ! refers_to_regno_p (REGNO (word0), REGNO (word0) + 1, addr, 0)) { @@ -7743,7 +7743,7 @@ label: else { x = gen_rtx_SUBREG (V2SFmode, operands[0], i * 8); - alter_subreg (&x); + alter_subreg (&x, true); } if (MEM_P (operands[1])) @@ -7752,7 +7752,7 @@ label: else { y = gen_rtx_SUBREG (V2SFmode, operands[1], i * 8); - alter_subreg (&y); + alter_subreg (&y, true); } emit_insn (gen_movv2sf_i (x, y)); Index: config/xtensa/xtensa.c =================================================================== --- config/xtensa/xtensa.c (revision 191771) +++ config/xtensa/xtensa.c (working copy) @@ -1087,7 +1087,7 @@ fixup_subreg_mem (rtx x) gen_rtx_SUBREG (GET_MODE (x), reg_equiv_mem (REGNO (SUBREG_REG (x))), SUBREG_BYTE (x)); - x = alter_subreg (&temp); + x = alter_subreg (&temp, true); } return x; } Index: config/m68k/m68k.c =================================================================== --- config/m68k/m68k.c (revision 191771) +++ config/m68k/m68k.c (working copy) @@ -3658,7 +3658,7 @@ emit_move_sequence (rtx *operands, enum rtx temp = gen_rtx_SUBREG (GET_MODE (operand0), reg_equiv_mem (REGNO (SUBREG_REG (operand0))), SUBREG_BYTE (operand0)); - operand0 = alter_subreg (&temp); + operand0 = alter_subreg (&temp, true); } if (scratch_reg @@ -3675,7 +3675,7 @@ emit_move_sequence (rtx *operands, enum rtx temp = gen_rtx_SUBREG (GET_MODE (operand1), reg_equiv_mem (REGNO (SUBREG_REG (operand1))), SUBREG_BYTE (operand1)); - operand1 = alter_subreg (&temp); + operand1 = alter_subreg (&temp, true); } if (scratch_reg && reload_in_progress && GET_CODE (operand0) == MEM Index: config/m32r/m32r.c =================================================================== --- config/m32r/m32r.c (revision 191771) +++ config/m32r/m32r.c (working copy) @@ -1030,9 +1030,9 @@ gen_split_move_double (rtx operands[]) subregs to make this code simpler. It is safe to call alter_subreg any time after reload. */ if (GET_CODE (dest) == SUBREG) - alter_subreg (&dest); + alter_subreg (&dest, true); if (GET_CODE (src) == SUBREG) - alter_subreg (&src); + alter_subreg (&src, true); start_sequence (); if (REG_P (dest)) Index: config/arm/arm.c =================================================================== --- config/arm/arm.c (revision 191771) +++ config/arm/arm.c (working copy) @@ -10316,7 +10316,7 @@ load_multiple_sequence (rtx *operands, i /* Convert a subreg of a mem into the mem itself. */ if (GET_CODE (operands[nops + i]) == SUBREG) - operands[nops + i] = alter_subreg (operands + (nops + i)); + operands[nops + i] = alter_subreg (operands + (nops + i), true); gcc_assert (MEM_P (operands[nops + i])); @@ -10468,7 +10468,7 @@ store_multiple_sequence (rtx *operands, /* Convert a subreg of a mem into the mem itself. */ if (GET_CODE (operands[nops + i]) == SUBREG) - operands[nops + i] = alter_subreg (operands + (nops + i)); + operands[nops + i] = alter_subreg (operands + (nops + i), true); gcc_assert (MEM_P (operands[nops + i])); Index: sdbout.c =================================================================== --- sdbout.c (revision 191771) +++ sdbout.c (working copy) @@ -767,7 +767,7 @@ sdbout_symbol (tree decl, int local) if (REGNO (value) >= FIRST_PSEUDO_REGISTER) return; } - regno = REGNO (alter_subreg (&value)); + regno = REGNO (alter_subreg (&value, true)); SET_DECL_RTL (decl, value); } /* Don't output anything if an auto variable Index: final.c =================================================================== --- final.c (revision 191771) +++ final.c (working copy) @@ -2534,7 +2534,7 @@ final_scan_insn (rtx insn, FILE *file, i { rtx src1, src2; if (GET_CODE (SET_SRC (set)) == SUBREG) - SET_SRC (set) = alter_subreg (&SET_SRC (set)); + SET_SRC (set) = alter_subreg (&SET_SRC (set), true); src1 = SET_SRC (set); src2 = NULL_RTX; @@ -2542,10 +2542,10 @@ final_scan_insn (rtx insn, FILE *file, i { if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG) XEXP (SET_SRC (set), 0) - = alter_subreg (&XEXP (SET_SRC (set), 0)); + = alter_subreg (&XEXP (SET_SRC (set), 0), true); if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG) XEXP (SET_SRC (set), 1) - = alter_subreg (&XEXP (SET_SRC (set), 1)); + = alter_subreg (&XEXP (SET_SRC (set), 1), true); if (XEXP (SET_SRC (set), 1) == CONST0_RTX (GET_MODE (XEXP (SET_SRC (set), 0)))) src2 = XEXP (SET_SRC (set), 0); @@ -2948,7 +2948,7 @@ cleanup_subreg_operands (rtx insn) expression directly. */ if (GET_CODE (*recog_data.operand_loc[i]) == SUBREG) { - recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]); + recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i], true); changed = true; } else if (GET_CODE (recog_data.operand[i]) == PLUS @@ -2961,7 +2961,7 @@ cleanup_subreg_operands (rtx insn) { if (GET_CODE (*recog_data.dup_loc[i]) == SUBREG) { - *recog_data.dup_loc[i] = alter_subreg (recog_data.dup_loc[i]); + *recog_data.dup_loc[i] = alter_subreg (recog_data.dup_loc[i], true); changed = true; } else if (GET_CODE (*recog_data.dup_loc[i]) == PLUS @@ -2973,11 +2973,11 @@ cleanup_subreg_operands (rtx insn) df_insn_rescan (insn); } -/* If X is a SUBREG, replace it with a REG or a MEM, - based on the thing it is a subreg of. */ +/* If X is a SUBREG, try to replace it with a REG or a MEM, based on + the thing it is a subreg of. Do it anyway if FINAL_P. */ rtx -alter_subreg (rtx *xp) +alter_subreg (rtx *xp, bool final_p) { rtx x = *xp; rtx y = SUBREG_REG (x); @@ -3001,16 +3001,19 @@ alter_subreg (rtx *xp) offset += difference % UNITS_PER_WORD; } - *xp = adjust_address (y, GET_MODE (x), offset); + if (final_p) + *xp = adjust_address (y, GET_MODE (x), offset); + else + *xp = adjust_address_nv (y, GET_MODE (x), offset); } else { rtx new_rtx = simplify_subreg (GET_MODE (x), y, GET_MODE (y), - SUBREG_BYTE (x)); + SUBREG_BYTE (x)); if (new_rtx != 0) *xp = new_rtx; - else if (REG_P (y)) + else if (final_p && REG_P (y)) { /* Simplify_subreg can't handle some REG cases, but we have to. */ unsigned int regno; @@ -3050,7 +3053,7 @@ walk_alter_subreg (rtx *xp, bool *change case SUBREG: *changed = true; - return alter_subreg (xp); + return alter_subreg (xp, true); default: break; @@ -3656,7 +3659,7 @@ void output_operand (rtx x, int code ATTRIBUTE_UNUSED) { if (x && GET_CODE (x) == SUBREG) - x = alter_subreg (&x); + x = alter_subreg (&x, true); /* X must not be a pseudo reg. */ gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER); Index: output.h =================================================================== --- output.h (revision 191771) +++ output.h (working copy) @@ -76,7 +76,7 @@ extern rtx final_scan_insn (rtx, FILE *, /* Replace a SUBREG with a REG or a MEM, based on the thing it is a subreg of. */ -extern rtx alter_subreg (rtx *); +extern rtx alter_subreg (rtx *, bool); /* Print an operand using machine-dependent assembler syntax. */ extern void output_operand (rtx, int);