+Fri May 19 18:16:31 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * cse.c (cse_basic_block): Only call find_reg_note if REG_NOTES not 0.
+ * reload.c (find_equiv_reg): Likewise.
+ * alias.c (init_alias_analysis): Likewise.
+ Only call prologue_epilogue_contains on insns.
+ * basic-block.h (REG_SET_TO_HARD_REG_SET): Call new function.
+ * bb-reorder.c (hard-reg-set.h): Include earlier.
+ * haifa-sched.c (hard-reg-set.h): Likewise.
+ * ifcvt.c (hard-reg-set.h): Likewise.
+ * local-alloc.c (hard-reg-set.h): Likewise.
+ * loop.c (hard-reg-set.h): Likewise.
+ * predict.c (hard-reg-set.h): Likewise.
+ * regrename.c (hard-reg-set.h): Likewise.
+ * flow.c (hard-reg-set.h): Likewise.
+ (reg_set_to_hard_reg_set): New function.
+ * bitmap.c (regs.h, basic-block.h): No longer include.
+ (bitmap.h): Now include.
+ * conflict.c (hard-reg-set.h): Include.
+ * profile.c (hard-reg-set.h): Likewise.
+ * print-rtl.c (hard-reg-set.h): Likewise.
+ * sbitmap.c (hard-reg-set.h): Likewise.
+ * toplev.c (hard-reg-set.h): Likewise.
+ * unroll.c (hard-reg-set.h, basic-block.h): Likewise.
+ * hard-reg-set.h (reg_names): Now constant.
+ * regs.h (reg_names): Likewise.
+ * regclass.c (reg_names): Likewise.
+ * loop.h (basic-block.h): No longer include.
+ (bitmap.h): Now include.
+ * reload1.c (order_regs_for_reload): Avoid loop over reg sets.
+ * Makefile.in (LOOP_H, sbitmap.o, profile.o): Reflect above changes.
+ (toplev.o, print-rtl.o, conflict.o, unroll.o, bitmap.o): Likewise.
+
2000-05-19 Jan Hubicka <jh@suse.cz>
Richard Henderson <rth@cygnus.com>
EXPR_H = expr.h insn-codes.h
REGS_H = regs.h varray.h $(MACHMODE_H)
INTEGRATE_H = integrate.h varray.h
-LOOP_H = loop.h varray.h basic-block.h
+LOOP_H = loop.h varray.h bitmap.h
GCC_H = gcc.h version.h
GGC_H = ggc.h varray.h
TIMEVAR_H = timevar.h timevar.def
mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h
graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
function.h hard-reg-set.h $(BASIC_BLOCK_H) graph.h
-sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H)
+sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
+ $(BASIC_BLOCK_H)
COLLECT2_OBJS = collect2.o tlink.o hash.o intl.o underscore.o version.o
collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) function.h \
flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
- dwarf2out.h sdbout.h dbxout.h $(EXPR_H) $(BASIC_BLOCK_H) graph.h loop.h \
- except.h regs.h $(TIMEVAR_H) $(lang_options_files)
+ dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
+ graph.h loop.h except.h regs.h $(TIMEVAR_H) $(lang_options_files)
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
-DTARGET_NAME=\"$(target_alias)\" \
-c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h $(GGC_H) toplev.h
-print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) $(BASIC_BLOCK_H)
+print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h \
+ $(BASIC_BLOCK_H)
rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
errors.o : errors.c $(CONFIG_H) system.h errors.h
ssa.o : ssa.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) $(BASIC_BLOCK_H) \
output.h insn-config.h
conflict.o : conflict.c $(CONFIG_H) system.h $(OBSTACK_H) $(HASHTAB_H) \
- $(RTL_H) $(BASIC_BLOCK_H)
-profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
- gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h function.h insn-config.h \
- $(GGC_H)
+ $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H)
+profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
+ insn-flags.h insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \
+ gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H)
loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h $(LOOP_H) insn-config.h \
insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
$(BASIC_BLOCK_H) function.h toplev.h varray.h except.h cselib.h
unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h function.h \
$(INTEGRATE_H) $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h \
- varray.h
+ hard-reg-set.h varray.h $(BASIC_BLOCK_H)
flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h insn-config.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
insn-flags.h function.h except.h $(EXPR_H)
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \
- flags.h $(BASIC_BLOCK_H) $(REGS_H)
+ flags.h bitmap.h
rm -f $(HOST_PREFIX)bitmap.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c
/* Walk the insns adding values to the new_reg_base_value array. */
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{
-#if defined (HAVE_prologue) || defined (HAVE_epilogue)
- if (prologue_epilogue_contains (insn))
- continue;
-#endif
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
{
rtx note, set;
+
+#if defined (HAVE_prologue) || defined (HAVE_epilogue)
+ if (prologue_epilogue_contains (insn))
+ continue;
+#endif
+
/* If this insn has a noalias note, process it, Otherwise,
scan for sets. A simple set will have no side effects
which could change the base value of any other register. */
if (GET_CODE (PATTERN (insn)) == SET
- && (find_reg_note (insn, REG_NOALIAS, NULL_RTX)))
+ && REG_NOTES (insn) != 0
+ && find_reg_note (insn, REG_NOALIAS, NULL_RTX))
record_set (SET_DEST (PATTERN (insn)), NULL_RTX, NULL);
else
note_stores (PATTERN (insn), record_set, NULL);
if (set != 0
&& GET_CODE (SET_DEST (set)) == REG
&& REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER
+ && REG_NOTES (insn) != 0
&& (((note = find_reg_note (insn, REG_EQUAL, 0)) != 0
&& REG_N_SETS (REGNO (SET_DEST (set))) == 1)
|| (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != 0)
#define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG)
/* Copy the hard registers in a register set to the hard register set. */
+extern void reg_set_to_hard_reg_set PARAMS ((HARD_REG_SET *, bitmap));
#define REG_SET_TO_HARD_REG_SET(TO, FROM) \
do { \
- int i_; \
CLEAR_HARD_REG_SET (TO); \
- for (i_ = 0; i_ < FIRST_PSEUDO_REGISTER; i_++) \
- if (REGNO_REG_SET_P (FROM, i_)) \
- SET_HARD_REG_BIT (TO, i_); \
+ reg_set_to_hard_reg_set (&TO, FROM); \
} while (0)
/* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "regs.h"
-#include "hard-reg-set.h"
#include "flags.h"
#include "output.h"
#include "function.h"
#include "rtl.h"
#include "flags.h"
#include "obstack.h"
-#include "regs.h"
-#include "basic-block.h"
+#include "bitmap.h"
/* Obstack to allocate bitmap elements from. */
static struct obstack bitmap_obstack;
#include "obstack.h"
#include "hashtab.h"
#include "rtl.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
/* Use malloc to allocate obstack chunks. */
its destination is the result of the block and hence should be
recorded. */
- if ((p = find_reg_note (insn, REG_LIBCALL, NULL_RTX)))
- libcall_insn = XEXP (p, 0);
- else if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
- libcall_insn = NULL_RTX;
+ if (REG_NOTES (insn) != 0)
+ {
+ if ((p = find_reg_note (insn, REG_LIBCALL, NULL_RTX)))
+ libcall_insn = XEXP (p, 0);
+ else if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
+ libcall_insn = 0;
+ }
cse_insn (insn, libcall_insn);
}
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "regs.h"
-#include "hard-reg-set.h"
#include "flags.h"
#include "output.h"
#include "function.h"
/* Return non-zero if edge E enters header of LOOP from outside of LOOP. */
+
int
flow_loop_outside_edge_p (loop, e)
const struct loop *loop;
/* Clear LOG_LINKS fields of insns in a chain. */
+
void
clear_log_links (insns)
rtx insns;
if (GET_RTX_CLASS (GET_CODE (i)) == 'i')
LOG_LINKS (i) = 0;
}
+
+/* Given a register bitmap, turn on the bits in a HARD_REG_SET that
+ correspond to the hard registers, if any, set in that map. This
+ could be done far more efficiently by having all sorts of special-cases
+ with moving single words, but probably isn't worth the trouble. */
+
+void
+reg_set_to_hard_reg_set (to, from)
+ HARD_REG_SET *to;
+ bitmap from;
+{
+ int i;
+
+ EXECUTE_IF_SET_IN_BITMAP
+ (from, 0, i,
+ {
+ if (i >= FIRST_PSEUDO_REGISTER)
+ return;
+ SET_HARD_REG_BIT (*to, i);
+ });
+}
+
#include "toplev.h"
#include "rtl.h"
#include "tm_p.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "regs.h"
#include "function.h"
-#include "hard-reg-set.h"
#include "flags.h"
#include "insn-config.h"
#include "insn-attr.h"
/* Vector indexed by hardware reg giving its name. */
-extern const char *reg_names[FIRST_PSEUDO_REGISTER];
+extern const char * const reg_names[FIRST_PSEUDO_REGISTER];
#include "flags.h"
#include "insn-config.h"
#include "recog.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "expr.h"
#include "output.h"
-#include "hard-reg-set.h"
#include "tm_p.h"
#include "rtl.h"
#include "tm_p.h"
#include "flags.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "regs.h"
#include "function.h"
-#include "hard-reg-set.h"
#include "insn-config.h"
#include "insn-attr.h"
#include "recog.h"
#include "obstack.h"
#include "function.h"
#include "expr.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "insn-flags.h"
#include "regs.h"
-#include "hard-reg-set.h"
#include "recog.h"
#include "flags.h"
#include "real.h"
Boston, MA 02111-1307, USA. */
#include "varray.h"
-#include "basic-block.h"
+#include "bitmap.h"
+
/* Flags passed to loop_optimize. */
#define LOOP_UNROLL 1
#define LOOP_BCT 2
Wu and Larus; MICRO-27.
[3] "Corpus-based Static Branch Prediction"
Calder, Grunwald, Lindsay, Martin, Mozer, and Zorn; PLDI '95.
+
*/
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "regs.h"
-#include "hard-reg-set.h"
#include "flags.h"
#include "output.h"
#include "function.h"
#include "rtl.h"
#include "real.h"
#include "flags.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
-
/* How to print out a register name.
We don't use PRINT_REG because some definitions of PRINT_REG
don't work here. */
#include "gcov-io.h"
#include "toplev.h"
#include "ggc.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
/* Array containing all of the register names */
-const char *reg_names[] = REGISTER_NAMES;
+const char * const reg_names[] = REGISTER_NAMES;
/* For each hard register, the widest mode object that it can contain.
This will be a MODE_INT mode if the register can hold integers. Otherwise
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "regs.h"
-#include "hard-reg-set.h"
#include "flags.h"
#include "output.h"
#include "function.h"
/* Vector indexed by hardware reg giving its name. */
-extern const char *reg_names[FIRST_PSEUDO_REGISTER];
+extern const char * const reg_names[FIRST_PSEUDO_REGISTER];
/* For each hard register, the widest mode object that it can contain.
This will be a MODE_INT mode if the register can hold integers. Otherwise
/* If we are looking for a constant,
and something equivalent to that constant was copied
into a reg, we can use that reg. */
- || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
- NULL_RTX))
- && rtx_equal_p (XEXP (tem, 0), goal)
- && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
- || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
- NULL_RTX))
- && GET_CODE (SET_DEST (pat)) == REG
- && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (XEXP (tem, 0))) == MODE_FLOAT
- && GET_CODE (goal) == CONST_INT
- && 0 != (goaltry = operand_subword (XEXP (tem, 0), 0, 0,
+ || (goal_const && REG_NOTES (p) != 0
+ && (tem = find_reg_note (p, REG_EQUIV, NULL_RTX))
+ && ((rtx_equal_p (XEXP (tem, 0), goal)
+ && (valueno
+ = true_regnum (valtry = SET_DEST (pat))) >= 0)
+ || (GET_CODE (SET_DEST (pat)) == REG
+ && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
+ && (GET_MODE_CLASS (GET_MODE (XEXP (tem, 0)))
+ == MODE_FLOAT)
+ && GET_CODE (goal) == CONST_INT
+ && 0 != (goaltry
+ = operand_subword (XEXP (tem, 0), 0, 0,
VOIDmode))
- && rtx_equal_p (goal, goaltry)
- && (valtry = operand_subword (SET_DEST (pat), 0, 0,
- VOIDmode))
- && (valueno = true_regnum (valtry)) >= 0)
+ && rtx_equal_p (goal, goaltry)
+ && (valtry
+ = operand_subword (SET_DEST (pat), 0, 0,
+ VOIDmode))
+ && (valueno = true_regnum (valtry)) >= 0)))
|| (goal_const && (tem = find_reg_note (p, REG_EQUIV,
NULL_RTX))
&& GET_CODE (SET_DEST (pat)) == REG
&& GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (XEXP (tem, 0))) == MODE_FLOAT
+ && (GET_MODE_CLASS (GET_MODE (XEXP (tem, 0)))
+ == MODE_FLOAT)
&& GET_CODE (goal) == CONST_INT
&& 0 != (goaltry = operand_subword (XEXP (tem, 0), 1, 0,
VOIDmode))
/* Don't try to re-use something that is killed in this insn. We want
to be able to trust REG_UNUSED notes. */
- if (find_reg_note (where, REG_UNUSED, value))
+ if (REG_NOTES (where) != 0 && find_reg_note (where, REG_UNUSED, value))
return 0;
/* If we propose to get the value from the stack pointer or if GOAL is
fatal_insn later. We clear the corresponding regnos in the live
register sets to avoid this.
The whole thing is rather sick, I'm afraid. */
+
static void
maybe_fix_stack_asms ()
{
/* Calculate the SPILL_COST and SPILL_ADD_COST arrays and determine the
contents of BAD_SPILL_REGS for the insn described by CHAIN. */
+
static void
order_regs_for_reload (chain)
struct insn_chain *chain;
{
register int i, j;
+ HARD_REG_SET used_by_pseudos;
+ HARD_REG_SET used_by_pseudos2;
- COPY_HARD_REG_SET (bad_spill_regs, bad_spill_regs_global);
+ COPY_HARD_REG_SET (bad_spill_regs, fixed_reg_set);
memset (spill_cost, 0, sizeof spill_cost);
memset (spill_add_cost, 0, sizeof spill_add_cost);
/* Count number of uses of each hard reg by pseudo regs allocated to it
- and then order them by decreasing use. */
+ and then order them by decreasing use. First exclude hard registers
+ that are live in or across this insn. */
+
+ REG_SET_TO_HARD_REG_SET (used_by_pseudos, &chain->live_throughout);
+ REG_SET_TO_HARD_REG_SET (used_by_pseudos2, &chain->dead_or_set);
+ IOR_HARD_REG_SET (bad_spill_regs, used_by_pseudos);
+ IOR_HARD_REG_SET (bad_spill_regs, used_by_pseudos2);
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- /* Test the various reasons why we can't use a register for
- spilling in this insn. */
- if (fixed_regs[i]
- || REGNO_REG_SET_P (&chain->live_throughout, i)
- || REGNO_REG_SET_P (&chain->dead_or_set, i))
- SET_HARD_REG_BIT (bad_spill_regs, i);
- }
/* Now find out which pseudos are allocated to it, and update
hard_reg_n_uses. */
CLEAR_REG_SET (&pseudos_counted);
else
spill_reg_order[i] = -1;
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (REGNO_REG_SET_P (&spilled_pseudos, i))
- {
- /* Record the current hard register the pseudo is allocated to in
- pseudo_previous_regs so we avoid reallocating it to the same
- hard reg in a later pass. */
- if (reg_renumber[i] < 0)
- abort ();
- SET_HARD_REG_BIT (pseudo_previous_regs[i], reg_renumber[i]);
- /* Mark it as no longer having a hard register home. */
- reg_renumber[i] = -1;
- /* We will need to scan everything again. */
- something_changed = 1;
- }
+ EXECUTE_IF_SET_IN_REG_SET
+ (&spilled_pseudos, FIRST_PSEUDO_REGISTER, i,
+ {
+ /* Record the current hard register the pseudo is allocated to in
+ pseudo_previous_regs so we avoid reallocating it to the same
+ hard reg in a later pass. */
+ if (reg_renumber[i] < 0)
+ abort ();
+
+ SET_HARD_REG_BIT (pseudo_previous_regs[i], reg_renumber[i]);
+ /* Mark it as no longer having a hard register home. */
+ reg_renumber[i] = -1;
+ /* We will need to scan everything again. */
+ something_changed = 1;
+ });
/* Retry global register allocation if possible. */
if (global)
/* Initialize all the tables needed to allocate reload registers.
CHAIN is the insn currently being processed; SAVE_RELOAD_REG_RTX
is the array we use to restore the reg_rtx field for every reload. */
+
static void
choose_reload_regs_init (chain, save_reload_reg_rtx)
struct insn_chain *chain;
compute_use_by_pseudos (®_used_in_insn, &chain->live_throughout);
compute_use_by_pseudos (®_used_in_insn, &chain->dead_or_set);
}
+
for (i = 0; i < reload_n_operands; i++)
{
CLEAR_HARD_REG_SET (reload_reg_used_in_output[i]);
#include "system.h"
#include "rtl.h"
#include "flags.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
/* Bitmap manipulation routines. */
#include "function.h"
#include "toplev.h"
#include "expr.h"
+#include "hard-reg-set.h"
#include "basic-block.h"
#include "intl.h"
#include "ggc.h"
#include "expr.h"
#include "loop.h"
#include "toplev.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
/* This controls which loops are unrolled, and by how much we unroll
them. */