Commit 16905340 by Kito Cheng

RISC-V: Unify the output asm pattern between gpr_save and gpr_restore pattern.

gcc/ChangeLog:

	* config/riscv/riscv-protos.h (riscv_output_gpr_save): Remove.
	* config/riscv/riscv-sr.c (riscv_sr_match_prologue): Update
	value.
	* config/riscv/riscv.c (riscv_output_gpr_save): Remove.
	* config/riscv/riscv.md (gpr_save): Update output asm pattern.

(cherry picked from commit dcf41a4e6033213f5e5f80da23080df961d83996)
parent 429b82ac
...@@ -53,7 +53,6 @@ extern rtx riscv_subword (rtx, bool); ...@@ -53,7 +53,6 @@ extern rtx riscv_subword (rtx, bool);
extern bool riscv_split_64bit_move_p (rtx, rtx); extern bool riscv_split_64bit_move_p (rtx, rtx);
extern void riscv_split_doubleword_move (rtx, rtx); extern void riscv_split_doubleword_move (rtx, rtx);
extern const char *riscv_output_move (rtx, rtx); extern const char *riscv_output_move (rtx, rtx);
extern const char *riscv_output_gpr_save (unsigned);
extern const char *riscv_output_return (); extern const char *riscv_output_return ();
#ifdef RTX_CODE #ifdef RTX_CODE
extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx); extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx);
......
...@@ -115,7 +115,7 @@ riscv_sr_match_prologue (rtx_insn **body) ...@@ -115,7 +115,7 @@ riscv_sr_match_prologue (rtx_insn **body)
&& GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == UNSPEC_VOLATILE && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == UNSPEC_VOLATILE
&& (GET_CODE (XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 0)) && (GET_CODE (XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 0))
== CONST_INT) == CONST_INT)
&& INTVAL (XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 0)) == 2) && INTVAL (XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 0)) == 0)
return insn; return insn;
return NULL; return NULL;
......
...@@ -3874,20 +3874,6 @@ riscv_restore_reg (rtx reg, rtx mem) ...@@ -3874,20 +3874,6 @@ riscv_restore_reg (rtx reg, rtx mem)
RTX_FRAME_RELATED_P (insn) = 1; RTX_FRAME_RELATED_P (insn) = 1;
} }
/* Return the code to invoke the GPR save routine. */
const char *
riscv_output_gpr_save (unsigned mask)
{
static char s[32];
unsigned n = riscv_save_libcall_count (mask);
ssize_t bytes = snprintf (s, sizeof (s), "call\tt0,__riscv_save_%u", n);
gcc_assert ((size_t) bytes < sizeof (s));
return s;
}
/* For stack frames that can't be allocated with a single ADDI instruction, /* For stack frames that can't be allocated with a single ADDI instruction,
compute the best value to initially allocate. It must at a minimum compute the best value to initially allocate. It must at a minimum
allocate enough space to spill the callee-saved registers. If TARGET_RVC, allocate enough space to spill the callee-saved registers. If TARGET_RVC,
...@@ -5109,7 +5095,7 @@ riscv_gen_gpr_save_insn (struct riscv_frame_info *frame) ...@@ -5109,7 +5095,7 @@ riscv_gen_gpr_save_insn (struct riscv_frame_info *frame)
RTVEC_ELT (vec, 0) = RTVEC_ELT (vec, 0) =
gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtx_UNSPEC_VOLATILE (VOIDmode,
gen_rtvec (1, GEN_INT (frame->mask)), UNSPECV_GPR_SAVE); gen_rtvec (1, GEN_INT (count)), UNSPECV_GPR_SAVE);
for (int i = 1; i < veclen; ++i) for (int i = 1; i < veclen; ++i)
{ {
......
...@@ -2423,7 +2423,7 @@ ...@@ -2423,7 +2423,7 @@
[(unspec_volatile [(match_operand 0 "const_int_operand")] [(unspec_volatile [(match_operand 0 "const_int_operand")]
UNSPECV_GPR_SAVE)])] UNSPECV_GPR_SAVE)])]
"" ""
{ return riscv_output_gpr_save (INTVAL (operands[0])); }) "call\tt0,__riscv_save_%0")
(define_insn "gpr_restore" (define_insn "gpr_restore"
[(unspec_volatile [(match_operand 0 "const_int_operand")] UNSPECV_GPR_RESTORE)] [(unspec_volatile [(match_operand 0 "const_int_operand")] UNSPECV_GPR_RESTORE)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment