This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: REG_INC notes going AWOL during reload
- To: Michael Hayes <m dot hayes at elec dot canterbury dot ac dot nz>
- Subject: Re: REG_INC notes going AWOL during reload
- From: Jeffrey A Law <law at hurl dot cygnus dot com>
- Date: Mon, 22 Feb 1999 01:29:03 -0700
- cc: egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
In message <14031.18328.331705.587308@ongaonga.elec.canterbury.ac.nz>you writ
e:
> Jeffrey A Law writes:
> > More correctly, I think we need to move the REG_INC note to the insn whi
> ch
> > has the address side effect.
> >
> > Alternately we could strip away all the REG_INC notes and rebuild them.
>
> The latter seems easier to implement. Here's a patch to do that.
>
> Could someone with access to a machine with autoincrement addressing
> modes please perform a bootstrap test with this patch?
>
> Michael.
>
> Sun Feb 21 12:32:48 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
>
> * reload1.c (reload): Strip REG_INC notes.
> * flow.c (auto_inc_p): New function.
> (mark_set_1): Remove call to invalidate_mems_from_autoinc.
> (mark_used_regs): Restore REG_INC notes if reload_completed.
> Move calls to invalidate_mems_from_autoinc until after REG_INC
> notes restored.
Ummm, I don't think this is correct.
mark_used_regs can be called multiple times for the same insn, which could
lead to multiple REG_INC notes added to the instruction.
Basically life_analysis_1 has code which looks like this:
[ ... ]
first_pass = 1;
changed = 1;
while (changed)
{
changed = 0;
for (i = n_basic_blocks - 1; i >= 0; i--)
[ ... ]
/* The live_at_start of this block may be changing,
so another pass will be required after this one. */
changed = 1;
if (! must_rescan)
{
/* No complete rescan needed;
just record those variables newly known live at end
as live at start as well. */
IOR_AND_COMPL_REG_SET (basic_block_live_at_start[i],
basic_block_new_live_at_end[i],
basic_block_live_at_end[i]);
IOR_AND_COMPL_REG_SET (basic_block_live_at_end[i],
basic_block_new_live_at_end[i],
basic_block_live_at_end[i]);
}
else
{
/* Update the basic_block_live_at_start
by propagation backwards through the block. */
COPY_REG_SET (basic_block_live_at_end[i],
basic_block_new_live_at_end[i]);
COPY_REG_SET (basic_block_live_at_start[i],
basic_block_live_at_end[i]);
propagate_block (basic_block_live_at_start[i],
BLOCK_HEAD (i), BLOCK_END (i), 0,
first_pass ? basic_block_significant[i]
: (regset) 0,
i);
}
[ ... ]
Which can lead to multiple calls to propagate block for each block. Then
propagate_block calls mark_used_regs, which causes us to add the REG_INC
note more than once to the same insn.
Seems to me we could deal handle adding the REG_INC notes in the same
loop that we remove them in reload. ie, first we strip any REG_INC notes
off the insn.
Then we search the insn for any autoinc expressions and if we find one,
we add the appropriate notes.
Handling it in reload is also a little cleaner -- as far as the rest of
the compiler is concerned reload kept the REG_INC notes accurate.
jeff