Mail Archives: pgcc/1998/09/22/17:35:01
I often see sequences like this in code generated by pgcc v1.1a:
115 00bf A100000000 movl ptrbase,%eax ; load pointer
117 00c9 B920000000 movl $32,%ecx ; load value to write
118 00ce 8888AC074000 movb %cl,4196268(%eax) ; write val to ptr addr
Note that 0x00000020 is moved into reg ECX, then reg CL is actually used.
Why is pgcc bloating up the code with those bytes (the high 24 bits of
ECX) which will never be used?
My understanding is that you get the same AGI conditions for any register
(e.g. ECX) or *partial* register (e.g. CL) used, so I see no benefit to
using the 32-bit reg when the lower 8-bit reg will do.
Using only CL in the code above would have reduced the total size of this
pointer operation from 16 bytes to 13 bytes. This sounds like a Good
Thing to me.
(FYI, the code above was generated with an optimization level of -O6.)
Thank you.
- Raw text -