Commit e4600702 by Richard Kenner

*** empty log message ***

From-SVN: r1313
parent b0dda4b1
...@@ -817,7 +817,7 @@ combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h \ ...@@ -817,7 +817,7 @@ combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h \
insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \ insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
basic-block.h recog.h real.h basic-block.h recog.h real.h
regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \ regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
basic-block.h regs.h insn-config.h recog.h basic-block.h regs.h insn-config.h recog.h reload.h real.h
local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \ local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
regs.h hard-reg-set.h insn-config.h recog.h output.h regs.h hard-reg-set.h insn-config.h recog.h output.h
global-alloc.o : global-alloc.c $(CONFIG_H) $(RTL_H) flags.h \ global-alloc.o : global-alloc.c $(CONFIG_H) $(RTL_H) flags.h \
......
...@@ -5836,6 +5836,37 @@ cse_insn (insn, in_libcall_block) ...@@ -5836,6 +5836,37 @@ cse_insn (insn, in_libcall_block)
} }
} }
/* See if we have a CONST_INT that is already in a register in a
wider mode. */
if (src_const && src_related == 0 && GET_CODE (src_const) == CONST_INT
&& GET_MODE_CLASS (mode) == MODE_INT
&& GET_MODE_BITSIZE (mode) < BITS_PER_WORD)
{
enum machine_mode wider_mode;
for (wider_mode = GET_MODE_WIDER_MODE (mode);
GET_MODE_BITSIZE (wider_mode) <= BITS_PER_WORD
&& src_related == 0;
wider_mode = GET_MODE_WIDER_MODE (wider_mode))
{
struct table_elt *const_elt
= lookup (src_const, HASH (src_const, wider_mode), wider_mode);
if (const_elt == 0)
continue;
for (const_elt = const_elt->first_same_value;
const_elt; const_elt = const_elt->next_same_value)
if (GET_CODE (const_elt->exp) == REG)
{
src_related = gen_lowpart_if_possible (mode,
const_elt->exp);
break;
}
}
}
/* Another possibility is that we have an AND with a constant in /* Another possibility is that we have an AND with a constant in
a mode narrower than a word. If so, it might have been generated a mode narrower than a word. If so, it might have been generated
as part of an "if" which would narrow the AND. If we already as part of an "if" which would narrow the AND. If we already
......
...@@ -2554,7 +2554,7 @@ dump_flow_info (file) ...@@ -2554,7 +2554,7 @@ dump_flow_info (file)
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (reg_n_refs[i]) if (reg_n_refs[i])
{ {
enum reg_class class; enum reg_class class, altclass;
fprintf (file, "\nRegister %d used %d times across %d insns", fprintf (file, "\nRegister %d used %d times across %d insns",
i, reg_n_refs[i], reg_live_length[i]); i, reg_n_refs[i], reg_live_length[i]);
if (reg_basic_block[i] >= 0) if (reg_basic_block[i] >= 0)
...@@ -2568,12 +2568,17 @@ dump_flow_info (file) ...@@ -2568,12 +2568,17 @@ dump_flow_info (file)
if (PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD) if (PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i)); fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
class = reg_preferred_class (i); class = reg_preferred_class (i);
if (class != GENERAL_REGS) altclass = reg_alternate_class (i);
if (class != GENERAL_REGS || altclass != ALL_REGS)
{ {
if (reg_preferred_or_nothing (i)) if (altclass == ALL_REGS || class == ALL_REGS)
fprintf (file, "; pref %s", reg_class_names[(int) class]);
else if (altclass == NO_REGS)
fprintf (file, "; %s or none", reg_class_names[(int) class]); fprintf (file, "; %s or none", reg_class_names[(int) class]);
else else
fprintf (file, "; pref %s", reg_class_names[(int) class]); fprintf (file, "; pref %s, else %s",
reg_class_names[(int) class],
reg_class_names[(int) altclass]);
} }
if (REGNO_POINTER_FLAG (i)) if (REGNO_POINTER_FLAG (i))
fprintf (file, "; pointer"); fprintf (file, "; pointer");
......
...@@ -145,9 +145,10 @@ static enum machine_mode *qty_mode; ...@@ -145,9 +145,10 @@ static enum machine_mode *qty_mode;
static int *qty_n_calls_crossed; static int *qty_n_calls_crossed;
/* Nonzero means don't allocate qty Q if we can't get its preferred class. */ /* Register class within which we allocate qty Q if we can't get
its preferred class. */
static char *qty_preferred_or_nothing; static enum reg_class *qty_alternate_class;
/* Element Q is the SCRATCH expression for which this quantity is being /* Element Q is the SCRATCH expression for which this quantity is being
allocated or 0 if this quantity is allocating registers. */ allocated or 0 if this quantity is allocating registers. */
...@@ -258,7 +259,7 @@ alloc_qty (regno, mode, size, birth) ...@@ -258,7 +259,7 @@ alloc_qty (regno, mode, size, birth)
qty_birth[qty] = birth; qty_birth[qty] = birth;
qty_n_calls_crossed[qty] = reg_n_calls_crossed[regno]; qty_n_calls_crossed[qty] = reg_n_calls_crossed[regno];
qty_min_class[qty] = reg_preferred_class (regno); qty_min_class[qty] = reg_preferred_class (regno);
qty_preferred_or_nothing[qty] = reg_preferred_or_nothing (regno); qty_alternate_class[qty] = reg_alternate_class (regno);
qty_n_refs[qty] = reg_n_refs[regno]; qty_n_refs[qty] = reg_n_refs[regno];
} }
...@@ -344,7 +345,7 @@ alloc_qty_for_scratch (scratch, n, insn, insn_code_num, insn_number) ...@@ -344,7 +345,7 @@ alloc_qty_for_scratch (scratch, n, insn, insn_code_num, insn_number)
qty_death[qty] = 2 * insn_number + 1; qty_death[qty] = 2 * insn_number + 1;
qty_n_calls_crossed[qty] = 0; qty_n_calls_crossed[qty] = 0;
qty_min_class[qty] = class; qty_min_class[qty] = class;
qty_preferred_or_nothing[qty] = 1; qty_alternate_class[qty] = NO_REGS;
qty_n_refs[qty] = 1; qty_n_refs[qty] = 1;
} }
...@@ -389,7 +390,7 @@ local_alloc () ...@@ -389,7 +390,7 @@ local_alloc ()
qty_mode = (enum machine_mode *) alloca (max_qty * sizeof (enum machine_mode)); qty_mode = (enum machine_mode *) alloca (max_qty * sizeof (enum machine_mode));
qty_n_calls_crossed = (int *) alloca (max_qty * sizeof (int)); qty_n_calls_crossed = (int *) alloca (max_qty * sizeof (int));
qty_min_class = (enum reg_class *) alloca (max_qty * sizeof (enum reg_class)); qty_min_class = (enum reg_class *) alloca (max_qty * sizeof (enum reg_class));
qty_preferred_or_nothing = (char *) alloca (max_qty); qty_alternate_class = (enum reg_class *) alloca (max_qty * sizeof (enum reg_class));
qty_n_refs = (short *) alloca (max_qty * sizeof (short)); qty_n_refs = (short *) alloca (max_qty * sizeof (short));
reg_qty = (int *) alloca (max_regno * sizeof (int)); reg_qty = (int *) alloca (max_regno * sizeof (int));
...@@ -413,7 +414,7 @@ local_alloc () ...@@ -413,7 +414,7 @@ local_alloc ()
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
{ {
if (reg_basic_block[i] >= 0 && reg_n_deaths[i] == 1 if (reg_basic_block[i] >= 0 && reg_n_deaths[i] == 1
&& (reg_preferred_or_nothing (i) && (reg_alternate_class (i) == NO_REGS
|| reg_class_size[(int) reg_preferred_class (i)] > 1)) || reg_class_size[(int) reg_preferred_class (i)] > 1))
reg_qty[i] = -2; reg_qty[i] = -2;
else else
...@@ -1336,8 +1337,8 @@ block_alloc (b) ...@@ -1336,8 +1337,8 @@ block_alloc (b)
continue; continue;
} }
if (!qty_preferred_or_nothing[q]) if (qty_alternate_class[q] != NO_REGS)
qty_phys_reg[q] = find_free_reg (ALL_REGS, qty_phys_reg[q] = find_free_reg (qty_alternate_class[q],
qty_mode[q], q, 0, 0, qty_mode[q], q, 0, 0,
qty_birth[q], qty_death[q]); qty_birth[q], qty_death[q]);
} }
...@@ -1596,8 +1597,6 @@ combine_regs (usedreg, setreg, may_save_copy, insn_number, insn, already_dead) ...@@ -1596,8 +1597,6 @@ combine_regs (usedreg, setreg, may_save_copy, insn_number, insn, already_dead)
/* Update info about quantity SQTY. */ /* Update info about quantity SQTY. */
qty_n_calls_crossed[sqty] += reg_n_calls_crossed[sreg]; qty_n_calls_crossed[sqty] += reg_n_calls_crossed[sreg];
qty_n_refs[sqty] += reg_n_refs[sreg]; qty_n_refs[sqty] += reg_n_refs[sreg];
if (! reg_preferred_or_nothing (sreg))
qty_preferred_or_nothing[sqty] = 0;
if (usize < ssize) if (usize < ssize)
{ {
register int i; register int i;
...@@ -1662,6 +1661,10 @@ update_qty_class (qty, reg) ...@@ -1662,6 +1661,10 @@ update_qty_class (qty, reg)
enum reg_class rclass = reg_preferred_class (reg); enum reg_class rclass = reg_preferred_class (reg);
if (reg_class_subset_p (rclass, qty_min_class[qty])) if (reg_class_subset_p (rclass, qty_min_class[qty]))
qty_min_class[qty] = rclass; qty_min_class[qty] = rclass;
rclass = reg_alternate_class (reg);
if (reg_class_subset_p (rclass, qty_alternate_class[qty]))
qty_alternate_class[qty] = rclass;
} }
/* Handle something which alters the value of an rtx REG. /* Handle something which alters the value of an rtx REG.
......
...@@ -1502,7 +1502,7 @@ operands_match_p (x, y) ...@@ -1502,7 +1502,7 @@ operands_match_p (x, y)
/* Return the number of times character C occurs in string S. */ /* Return the number of times character C occurs in string S. */
static int int
n_occurrences (c, s) n_occurrences (c, s)
char c; char c;
char *s; char *s;
...@@ -2045,7 +2045,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p) ...@@ -2045,7 +2045,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
? reg_preferred_class (REGNO (recog_operand[i])) : NO_REGS); ? reg_preferred_class (REGNO (recog_operand[i])) : NO_REGS);
pref_or_nothing[i] pref_or_nothing[i]
= (code == REG && REGNO (recog_operand[i]) > FIRST_PSEUDO_REGISTER = (code == REG && REGNO (recog_operand[i]) > FIRST_PSEUDO_REGISTER
&& reg_preferred_or_nothing (REGNO (recog_operand[i]))); && reg_alternate_class (REGNO (recog_operand[i])) == NO_REGS);
} }
/* If this is simply a copy from operand 1 to operand 0, merge the /* If this is simply a copy from operand 1 to operand 0, merge the
......
...@@ -642,6 +642,7 @@ extern char *decode_asm_operands (); ...@@ -642,6 +642,7 @@ extern char *decode_asm_operands ();
#ifdef BITS_PER_WORD #ifdef BITS_PER_WORD
/* Conditional is to detect when config.h has been included. */ /* Conditional is to detect when config.h has been included. */
extern enum reg_class reg_preferred_class (); extern enum reg_class reg_preferred_class ();
extern enum reg_class reg_alternate_class ();
#endif #endif
extern rtx get_first_nonparm_insn (); extern rtx get_first_nonparm_insn ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment