[PATCH] Pack MCSymbol flags and common alignment

Pete Cooper peter_cooper at apple.com
Fri Jun 26 13:02:16 PDT 2015


> On Jun 22, 2015, at 10:24 PM, Pete Cooper <peter_cooper at apple.com> wrote:
> 
> 
>> On Jun 22, 2015, at 9:35 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
>> 
>> Or use one fewer bit for ELF. Nothing is going to align a common to 4 GB :-)
> If only that were true, but i’m sure someone will be crazy enough to write an asm test doing just that :)
> 
> ...
>> 
>> 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.
> I like this solution.  Will get a patch ready tomorrow.
Sorry, tomorrow ended up being a few days.

How does this look for the packing a bit in to SectionOrFragment?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pack-mcsymbol.diff
Type: application/octet-stream
Size: 5328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150626/cad32fa3/attachment.obj>
-------------- next part --------------

> 
> Pete
>>> 
>>> 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.
>>>> 
>>>> Pete
>>>>> 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.
>>>>> 
>>>>> Cheers,
>>>>> Pete
>>>>> 
>>>>> <mcsymbol-packing.patch>
>>>> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list