alias.c: Include ggc.h.
authorGraham Stott <grahams@rcp.co.uk>
Sun, 24 Oct 1999 20:20:00 +0000 (13:20 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 24 Oct 1999 20:20:00 +0000 (13:20 -0700)
        * alias.c: Include ggc.h.
        (reg_base_value, new_reg_base_value, reg_base_value_size): Make static.
        (record_set): Verify enough room in reg_base_value.
        (init_alias_analysis): Allocate reg_base_value with xcalloc.
        Register it as a GC root.
        (end_alias_analysis): Free reg_base_value.  Remove it as a GC root.
        * Makefile.in (alias.o): Depend on ggc.h.

        * unroll.c (unroll_loop): Verify the insn before a barrier
        is a JUMP_INSN before checking JUMP_LABEL.

Co-Authored-By: Richard Henderson <rth@cygnus.com>
From-SVN: r30147

gcc/ChangeLog
gcc/Makefile.in
gcc/alias.c
gcc/unroll.c

index f0625e3dc9736e03b7966c8d55177d464116e3ae..7edddff84686bc124084bc980e1a2abdcccb8bcc 100644 (file)
@@ -1,3 +1,17 @@
+Sun Oct 24 13:14:20 1999  Graham  <grahams@rcp.co.uk>
+                         Richard Henderson  <rth@cygnus.com>
+
+       * alias.c: Include ggc.h.
+       (reg_base_value, new_reg_base_value, reg_base_value_size): Make static.
+       (record_set): Verify enough room in reg_base_value.
+       (init_alias_analysis): Allocate reg_base_value with xcalloc.
+       Register it as a GC root.
+       (end_alias_analysis): Free reg_base_value.  Remove it as a GC root.
+       * Makefile.in (alias.o): Depend on ggc.h.
+
+       * unroll.c (unroll_loop): Verify the insn before a barrier
+       is a JUMP_INSN before checking JUMP_LABEL.
+
 Sun Oct 24 15:46:44 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * mips/bsd-5.h (ASM_OUTPUT_ASCII): Constify a char*.
index a2702509b07f2d8c4311564c850977cc7351c1eb..1ca5e95cdbd1754c89885fb50e618f93aed21004 100644 (file)
@@ -1579,7 +1579,7 @@ reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
    $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h insn-flags.h \
    $(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h
 alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
-   $(REGS_H) toplev.h output.h $(EXPR_H) insn-flags.h
+   $(REGS_H) toplev.h output.h $(EXPR_H) insn-flags.h ggc.h
 regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
    $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h function.h \
    $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
index fbd0e7d220781d1a47053e6baef5171741a07b8b..cc50c1b537f3c20f3a175bee03e98691e8d2bc7b 100644 (file)
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #include "tm_p.h"
 #include "function.h"
+#include "insn-flags.h"
 #include "expr.h"
 #include "regs.h"
 #include "hard-reg-set.h"
@@ -32,7 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "toplev.h"
 #include "splay-tree.h"
-#include "insn-flags.h"
+#include "ggc.h"
 
 /* The alias sets assigned to MEMs assist the back-end in determining
    which MEMs can alias which other MEMs.  In general, two MEMs in
@@ -127,9 +128,9 @@ static int nonlocal_reference_p         PROTO((rtx));
    address.  The mode determines whether it is a function argument or
    other special value. */
 
-rtx *reg_base_value;
-rtx *new_reg_base_value;
-unsigned int reg_base_value_size;      /* size of reg_base_value array */
+static rtx *reg_base_value;
+static rtx *new_reg_base_value;
+static unsigned int reg_base_value_size;       /* size of reg_base_value array */
 #define REG_BASE_VALUE(X) \
   ((unsigned) REGNO (X) < reg_base_value_size ? reg_base_value[REGNO (X)] : 0)
 
@@ -449,7 +450,7 @@ static void
 record_set (dest, set)
      rtx dest, set;
 {
-  register int regno;
+  register unsigned regno;
   rtx src;
 
   if (GET_CODE (dest) != REG)
@@ -457,6 +458,9 @@ record_set (dest, set)
 
   regno = REGNO (dest);
 
+  if (regno >= reg_base_value_size)
+    abort ();
+
   if (set)
     {
       /* A CLOBBER wipes out any old value but does not prevent a previously
@@ -1533,12 +1537,15 @@ init_alias_analysis ()
      optimization.  Loop unrolling can create a large number of
      registers.  */
   reg_base_value_size = maxreg * 2;
-  reg_base_value = (rtx *)oballoc (reg_base_value_size * sizeof (rtx));
+  reg_base_value = (rtx *) xcalloc (reg_base_value_size, sizeof (rtx));
+  if (ggc_p)
+    ggc_add_rtx_root (reg_base_value, reg_base_value_size);
+
   new_reg_base_value = (rtx *)alloca (reg_base_value_size * sizeof (rtx));
   reg_seen = (char *)alloca (reg_base_value_size);
-  bzero ((char *) reg_base_value, reg_base_value_size * sizeof (rtx));
   if (! reload_completed && flag_unroll_loops)
     {
+      /* ??? Why are we realloc'ing if we're just going to zero it?  */
       alias_invariant = (rtx *)xrealloc (alias_invariant,
                                         reg_base_value_size * sizeof (rtx));
       bzero ((char *)alias_invariant, reg_base_value_size * sizeof (rtx));
@@ -1716,11 +1723,18 @@ void
 end_alias_analysis ()
 {
   reg_known_value = 0;
-  reg_base_value = 0;
+  reg_known_value_size = 0;
+  if (reg_base_value)
+    {
+      if (ggc_p)
+       ggc_del_root (reg_base_value);
+      free (reg_base_value);
+      reg_base_value = 0;
+    }
   reg_base_value_size = 0;
   if (alias_invariant)
     {
-      free ((char *)alias_invariant);
+      free (alias_invariant);
       alias_invariant = 0;
     }
 }
index c21638f15887e4a9c65b3fd4fc9fd2b3264a2ada..d766b7437ac4b29ab2f0becc0a91532de41195d1 100644 (file)
@@ -649,6 +649,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
 
   if (unroll_type == UNROLL_NAIVE
       && GET_CODE (last_loop_insn) == BARRIER
+      && GET_CODE (PREV_INSN (last_loop_insn)) == JUMP_INSN
       && start_label != JUMP_LABEL (PREV_INSN (last_loop_insn)))
     {
       /* In this case, we must copy the jump and barrier, because they will
@@ -1961,7 +1962,8 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration,
          /* Make split induction variable constants `permanent' since we
             know there are no backward branches across iteration variable
             settings which would invalidate this.  */
-         if (dest_reg_was_split)
+         if (dest_reg_was_split
+              && (GET_CODE (pattern) == SET || GET_CODE (pattern) == USE))
            {
              int regno = REGNO (SET_DEST (pattern));