From patchwork Tue Jul 22 14:52:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiong Wang X-Patchwork-Id: 372504 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1655F1400B9 for ; Wed, 23 Jul 2014 00:54:30 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=FBZPjPwZWiURNFBGOSZxIF5ujNesK5ya4SOfOAx3vq7F39 U7j38Po7zPWJYYuGswQxR3GWQKW4YrwJxjor001STYdtZrWHgBbBVj8+EC5FC8/+ OoWBjIyiXgOJdUhzjlu+ra9LPv3IXXklEIh+CAqElhUhJfIOkoo1qAXthA5OM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=kewjWphTXTg3vMc9YDg0bmAAeis=; b=Lnqfmi5WIVvQ0lAuF0Du 7DacxKgmkz/sWSrTQGvs+FbnjiHGfaQYO8AGyTeM1uZTCdj1eR5JdOo1r54YcCzy C301warcclh/z5wCdZ3TAr49s1FbjXPDu7A1Na95tUBFljEclbo69aacMAYNk9Rc o3fyRXiGZ8hhSeKwHwvGS68= Received: (qmail 32555 invoked by alias); 22 Jul 2014 14:52:14 -0000 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 Received: (qmail 32443 invoked by uid 89); 22 Jul 2014 14:52:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Jul 2014 14:52:11 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 22 Jul 2014 15:52:09 +0100 Received: from [10.1.205.157] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 22 Jul 2014 15:52:08 +0100 Message-ID: <53CE7A98.8020102@arm.com> Date: Tue, 22 Jul 2014 15:52:08 +0100 From: Jiong Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: [AArch64/GCC][16/N] New parameter 'skip_wb' for 'aarch64_save/restore_callee_save_common' X-MC-Unique: 114072215520903901 X-IsSubscribed: yes the common reg save/restore function should skip those write-back candidate reg if 'skip_wb' be true. *no functional change* ok to install? thanks. gcc/ * config/aarch64/aarch64.c (aarch64_save_callee_save_common): New parameter "skip_wb". (aarch64_restore_callee_save_common): Likewise. (aarch64_expand_prologue): Update call site. (aarch64_expand_epilogue): Likewise. >From a85dde9bd3a0dab1d1c2ddf82b134137fb1cab80 Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Tue, 17 Jun 2014 22:23:12 +0100 Subject: [PATCH 16/19] [AArch64/GCC][17/20] New parameter 'skip_wb' for 'aarch64_save/restore_callee_save_common' the common reg save/restore function should skip those write-back candidate reg if 'skip_wb' be true. *no functional change* 2014-06-16 Jiong Wang Marcus Shawcroft gcc/ * config/aarch64/aarch64.c (aarch64_save_callee_save_common): New parameter "skip_wb". (aarch64_restore_callee_save_common): Likewise. (aarch64_expand_prologue): Update call site. (aarch64_expand_epilogue): Likewise. --- gcc/config/aarch64/aarch64.c | 47 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index a6b253a..26d5fba 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2039,7 +2039,7 @@ aarch64_gen_load_pair (enum machine_mode mode, rtx reg1, rtx mem1, rtx reg2, static void aarch64_save_callee_saves (enum machine_mode mode, HOST_WIDE_INT start_offset, - unsigned start, unsigned limit) + unsigned start, unsigned limit, bool skip_wb) { rtx insn; rtx (*gen_mem_ref) (enum machine_mode, rtx) = (frame_pointer_needed @@ -2051,11 +2051,16 @@ aarch64_save_callee_saves (enum machine_mode mode, HOST_WIDE_INT start_offset, regno <= limit; regno = aarch64_next_callee_save (regno + 1, limit)) { - rtx reg = gen_rtx_REG (mode, regno); - rtx mem; + rtx reg, mem; + HOST_WIDE_INT offset; - HOST_WIDE_INT offset = start_offset - + cfun->machine->frame.reg_offset[regno]; + if (skip_wb + && (regno == cfun->machine->frame.wb_candidate1 + || regno == cfun->machine->frame.wb_candidate2)) + continue; + + reg = gen_rtx_REG (mode, regno); + offset = start_offset + cfun->machine->frame.reg_offset[regno]; mem = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx, offset)); @@ -2092,7 +2097,7 @@ aarch64_save_callee_saves (enum machine_mode mode, HOST_WIDE_INT start_offset, static void aarch64_restore_callee_saves (enum machine_mode mode, HOST_WIDE_INT start_offset, unsigned start, - unsigned limit) + unsigned limit, bool skip_wb) { rtx insn; rtx base_rtx = stack_pointer_rtx; @@ -2106,9 +2111,14 @@ aarch64_restore_callee_saves (enum machine_mode mode, regno <= limit; regno = aarch64_next_callee_save (regno + 1, limit)) { - rtx reg = gen_rtx_REG (mode, regno); - rtx mem; + rtx reg, mem; + if (skip_wb + && (regno == cfun->machine->frame.wb_candidate1 + || regno == cfun->machine->frame.wb_candidate2)) + continue; + + reg = gen_rtx_REG (mode, regno); offset = start_offset + cfun->machine->frame.reg_offset[regno]; mem = gen_mem_ref (mode, plus_constant (Pmode, base_rtx, offset)); @@ -2264,6 +2274,8 @@ aarch64_expand_prologue (void) if (offset > 0) { + bool skip_wb = false; + /* Save the frame pointer and lr if the frame pointer is needed first. Make the frame pointer point to the location of the old frame pointer on the stack. */ @@ -2281,7 +2293,7 @@ aarch64_expand_prologue (void) GEN_INT (offset)))); aarch64_save_callee_saves (DImode, fp_offset, R29_REGNUM, - R30_REGNUM); + R30_REGNUM, skip_wb); } else aarch64_pushwb_pair_reg (DImode, R29_REGNUM, R30_REGNUM, offset); @@ -2300,7 +2312,8 @@ aarch64_expand_prologue (void) insn = emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx)); - aarch64_save_callee_saves (DImode, fp_offset, R0_REGNUM, R28_REGNUM); + aarch64_save_callee_saves (DImode, fp_offset, R0_REGNUM, R28_REGNUM, + skip_wb); } else { @@ -2308,10 +2321,12 @@ aarch64_expand_prologue (void) GEN_INT (-offset))); RTX_FRAME_RELATED_P (insn) = 1; - aarch64_save_callee_saves (DImode, fp_offset, R0_REGNUM, R30_REGNUM); + aarch64_save_callee_saves (DImode, fp_offset, R0_REGNUM, R30_REGNUM, + skip_wb); } - aarch64_save_callee_saves (DFmode, fp_offset, V0_REGNUM, V31_REGNUM); + aarch64_save_callee_saves (DFmode, fp_offset, V0_REGNUM, V31_REGNUM, + skip_wb); } /* when offset >= 512, @@ -2336,6 +2351,7 @@ aarch64_expand_epilogue (bool for_sibcall) HOST_WIDE_INT fp_offset; rtx insn; rtx cfa_reg; + bool skip_wb = false; aarch64_layout_frame (); @@ -2384,20 +2400,21 @@ aarch64_expand_epilogue (bool for_sibcall) } aarch64_restore_callee_saves (DFmode, frame_pointer_needed ? 0 : fp_offset, - V0_REGNUM, V31_REGNUM); + V0_REGNUM, V31_REGNUM, skip_wb); if (offset > 0) { if (frame_pointer_needed) { - aarch64_restore_callee_saves (DImode, 0, R0_REGNUM, R28_REGNUM); + aarch64_restore_callee_saves (DImode, 0, R0_REGNUM, R28_REGNUM, + skip_wb); aarch64_popwb_pair_reg (DImode, R29_REGNUM, R30_REGNUM, offset, cfa_reg); } else { aarch64_restore_callee_saves (DImode, fp_offset, R0_REGNUM, - R30_REGNUM); + R30_REGNUM, skip_wb); insn = emit_insn (gen_add2_insn (stack_pointer_rtx, GEN_INT (offset))); RTX_FRAME_RELATED_P (insn) = 1; -- 1.7.9.5