[LLVMdev] LLD: representation of a power of two value

Shankar Easwaran shankare at codeaurora.org
Wed Mar 25 08:35:49 PDT 2015


On 3/24/2015 7:51 PM, Rui Ueyama wrote:
> On Tue, Mar 24, 2015 at 5:40 PM, Nick Kledzik <kledzik at apple.com> wrote:
>
>> On Mar 24, 2015, at 5:09 PM, Rui Ueyama <ruiu at google.com> wrote:
>>
>>> It's not a big deal, but it always annoyed me a bit when I hit it, so
>> I'll bring it up here.
>>> LLD represents an alignment X as log2(X) in some places and just X in
>> other places. It's a bit confusing. Because I always think alignments in my
>> mind in terms of 1, 2, 4, 8, ..., instead of 2^1, 2^2, 2^3, ..., I'd like
>> to propose to always use real values.
>> Can you give some examples?
>>
>> The DefinedAtom class has struct:
>>
>>      struct Alignment {
>>          uint16_t powerOf2;
>>          uint16_t modulus;
>>      };
>>
>> That use seems clear.   But, yes, if there is “int alignment” somewhere,
>> that is ambiguous.
>>
> At least in ELF, alignment values are represented not by exponents but by
> just numbers in files, so we convert them back and force. "Alignment" is
> used for both exponents and actual values there.
I believe you are mentioning about section alignments, that are being 
differentiated from atom alignments ?

If so are you planning to change the variable name (or) use Alignment 
even there ?

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation





More information about the llvm-dev mailing list