This is the mail archive of the
mailing list for the GCC project.
Question about REG_OFFSET on big endian machines
- From: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 5 May 2004 20:48:26 +0200
- Subject: Question about REG_OFFSET on big endian machines
I have a question about REG_OFFSET on big endian machines.
When a 32-bit variable is stored in a 32-bit register the REG_OFFSET is 0.
When a 8-bit variable is stored in a 32-bit register the REG_OFFSET is 3.
That's pretty clear and simple.
But the problem appears when the variable is stored in promoted mode and then
converted back by SUBREG.
32-bit variable promoted to 64-bit register has a REG_OFFSET == 0.
When it is then accessed by SUBREG which is later converted to a REG
it gets a REG_OFFSET == 4 which is wrong for 32-bit variable in 32-bit
IMHO we should look at the size of the variable rather than the size of original
register when converting the SUBREG to REG and thus the register would get
REG_OFFSET == 0 instead of 4.
Similarly, 8-bit variable promoted to 64-bit register has a REG_OFFSET of 0,
when converted back to 8-bit now it gets REG_OFFSET == 7,
with my suggestion it would be 0, and when converted to 32-bit the
REG_OFFSET would be 3.
Is my suggestion correct?
Thanks for reply.
PS: There is no such problem on little endian machines because the
REG_OFFSET stays 0 when converting promoted mode to original one.