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]

Question about REG_OFFSET on big endian machines


Hello,

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.

For example,
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
register.

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.

Josef

PS: There is no such problem on little endian machines because the
REG_OFFSET stays 0 when converting promoted mode to original one.


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