Problem with post_modify

Jim Wilson wilson@specifixinc.com
Wed Feb 25 01:54:00 GMT 2004


Jon Beniston wrote:
> The problems appears because this RTX:
> (post_modify:HI (reg/v/f:HI 48)
> is somehow transformed into this:
> (post_modify:HI (mem:HI (plus:HI (reg/f:HI 0 sp)

I'd guess a REG_OK_STRICT problem.  During reload, any pseudo-reg which 
is not allocated to a hard reg is actually a MEM, because it will later 
be converted into a stack slot.  So you have to be careful when handling 
pseudos to remember that a pseudo can be either a REG or a MEM depending 
on what the register allocator does with it.

This distinction is handled by REG_OK_STRICT.  Two sets of macros get 
defined, one with REG_OK_STRICT false and one with REG_OK_STRICT true. 
When REG_OK_STRICT is true, a pseudo-reg should be considered a MEM, and 
should be accepted anyplace where a REG is required.  When REG_OK_STRICT 
is false, a pseudo-reg should be considered a REG, and accepted anyplace 
where a hard register is required.

The macros affected by this are GO_IF_LEGITIMATE_ADDRESS, 
REG_OK_FOR_BASE, REG_OK_FOR_INDEX, etc.

People often get into trouble when they try to write these macros to 
calls functions.  If you do that, then you have to pass in the value of 
REG_OK_STRICT, and test it inside the function.  See for instance what 
the mips port does.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list