From patchwork Thu Jun 24 00:58:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaz Kojima X-Patchwork-Id: 56736 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 AF9B2B6F15 for ; Thu, 24 Jun 2010 10:58:46 +1000 (EST) Received: (qmail 8841 invoked by alias); 24 Jun 2010 00:58:45 -0000 Received: (qmail 8831 invoked by uid 22791); 24 Jun 2010 00:58:43 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_05, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_PN, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mo11.iij4u.or.jp (HELO mo.iij4u.or.jp) (210.138.174.79) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jun 2010 00:58:39 +0000 Received: by mo.iij4u.or.jp (mo11) id o5O0waIe017120; Thu, 24 Jun 2010 09:58:36 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox10) id o5O0wa8t019725; Thu, 24 Jun 2010 09:58:36 +0900 Date: Thu, 24 Jun 2010 09:58:35 +0900 (JST) Message-Id: <20100624.095835.253686260.kkojima@rr.iij4u.or.jp> To: gcc-patches@gcc.gnu.org Subject: [patch RFA] Fix bootstrap on SH From: Kaz Kojima Mime-Version: 1.0 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 Hi, Currently SH fails to bootstrap on trunk for 'set but not used' warnings: ../trunk/gcc/mode-switching.c: In function 'optimize_mode_switching': ../trunk/gcc/mode-switching.c:448:8: error: variable 'emited' set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors Looking at mode-switching.c:optimize_mode_switching, the variable 'emited' is unused when MODE_ENTRY and MODE_EXIT macros are defined and it's the case for SH. The attached patch silences the above warning and other 'set but not used' warnings coming from config/sh/sh.*. The patch is tested on i686-pc-linux-gnu and sh4-unknown-linux-gnu with bootstrap and the top level 'make -k check' with no new failures. OK for trunk? Regards, kaz --- 2010-06-24 Kaz Kojima * mode-switching.c (optimize_mode_switching): Add ATTRIBUTE_UNUSED to variable emited. * config/sh/sh.c (sh_expand_epilogue): Remove unused variable. * config/sh/sh.md (symGOT_load): Likewise. (symDTPOFF2reg): Likewise. (symTPOFF2reg): Likewise. diff -uprN ORIG/trunk/gcc/mode-switching.c trunk/gcc/mode-switching.c --- ORIG/trunk/gcc/mode-switching.c 2010-06-03 10:31:13.000000000 +0900 +++ trunk/gcc/mode-switching.c 2010-06-23 09:58:45.000000000 +0900 @@ -1,6 +1,6 @@ /* CPU mode switching Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, - 2009 Free Software Foundation, Inc. + 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -445,7 +445,7 @@ optimize_mode_switching (void) int i, j; int n_entities; int max_num_modes = 0; - bool emited = false; + bool emited ATTRIBUTE_UNUSED = false; basic_block post_entry ATTRIBUTE_UNUSED, pre_exit ATTRIBUTE_UNUSED; for (e = N_ENTITIES - 1, n_entities = 0; e >= 0; e--) diff -uprN ORIG/trunk/gcc/config/sh/sh.c trunk/gcc/config/sh/sh.c --- ORIG/trunk/gcc/config/sh/sh.c 2010-06-19 20:50:04.000000000 +0900 +++ trunk/gcc/config/sh/sh.c 2010-06-23 10:00:54.000000000 +0900 @@ -6860,13 +6860,12 @@ sh_expand_prologue (void) for (i = 0; i < NPARM_REGS(SImode); i++) { int rn = NPARM_REGS(SImode) + FIRST_PARM_REG - i - 1; - rtx insn; if (i >= (NPARM_REGS(SImode) - crtl->args.info.arg_count[(int) SH_ARG_INT] )) break; - insn = push (rn); + push (rn); } } } @@ -7231,7 +7230,7 @@ sh_expand_epilogue (bool sibcall_p) { enum machine_mode mode = (enum machine_mode) entry->mode; int reg = entry->reg; - rtx reg_rtx, mem_rtx, post_inc = NULL_RTX, insn; + rtx reg_rtx, mem_rtx, post_inc = NULL_RTX; offset = offset_base + entry->offset; reg_rtx = gen_rtx_REG (mode, reg); @@ -7304,7 +7303,7 @@ sh_expand_epilogue (bool sibcall_p) if ((reg == PR_REG || SPECIAL_REGISTER_P (reg)) && mem_rtx != post_inc) { - insn = emit_move_insn (r0, mem_rtx); + emit_move_insn (r0, mem_rtx); mem_rtx = r0; } else if (TARGET_REGISTER_P (reg)) @@ -7313,13 +7312,13 @@ sh_expand_epilogue (bool sibcall_p) /* Give the scheduler a bit of freedom by using up to MAX_TEMPS registers in a round-robin fashion. */ - insn = emit_move_insn (tmp_reg, mem_rtx); + emit_move_insn (tmp_reg, mem_rtx); mem_rtx = tmp_reg; if (*++tmp_pnt < 0) tmp_pnt = schedule.temps; } - insn = emit_move_insn (reg_rtx, mem_rtx); + emit_move_insn (reg_rtx, mem_rtx); } gcc_assert (entry->offset + offset_base == d + d_rounding); diff -uprN ORIG/trunk/gcc/config/sh/sh.md trunk/gcc/config/sh/sh.md --- ORIG/trunk/gcc/config/sh/sh.md 2010-04-16 13:08:09.000000000 +0900 +++ trunk/gcc/config/sh/sh.md 2010-06-22 06:34:55.000000000 +0900 @@ -8469,7 +8469,7 @@ label: "" " { - rtx insn, mem; + rtx mem; operands[2] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode); operands[3] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode); @@ -8518,7 +8518,7 @@ label: mem = gen_rtx_MEM (Pmode, operands[3]); MEM_NOTRAP_P (mem) = 1; /* ??? Should we have a special alias set for the GOT? */ - insn = emit_move_insn (operands[0], mem); + emit_move_insn (operands[0], mem); DONE; }") @@ -8685,7 +8685,7 @@ mov.l\\t1f,r4\\n\\ "" " { - rtx dtpoffsym, insn; + rtx dtpoffsym; rtx t = (!can_create_pseudo_p () ? operands[0] : gen_reg_rtx (GET_MODE (operands[0]))); @@ -8693,8 +8693,7 @@ mov.l\\t1f,r4\\n\\ dtpoffsym = gen_sym2DTPOFF (operands[1]); PUT_MODE (dtpoffsym, Pmode); emit_move_insn (t, dtpoffsym); - insn = emit_move_insn (operands[0], - gen_rtx_PLUS (Pmode, t, operands[2])); + emit_move_insn (operands[0], gen_rtx_PLUS (Pmode, t, operands[2])); DONE; }") @@ -8736,11 +8735,11 @@ mov.l\\t1f,r0\\n\\ "" " { - rtx tpoffsym, insn; + rtx tpoffsym; tpoffsym = gen_sym2TPOFF (operands[1]); PUT_MODE (tpoffsym, Pmode); - insn = emit_move_insn (operands[0], tpoffsym); + emit_move_insn (operands[0], tpoffsym); DONE; }")