(reg_equiv_replacement): New variable.
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 1 Jan 1996 23:23:33 +0000 (18:23 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 1 Jan 1996 23:23:33 +0000 (18:23 -0500)
(memref_referenced_p, case REG): Check for reg_equiv_replacement.
(update_equiv_regs): reg_equiv_replacement now file-scope.

From-SVN: r10930

gcc/local-alloc.c

index 20bcc1cc4b5c5244f25e031139c89d67dc917f25..b11cf2a9ab181fe05a33aa4ee1ae4629a8663e2b 100644 (file)
@@ -1,5 +1,5 @@
 /* Allocate registers within a basic block, for GNU compiler.
-   Copyright (C) 1987, 88, 91, 93, 94, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1987, 88, 91, 93, 94, 95, 1996 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -235,6 +235,10 @@ static int scratch_index;
 static int this_insn_number;
 static rtx this_insn;
 
+/* Used to communicate changes made by update_equiv_regs to
+   memref_referenced_p.  */
+static rtx *reg_equiv_replacement;
+
 static void alloc_qty          PROTO((int, enum machine_mode, int, int));
 static void alloc_qty_for_scratch PROTO((rtx, int, rtx, int, int));
 static void validate_equiv_mem_from_store PROTO((rtx, rtx));
@@ -609,7 +613,6 @@ memref_referenced_p (memref, x)
 
   switch (code)
     {
-    case REG:
     case CONST_INT:
     case CONST:
     case LABEL_REF:
@@ -621,6 +624,11 @@ memref_referenced_p (memref, x)
     case LO_SUM:
       return 0;
 
+    case REG:
+      return (reg_equiv_replacement[REGNO (x)] == 0
+             || memref_referenced_p (memref,
+                                     reg_equiv_replacement[REGNO (x)]));
+
     case MEM:
       if (true_dependence (memref, x))
        return 1;
@@ -941,9 +949,10 @@ static void
 update_equiv_regs ()
 {
   rtx *reg_equiv_init_insn = (rtx *) alloca (max_regno * sizeof (rtx *));
-  rtx *reg_equiv_replacement = (rtx *) alloca (max_regno * sizeof (rtx *));
   rtx insn;
 
+  reg_equiv_replacement = (rtx *) alloca (max_regno * sizeof (rtx *));
+
   bzero ((char *) reg_equiv_init_insn, max_regno * sizeof (rtx *));
   bzero ((char *) reg_equiv_replacement, max_regno * sizeof (rtx *));