On 07/12/2018 09:40 PM, Jeff Law wrote:
None of the targets in the GCC repo define this. Does anyone know of an
out-of-repo target which sets REG_WORDS_BIG_ENDIAN?
The closest in-tree target is probably c6x, allows selecting big/little
for WORDS_BIG_ENDIAN, but REG_WORDS_BIG_ENDIAN is always 0.
I'll take a look at C6X.
Most test cases pass, but I'm finding a few cases which fail to
calculate a subreg correctly. Subreg_lowpart_offset() is called while
emitting RTL, for example, to truncate a DImode integer to SImode. But
subreg_lowpart_offset() does not know whether it is computing the offset
of a memory value or register value. It returns the word offset
according to memory endianity, ignoring REG_WORDS_BIG_ENDIAN. (This is
also the case with subreg_size_lowpart_offset()).
I think you'd probably want to avoid (subreg (mem)) if at all possible.
That's probably good advice in general anyway.
I would if I could, but subreg's are generated throughout the emit
process and in most cases it appears that the code doesn't know whether
it is working on a REG, MEM, or CONST_.
I'm working on a patch to pass the inner RTX to subreg_lowpart_offset(),
but this function is called in many places and it isn't always clear
what object the subreg applies to, or even if there is an object. For
example, maybe_mode_change() calls subreg_size_lowpart_offset() before
generating a REG rtx. This seems to be the wrong approach.
There are other subreg functions which seem to be specifically for
registers, like subreg_get_info() and subreg_regno_offset(). It isn't
clear whether these can replace any of the calls to
subreg_lowpart_offset().
About the only advice I'd have would be to look at the c6x and see if
it's handling any of this stuff correctly. BUt I suspect you're largely
going to be on your own.
Oh, joy.
--
Michael Eager eager@xxxxxxxxxxxx
1960 Park Blvd., Palo Alto, CA 94306