From eacbf7bd8c60a2a5c8021b9e9687d5c829eaa6e8 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sun, 26 Oct 2014 10:41:13 +0000 Subject: [PATCH] mips.c (mips_kernel_reg_p): Replace with... gcc/ * config/mips/mips.c (mips_kernel_reg_p): Replace with... (mips_refers_to_kernel_reg_p): ...this new function. (mips_expand_prologue): Update accordingly. From-SVN: r216709 --- gcc/ChangeLog | 6 ++++++ gcc/config/mips/mips.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dae8c32d146..47b122066eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-10-26 Richard Sandiford + + * config/mips/mips.c (mips_kernel_reg_p): Replace with... + (mips_refers_to_kernel_reg_p): ...this new function. + (mips_expand_prologue): Update accordingly. + 2014-10-26 Richard Sandiford * config/mips/mips.c (mips_rewrite_small_data_1): Take the context diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 4d16d9b81fa..dd8a4c59115 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -11045,12 +11045,16 @@ mips_output_probe_stack_range (rtx reg1, rtx reg2) return ""; } -/* A for_each_rtx callback. Stop the search if *X is a kernel register. */ +/* Return true if X contains a kernel register. */ -static int -mips_kernel_reg_p (rtx *x, void *data ATTRIBUTE_UNUSED) +static bool +mips_refers_to_kernel_reg_p (const_rtx x) { - return REG_P (*x) && KERNEL_REG_P (REGNO (*x)); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, NONCONST) + if (REG_P (*iter) && KERNEL_REG_P (REGNO (*iter))) + return true; + return false; } /* Expand the "prologue" pattern. */ @@ -11322,7 +11326,7 @@ mips_expand_prologue (void) rtx_insn *insn; for (insn = get_last_insn (); insn != NULL_RTX; insn = PREV_INSN (insn)) if (INSN_P (insn) - && for_each_rtx (&PATTERN (insn), mips_kernel_reg_p, NULL)) + && mips_refers_to_kernel_reg_p (PATTERN (insn))) break; /* Emit a move from K1 to COP0 Status after insn. */ gcc_assert (insn != NULL_RTX); @@ -11669,7 +11673,7 @@ mips_expand_epilogue (bool sibcall_p) { for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) if (INSN_P (insn) - && for_each_rtx (&PATTERN(insn), mips_kernel_reg_p, NULL)) + && mips_refers_to_kernel_reg_p (PATTERN (insn))) break; gcc_assert (insn != NULL_RTX); /* Insert disable interrupts before the first use of K0 or K1. */ -- 2.30.2