From ac6067399cdc9569760e681aa421fe37c2576905 Mon Sep 17 00:00:00 2001 From: Graham Stott Date: Sun, 24 Oct 1999 13:20:00 -0700 Subject: [PATCH] alias.c: Include ggc.h. * 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 From-SVN: r30147 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/Makefile.in | 2 +- gcc/alias.c | 32 +++++++++++++++++++++++--------- gcc/unroll.c | 4 +++- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0625e3dc97..7edddff8468 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +Sun Oct 24 13:14:20 1999 Graham + Richard Henderson + + * 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 * mips/bsd-5.h (ASM_OUTPUT_ASCII): Constify a char*. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a2702509b07..1ca5e95cdbd 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -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 diff --git a/gcc/alias.c b/gcc/alias.c index fbd0e7d2207..cc50c1b537f 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -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; } } diff --git a/gcc/unroll.c b/gcc/unroll.c index c21638f1588..d766b7437ac 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -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)); -- 2.30.2