cse.c: (FIXED_REGNO_P): HARD_FRAME_POINTER_REGNUM is fixed.
authorDoug Evans <dje@gnu.org>
Fri, 24 Sep 1993 19:38:20 +0000 (19:38 +0000)
committerDoug Evans <dje@gnu.org>
Fri, 24 Sep 1993 19:38:20 +0000 (19:38 +0000)
* 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

gcc/cse.c

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