This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: reload getting the mode of (subreg:HI (reg:QI pseudo)) wrong


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]