optimization - x86 binary bloat - 32-bit offsets when 8-bits would do -
i'm using clang+llvm 2.9 compile various workloads x86 -os option. small binary size important , must use static linking. binaries 32-bit.
i notice many instructions use addressing modes 32-bit displacements when 8 bits used. example:
89 84 24 d4 00 00 00 mov %eax,0xd4(%esp)
why didn't compiler/assembler choose compact 8-bit displacement?
89 44 24 d4 mov %eax,0xd4(%esp)
in fact, these wasted addressing bytes on 2% of entire binary!
i looked @ llvm's link time optimization , tried --emit-llvm, didn't mention or issue.
is there link-time optimization can use knowledge of actual displacements choose smaller instruction form?
thanks help!
in x86, offsets signed. allows access data on both sides of base address. therefore, range of 8 bit offset -128 127. instruction referencing data 212 bytes forward (the value 0xd4 in decimal). if had been encoded using 8 bit offset, -44 in decimal, not wanted.
Comments
Post a Comment