Reload bug
Jan Hubicka
jh@suse.cz
Thu Apr 10 20:43:00 GMT 2003
> > I think you're completely right: the reload pass has no specific
> > infrastructure for dealing with invalid subregs. It may "fix" these
> > subregs, but only if it happens that the operand needs reloading because
> > of the insn constraints.
>
> I've found why: the code has been disabled in find_reloads()
>
> /* This following hunk of code should no longer be
> needed at all with SUBREG_BYTE. If you need this
> code back, please explain to me why so I can
> fix the real problem. -DaveM */
> #if 0
> /* Subreg of a hard reg which can't handle the subreg's mode
> or which would handle that mode in the wrong number of
> registers for subregging to work. */
> || (GET_CODE (operand) == REG
> && REGNO (operand) < FIRST_PSEUDO_REGISTER
> && ((GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD
> && (GET_MODE_SIZE (GET_MODE (operand))
> > UNITS_PER_WORD)
> && ((GET_MODE_SIZE (GET_MODE (operand))
> / UNITS_PER_WORD)
> != HARD_REGNO_NREGS (REGNO (operand),
> GET_MODE (operand))))
> || ! HARD_REGNO_MODE_OK (REGNO (operand) + offset,
> operand_mode[i])))
> #endif
>
> Re-enabling it fix PR target/10286.
>
> Now the question: what is the replacement machinery that is supposed to be
> doing the work?
Hmm, I've wondered about this piece of code as well today in the train.
I think Davej was wrong to disable it without approripate replacement.
The code is wrong for post-SUBREG_BYTE patch as it checks that the
partial regs have exactly size of one word, but we do allow subregs on
registers of different sizes. We need to verify that offset can
represent the register exactly.
Looking as subreg_regno_offset, I think we need to practically check
that division in:
return (y_offset / (mode_multiple / nregs_multiple)) * nregs_ymode;
Does not round. When it rounds we are having registers too wide and we
must reload.
All the other divisions should be safe from SUBREG definition that is
already verified by my simplify_subreg code.
We also should add a trap to subreg_regno_offset in the mainline...
Seems to make sense?
Honza
More information about the Gcc
mailing list