[PATCH] Pack MCSymbol flags and common alignment
rafael.espindola at gmail.com
Mon Jun 22 21:35:09 PDT 2015
Or use one fewer bit for ELF. Nothing is going to align a common to 4 GB :-)
On 23 June 2015 at 00:23, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> Another option would be to use one of the low bits it SectionOrFragment.
> With that you could keep 5 bits in the base for common.
> On 22 June 2015 at 19:19, Pete Cooper <peter_cooper at apple.com> wrote:
>> I should say, i forgot to clang-format this. I’ll of course do that before commit as there’s a bunch of 80-cols violations right now.
>>> On Jun 22, 2015, at 4:05 PM, Pete Cooper <peter_cooper at apple.com> wrote:
>>> 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.
More information about the llvm-commits