diff options
Diffstat (limited to 'gcc/local-alloc.c')
-rw-r--r-- | gcc/local-alloc.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index e8110ac..f112713 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -630,6 +630,22 @@ memref_used_between_p (memref, start, end) return 0; } +/* Return nonzero if the rtx X is invariant over the current function. */ +int +function_invariant_p (x) + rtx x; +{ + if (CONSTANT_P (x)) + return 1; + if (x == frame_pointer_rtx || x == arg_pointer_rtx) + return 1; + if (GET_CODE (x) == PLUS + && (XEXP (x, 0) == frame_pointer_rtx || XEXP (x, 0) == arg_pointer_rtx) + && CONSTANT_P (XEXP (x, 1))) + return 1; + return 0; +} + /* Find registers that are equivalent to a single value throughout the compilation (either because they can be referenced in memory or are set once from a single constant). Lower their priority for a register. @@ -798,7 +814,7 @@ update_equiv_regs () if (REG_N_SETS (regno) != 1 && (! note - || ! CONSTANT_P (XEXP (note, 0)) + || ! function_invariant_p (XEXP (note, 0)) || (reg_equiv_replacement[regno] && ! rtx_equal_p (XEXP (note, 0), reg_equiv_replacement[regno])))) @@ -812,7 +828,7 @@ update_equiv_regs () /* If this register is known to be equal to a constant, record that it is always equivalent to the constant. */ - if (note && CONSTANT_P (XEXP (note, 0))) + if (note && function_invariant_p (XEXP (note, 0))) PUT_MODE (note, (enum machine_mode) REG_EQUIV); /* If this insn introduces a "constant" register, decrease the priority |