This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: reload getting the mode of (subreg:HI (reg:QI pseudo)) wrong
- From: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- To: Bernd Schmidt <bernds_cb1 at t-online dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 4 Aug 2006 13:34:33 +0200
- Subject: Re: reload getting the mode of (subreg:HI (reg:QI pseudo)) wrong
- References: <20060804003033.GA6661@sygehus.dk> <44D31181.9070206@t-online.de>
On Fri, Aug 04, 2006 at 11:21:05AM +0200, Bernd Schmidt wrote:
>
> Probably the compiler doesn't in general like a paradoxical subreg that
> can take more hard regs than its SUBREG_REG. I think this is probably
> something that can be worked around with a proper combination of
> MODES_TIEABLE_P, CANNOT_CHANGE_MODE_CLASS, and maybe
> REG_CANNOT_CHANGE_MODE_P. What are your definitions of those macros?
#define MODES_TIEABLE_P(MODE1, MODE2) \
(GET_MODE_SIZE(MODE1) > 1 && GET_MODE_SIZE(MODE2) > 1)
There are registers for which HARD_REGNO_MODE_OK (regno, QImode) returns
false but HARD_REGNO_MODE_OK (regno, HImode) (or larger) returns true.
#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
((FROM == QImode || (TO) == QImode) \
&& reg_classes_intersect_p (HI_REGS, (CLASS)))
HI_REGS is a class containing registers which can't hold QImode values. They
are 16-bit only (%si, %di, %bp and %sp). Is there an undocumented assumption
here that if CANNOT_CHANGE_MODE_CLASS() returns true, then the number of hard
regs used is unchanged?
I haven't heard of REG_CANNOT_CHANGE_MODE_P before, and it isn't mentioned
in the documentation.
--
Rask Ingemann Lambertsen