[PATCH] Pack MCSymbol flags and common alignment

Pete Cooper peter_cooper at apple.com
Mon Jun 22 16:05:49 PDT 2015


Hi Rafael

MCSymbol has 32-bits of flags and 32-bits of common alignment.

However, we only need to represent power of 2 alignments, and no subclasses need more than 16 bits of flags.  We also have 20 bits of bitfields remaining unused.

This patch takes those 20-bits and exposes them as SubclassData.

On COFF, we used 16-bits for flags and the remainder are unused.
On ELF, we used 5 bits to store the log2(align) which allows alignments up to 2^31, i.e., any power of 2 which fits in an unsigned.  The remaining 15 are enough for the ELF flags.
On MachO, we need 16-bits for flags, and the remaining 4-bits are enough for 2^15 which MCSymbolMachO::getEncodedFlags() already asserted we didn’t exceed.

This ultimately gets MCSymbol down to 24-bits for the base class.  I don’t think its possible to pack the data in any better at this point.

Cheers,
Pete

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcsymbol-packing.patch
Type: application/octet-stream
Size: 12973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150622/f76fabca/attachment.obj>


More information about the llvm-commits mailing list