reload1.c (reload_combine, [...]): Make USE_RUID always valid.

* reload1.c (reload_combine, reload_combine_note_store):
	Make USE_RUID always valid.
	(reload_combine): Check if BASE is clobbered too early.

From-SVN: r24216
This commit is contained in:
J"orn Rennecke 1998-12-09 11:39:17 +00:00 committed by Joern Rennecke
parent 290b61f7fa
commit ed937a1993
2 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,9 @@
Wed Dec 9 19:36:57 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* reload1.c (reload_combine, reload_combine_note_store):
Make USE_RUID always valid.
(reload_combine): Check if BASE is clobbered too early.
Wed Dec 9 09:53:58 1998 Nick Clifton <nickc@cygnus.com> Wed Dec 9 09:53:58 1998 Nick Clifton <nickc@cygnus.com>
* reload.c (find_reloads): Display the insn that cannot be * reload.c (find_reloads): Display the insn that cannot be

View File

@ -9357,7 +9357,10 @@ struct reg_use { rtx insn, *usep; };
register (which is first among these we have seen since we scan backwards), register (which is first among these we have seen since we scan backwards),
OFFSET contains the constant offset that is added to the register in OFFSET contains the constant offset that is added to the register in
all encountered uses, and USE_RUID indicates the first encountered, i.e. all encountered uses, and USE_RUID indicates the first encountered, i.e.
last, of these uses. */ last, of these uses.
STORE_RUID is always meaningful if we only want to use a value in a
register in a different place: it denotes the next insn in the insn
stream (i.e. the last ecountered) that sets or clobbers the register. */
static struct static struct
{ {
struct reg_use reg_use[RELOAD_COMBINE_MAX_USES]; struct reg_use reg_use[RELOAD_COMBINE_MAX_USES];
@ -9405,13 +9408,11 @@ reload_combine ()
last_label_ruid = reload_combine_ruid = 0; last_label_ruid = reload_combine_ruid = 0;
for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; --i) for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; --i)
{ {
reg_state[i].store_ruid = reload_combine_ruid;
if (fixed_regs[i]) if (fixed_regs[i])
reg_state[i].use_index = -1; reg_state[i].use_index = -1;
else else
{ reg_state[i].use_index = RELOAD_COMBINE_MAX_USES;
reg_state[i].use_index = RELOAD_COMBINE_MAX_USES;
reg_state[i].store_ruid = reload_combine_ruid;
}
} }
for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
@ -9493,10 +9494,14 @@ reload_combine ()
} }
} }
} }
/* Check that PREV_SET is indeed (set (REGX) (CONST_INT)) and that
(REGY), i.e. BASE, is not clobbered before the last use we'll
create. */
if (prev_set if (prev_set
&& GET_CODE (SET_SRC (prev_set)) == CONST_INT && GET_CODE (SET_SRC (prev_set)) == CONST_INT
&& rtx_equal_p (SET_DEST (prev_set), reg) && rtx_equal_p (SET_DEST (prev_set), reg)
&& reg_state[regno].use_index >= 0 && reg_state[regno].use_index >= 0
&& reg_state[REGNO (base)].store_ruid <= reg_state[regno].use_ruid
&& reg_sum) && reg_sum)
{ {
int i; int i;
@ -9588,7 +9593,12 @@ reload_combine ()
{ {
if (REG_NOTE_KIND (note) == REG_INC if (REG_NOTE_KIND (note) == REG_INC
&& GET_CODE (XEXP (note, 0)) == REG) && GET_CODE (XEXP (note, 0)) == REG)
reg_state[REGNO (XEXP (note, 0))].use_index = -1; {
int regno = REGNO (XEXP (note, 0));
reg_state[regno].store_ruid = reload_combine_ruid;
reg_state[regno].use_index = -1;
}
} }
} }
} }
@ -9616,7 +9626,10 @@ reload_combine_note_store (dst, set)
/* note_stores might have stripped a STRICT_LOW_PART, so we have to be /* note_stores might have stripped a STRICT_LOW_PART, so we have to be
careful with registers / register parts that are not full words. */ careful with registers / register parts that are not full words. */
if (size < (unsigned) UNITS_PER_WORD) if (size < (unsigned) UNITS_PER_WORD)
reg_state[regno].use_index = -1; {
reg_state[regno].use_index = -1;
reg_state[regno].store_ruid = reload_combine_ruid;
}
else else
{ {
for (i = size / UNITS_PER_WORD - 1 + regno; i >= regno; i--) for (i = size / UNITS_PER_WORD - 1 + regno; i >= regno; i--)