[llvm-dev] RFC: Absolute or "fixed address" symbols as immediate operands

Rafael EspĂ­ndola via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 26 09:21:10 PDT 2016


On 26 October 2016 at 12:14, Reid Kleckner <rnk at google.com> wrote:
> On Tue, Oct 25, 2016 at 6:52 PM, Peter Collingbourne <peter at pcc.me.uk>
> wrote:
>>
>> So, to summarise the overall consensus on this thread:
>> - We should introduce a GlobalConstant class which supports definitions
>> and declarations
>> - It should derive from GlobalValue
>> - No type changes for GlobalValue (i.e. still required to be pointer type)
>> - To communicate the range we should use !range metadata and support it on
>> GlobalConstant as well as GlobalVariable
>>
>> Although I am not convinced that this is the right representation I appear
>> to be in the minority here, so if this seems reasonable to folks I will go
>> ahead and implement it.
>
>
> I could go either way on GlobalConstant being a pointer or not. Keeping the
> "globals are points" invariant is nice, but making LLVM IR more accurately
> model object file formats is also good.

I would say that requiring a pointer type, specially when there is
only one pointer type in the future, is closer to what the object
format is. In ELF you will get an st_value regardless of it being
absolute of a position in the file. It doesn't really make sense to
have a type that is not at least pointer sized.

Cheers,
Rafael


More information about the llvm-dev mailing list