public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: qu <xianmiao@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1027] C-SKY: Separate FRAME_POINTER_REGNUM into FRAME_POINTER_REGNUM and HARD_FRAME_POINTER_REGNUM. Date: Tue, 25 May 2021 06:07:52 +0000 (GMT) [thread overview] Message-ID: <20210525060752.3E3343858012@sourceware.org> (raw) https://gcc.gnu.org/g:d19a00c60c15c253282f72299315261ecaa9c92f commit r12-1027-gd19a00c60c15c253282f72299315261ecaa9c92f Author: Geng Qi <gengqi@linux.alibaba.com> Date: Mon May 24 20:22:55 2021 +0800 C-SKY: Separate FRAME_POINTER_REGNUM into FRAME_POINTER_REGNUM and HARD_FRAME_POINTER_REGNUM. 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(). (HARD_FRAME_POINTER_REGNUM): New. (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. Diff: --- 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 1a6cfd70ef7..7f2af82749b 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 1fd72d0f3ee..f2b0d1cd110 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. */
reply other threads:[~2021-05-25 6:07 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210525060752.3E3343858012@sourceware.org \ --to=xianmiao@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).