[PATCH] Pack MCSymbol flags and common alignment

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Jul 1 12:00:39 PDT 2015


> On 2015-Jun-30, at 14:30, Pete Cooper <peter_cooper at apple.com> wrote:
> 
> Here’s a new version of the patch for using 5-bits for alignment.  Please review when you get a chance.
> 
> Last one after this will just be to make flags 16-bits and move it to before Index.
> 
> Thanks,
> Pete
> 
> <mcsymbol-packing.patch>

> diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
> index 48b50d9..cb872be 100644
> --- a/include/llvm/MC/MCSymbol.h
> +++ b/include/llvm/MC/MCSymbol.h
> @@ -109,6 +109,14 @@ protected:
>    /// extension and achieve better bitpacking with MSVC.
>    unsigned SymbolContents : 2;
>  
> +  /// The alignment of the symbol, if it is 'common', or -1.
> +  ///
> +  /// The alignment is stored as log2(align) + 1.  This allows all values from
> +  /// 0 to 2^31 to be stored which is every power of 2 representable by an
> +  /// unsigned.
> +  const unsigned NumCommonAlignmentBits = 5;

I think you meant to make this static, right?  Otherwise it costs 4
bytes.

> +  unsigned CommonAlignLog2 : 5;

Can you use `NumCommonAlignmentBits` here?

> +
>    /// Index field, for use by the object file implementation.
>    mutable uint32_t Index = 0;
>  





More information about the llvm-commits mailing list