From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by sourceware.org (Postfix) with ESMTPS id 3FC043858012 for ; Tue, 25 May 2021 06:08:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3FC043858012 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R221e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04394; MF=cooper.qu@linux.alibaba.com; NM=1; PH=DS; RN=2; SR=0; TI=SMTPD_---0Ua2Mpex_1621922925; Received: from L-X0CGLVDL-0840.local(mailfrom:cooper.qu@linux.alibaba.com fp:SMTPD_---0Ua2Mpex_1621922925) by smtp.aliyun-inc.com(127.0.0.1); Tue, 25 May 2021 14:08:45 +0800 Subject: Re: [PATCH 4/4] C-SKY: Separate FRAME_POINTER_REGNUM into FRAME_POINTER_REGNUM and HARD_FRAME_POINTER_REGNUM. To: Geng Qi , gcc-patches@gcc.gnu.org References: <20210524122255.585-1-gengqi@linux.alibaba.com> <20210524122255.585-4-gengqi@linux.alibaba.com> From: Cooper Qu Message-ID: Date: Tue, 25 May 2021 14:08:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210524122255.585-4-gengqi@linux.alibaba.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-20.6 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 May 2021 06:08:53 -0000 These four patches has been merged. On 5/24/21 8:22 PM, Geng Qi wrote: > gcc/ChangeLog: > > * config/csky/csky.h > (FRAME_POINTER_REGNUM): Use HARD_FRAME_POINTER_REGNUM and > FRAME_POINTER_REGNUM instead of the signle definition. The > signle definition may not work well at simplify_subreg_regno(). > (ELIMINABLE_REGS): Add for HARD_FRAME_POINTER_REGNUM. > * config/csky/csky.c (get_csky_live_regs, csky_can_eliminate, > csky_initial_elimination_offset, csky_expand_prologue, > csky_expand_epilogue): Add for HARD_FRAME_POINTER_REGNUM. > --- > gcc/config/csky/csky.c | 15 +++++++++------ > gcc/config/csky/csky.h | 7 +++++-- > 2 files changed, 14 insertions(+), 8 deletions(-) > > diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c > index 1a6cfd7..7f2af82 100644 > --- a/gcc/config/csky/csky.c > +++ b/gcc/config/csky/csky.c > @@ -1751,12 +1751,12 @@ get_csky_live_regs (int *count) > save = true; > > /* Frame pointer marked used. */ > - else if (frame_pointer_needed && reg == FRAME_POINTER_REGNUM) > + else if (frame_pointer_needed && reg == HARD_FRAME_POINTER_REGNUM) > save = true; > > /* This is required for CK801/802 where FP is a fixed reg, otherwise > we end up with no FP value available to the DWARF-2 unwinder. */ > - else if (crtl->calls_eh_return && reg == FRAME_POINTER_REGNUM) > + else if (crtl->calls_eh_return && reg == HARD_FRAME_POINTER_REGNUM) > save = true; > > /* CK801/802 also need special handling for LR because it's clobbered > @@ -1832,6 +1832,8 @@ csky_layout_stack_frame (void) > static bool > csky_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) > { > + if (to == FRAME_POINTER_REGNUM) > + return from != ARG_POINTER_REGNUM; > if (to == STACK_POINTER_REGNUM) > return !frame_pointer_needed; > return true; > @@ -1852,6 +1854,7 @@ csky_initial_elimination_offset (int from, int to) > switch (from) > { > case FRAME_POINTER_REGNUM: > + case HARD_FRAME_POINTER_REGNUM: > offset = cfun->machine->reg_offset; > break; > > @@ -1866,7 +1869,7 @@ csky_initial_elimination_offset (int from, int to) > /* If we are asked for the offset to the frame pointer instead, > then subtract the difference between the frame pointer and stack > pointer. */ > - if (to == FRAME_POINTER_REGNUM) > + if (to == FRAME_POINTER_REGNUM || to == HARD_FRAME_POINTER_REGNUM) > offset -= cfun->machine->reg_offset; > return offset; > } > @@ -5785,7 +5788,7 @@ csky_expand_prologue (void) > of the register save area. */ > if (frame_pointer_needed) > { > - insn = emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx)); > + insn = emit_insn (gen_movsi (hard_frame_pointer_rtx, stack_pointer_rtx)); > RTX_FRAME_RELATED_P (insn) = 1; > } > > @@ -5848,7 +5851,7 @@ csky_expand_epilogue (void) > /* Restore the SP to the base of the register save area. */ > if (frame_pointer_needed) > { > - insn = emit_move_insn (stack_pointer_rtx, frame_pointer_rtx); > + insn = emit_move_insn (stack_pointer_rtx, hard_frame_pointer_rtx); > RTX_FRAME_RELATED_P (insn) = 1; > } > else > @@ -6004,7 +6007,7 @@ csky_set_eh_return_address (rtx source, rtx scratch) > > if (frame_pointer_needed) > { > - basereg = frame_pointer_rtx; > + basereg = hard_frame_pointer_rtx; > delta = 0; > } > else > diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h > index 1fd72d0..f2b0d1c 100644 > --- a/gcc/config/csky/csky.h > +++ b/gcc/config/csky/csky.h > @@ -342,7 +342,8 @@ extern int csky_arch_isa_features[]; > #define STACK_POINTER_REGNUM CSKY_SP_REGNUM > > /* Base register for access to local variables of the function. */ > -#define FRAME_POINTER_REGNUM 8 > +#define FRAME_POINTER_REGNUM 36 > +#define HARD_FRAME_POINTER_REGNUM 8 > > /* Base register for access to arguments of the function. This is a fake > register that is always eliminated. */ > @@ -370,7 +371,9 @@ extern int csky_arch_isa_features[]; > #define ELIMINABLE_REGS \ > {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },\ > { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },\ > - { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }} > + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM },\ > + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },\ > + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} > > /* Define the offset between two registers, one to be eliminated, and the > other its replacement, at the start of a routine. */