Documentation change - GCC Internals

The definition of MODES_TIEABLE_P is incorrect and has resulted in reduced
optimisation for the avr target (and perhaps others)

The definition is currently:

"A C expression that is nonzero if a value of mode mode1 is accessible in mode
mode2 without copying."

This part would be ok but is then detailed as :

"If HARD_REGNO_MODE_OK (r, mode1) and HARD_REGNO_MODE_OK (r, mode2) are always
the same for any r, then MODES_TIEABLE_P (mode1, mode2) should be nonzero. If
they differ for any r, you should define this macro to return zero unless some
other mechanism ensures the accessibility of the value in a narrower mode."

This second paragraph is too restrictive. 

MODES_TIEABLE_p may also be nonzero if r is accessible in any SMALLER mode.

In the particular example of the avr target, word or larger registers are
assigned even numbered  registers ONLY. Byte registers have no such restriction.
Because this does indeed fail the second paragraph criteria, MODE_TIEABLE_P has
been set 0=FALSE preventing byte operations on the word register and uneeded
register moves. It should have been set TRUE.

I was tempted to report this as AVR target bug - but the code is not really the
problem.

Note that the definition is often included in target header files as well as gcc
internal manual.

-- 
           Summary: Documentation change - GCC Internals MODES_TIEABLE_P
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrewhutchinson at cox dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19815

Reply via email to