Commit 8bc169f2 by Doug Evans

cse.c: (FIXED_REGNO_P): HARD_FRAME_POINTER_REGNUM is fixed.

* cse.c: (FIXED_REGNO_P): HARD_FRAME_POINTER_REGNUM is fixed.
(CHEAP_REG): HARD_FRAME_POINTER_REGNUM is cheap.
(FIXED_BASE_PLUS): Allow hard frame pointer as base.
(NONZERO_BASE_PLUS_P): Likewise.
(cannon_hash, case REG): Add HARD_FRAME_POINTER_REGNUM to list of
special registers for SMALL_REGISTER_CLASSES.
(find_best_addr): Addresses containing HARD_FRAME_POINTER_REGNUM
cannot be replaced.
(cse_main): value in HARD_FRAME_POINTER_REGNUM is preserved across calls.

From-SVN: r5451
parent 6d7096b0
...@@ -440,11 +440,13 @@ struct table_elt ...@@ -440,11 +440,13 @@ struct table_elt
but not if it is an overlapping register. */ but not if it is an overlapping register. */
#ifdef OVERLAPPING_REGNO_P #ifdef OVERLAPPING_REGNO_P
#define FIXED_REGNO_P(N) \ #define FIXED_REGNO_P(N) \
(((N) == FRAME_POINTER_REGNUM || fixed_regs[N]) \ (((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
|| fixed_regs[N]) \
&& ! OVERLAPPING_REGNO_P ((N))) && ! OVERLAPPING_REGNO_P ((N)))
#else #else
#define FIXED_REGNO_P(N) \ #define FIXED_REGNO_P(N) \
((N) == FRAME_POINTER_REGNUM || fixed_regs[N]) ((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
|| fixed_regs[N])
#endif #endif
/* Compute cost of X, as stored in the `cost' field of a table_elt. Fixed /* Compute cost of X, as stored in the `cost' field of a table_elt. Fixed
...@@ -453,10 +455,10 @@ struct table_elt ...@@ -453,10 +455,10 @@ struct table_elt
a cost of 2. Aside from these special cases, call `rtx_cost'. */ a cost of 2. Aside from these special cases, call `rtx_cost'. */
#define CHEAP_REG(N) \ #define CHEAP_REG(N) \
((N) == FRAME_POINTER_REGNUM || (N) == STACK_POINTER_REGNUM \ ((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
|| (N) == ARG_POINTER_REGNUM \ || (N) == STACK_POINTER_REGNUM || (N) == ARG_POINTER_REGNUM \
|| ((N) >= FIRST_VIRTUAL_REGISTER && (N) <= LAST_VIRTUAL_REGISTER) \ || ((N) >= FIRST_VIRTUAL_REGISTER && (N) <= LAST_VIRTUAL_REGISTER) \
|| ((N) < FIRST_PSEUDO_REGISTER \ || ((N) < FIRST_PSEUDO_REGISTER \
&& FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS)) && FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS))
#define COST(X) \ #define COST(X) \
...@@ -554,11 +556,13 @@ struct cse_basic_block_data { ...@@ -554,11 +556,13 @@ struct cse_basic_block_data {
by integrate.c, which is called before virtual register instantiation. */ by integrate.c, which is called before virtual register instantiation. */
#define FIXED_BASE_PLUS_P(X) \ #define FIXED_BASE_PLUS_P(X) \
((X) == frame_pointer_rtx || (X) == arg_pointer_rtx \ ((X) == frame_pointer_rtx || (X) == hard_frame_pointer_rtx \
|| (X) == arg_pointer_rtx \
|| (X) == virtual_stack_vars_rtx \ || (X) == virtual_stack_vars_rtx \
|| (X) == virtual_incoming_args_rtx \ || (X) == virtual_incoming_args_rtx \
|| (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \ || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
&& (XEXP (X, 0) == frame_pointer_rtx \ && (XEXP (X, 0) == frame_pointer_rtx \
|| XEXP (X, 0) == hard_frame_pointer_rtx \
|| XEXP (X, 0) == arg_pointer_rtx \ || XEXP (X, 0) == arg_pointer_rtx \
|| XEXP (X, 0) == virtual_stack_vars_rtx \ || XEXP (X, 0) == virtual_stack_vars_rtx \
|| XEXP (X, 0) == virtual_incoming_args_rtx))) || XEXP (X, 0) == virtual_incoming_args_rtx)))
...@@ -570,11 +574,12 @@ struct cse_basic_block_data { ...@@ -570,11 +574,12 @@ struct cse_basic_block_data {
the i960, the arg pointer is zero when it is unused. */ the i960, the arg pointer is zero when it is unused. */
#define NONZERO_BASE_PLUS_P(X) \ #define NONZERO_BASE_PLUS_P(X) \
((X) == frame_pointer_rtx \ ((X) == frame_pointer_rtx || (X) == hard_frame_pointer_rtx \
|| (X) == virtual_stack_vars_rtx \ || (X) == virtual_stack_vars_rtx \
|| (X) == virtual_incoming_args_rtx \ || (X) == virtual_incoming_args_rtx \
|| (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \ || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
&& (XEXP (X, 0) == frame_pointer_rtx \ && (XEXP (X, 0) == frame_pointer_rtx \
|| XEXP (X, 0) == hard_frame_pointer_rtx \
|| XEXP (X, 0) == arg_pointer_rtx \ || XEXP (X, 0) == arg_pointer_rtx \
|| XEXP (X, 0) == virtual_stack_vars_rtx \ || XEXP (X, 0) == virtual_stack_vars_rtx \
|| XEXP (X, 0) == virtual_incoming_args_rtx)) \ || XEXP (X, 0) == virtual_incoming_args_rtx)) \
...@@ -1839,6 +1844,7 @@ canon_hash (x, mode) ...@@ -1839,6 +1844,7 @@ canon_hash (x, mode)
#ifdef SMALL_REGISTER_CLASSES #ifdef SMALL_REGISTER_CLASSES
|| (! fixed_regs[regno] || (! fixed_regs[regno]
&& regno != FRAME_POINTER_REGNUM && regno != FRAME_POINTER_REGNUM
&& regno != HARD_FRAME_POINTER_REGNUM
&& regno != ARG_POINTER_REGNUM && regno != ARG_POINTER_REGNUM
&& regno != STACK_POINTER_REGNUM) && regno != STACK_POINTER_REGNUM)
#endif #endif
...@@ -2510,10 +2516,12 @@ find_best_addr (insn, loc) ...@@ -2510,10 +2516,12 @@ find_best_addr (insn, loc)
&& GET_CODE (XEXP (addr, 0)) == REG && GET_CODE (XEXP (addr, 0)) == REG
&& GET_CODE (XEXP (addr, 1)) == CONST_INT && GET_CODE (XEXP (addr, 1)) == CONST_INT
&& (regno = REGNO (XEXP (addr, 0)), && (regno = REGNO (XEXP (addr, 0)),
regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM)) regno == FRAME_POINTER_REGNUM || regno == HARD_FRAME_POINTER_REGNUM
|| regno == ARG_POINTER_REGNUM))
|| (GET_CODE (addr) == REG || (GET_CODE (addr) == REG
&& (regno = REGNO (addr), && (regno = REGNO (addr), regno == FRAME_POINTER_REGNUM
regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM)) || regno == HARD_FRAME_POINTER_REGNUM
|| regno == ARG_POINTER_REGNUM))
|| CONSTANT_ADDRESS_P (addr)) || CONSTANT_ADDRESS_P (addr))
return; return;
...@@ -7805,6 +7813,9 @@ cse_main (f, nregs, after_loop, file) ...@@ -7805,6 +7813,9 @@ cse_main (f, nregs, after_loop, file)
&& i != STACK_POINTER_REGNUM && i != STACK_POINTER_REGNUM
&& i != FRAME_POINTER_REGNUM && i != FRAME_POINTER_REGNUM
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
&& i != HARD_FRAME_POINTER_REGNUM
#endif
#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
&& ! (i == ARG_POINTER_REGNUM && fixed_regs[i]) && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
#endif #endif
......
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