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

Peter Collingbourne via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 25 18:52:08 PDT 2016


On Tue, Oct 25, 2016 at 2:55 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> > You get the code you want with
> >
> > @foo = external hidden global i8
> >
> > or
> >
> > @foo = external protected global i8
>
> Sorry, not quiet. What you get is
>
> leaq    foo(%rip), %rax
>
> Since it is still assuming foo is a position in the file.
>
> So yes, we need a way to declare an absolute value. If we can declare
> it, we may as well use the same construct to define it.
>
> I guess the only issue then is that the current implementation of
> alias becomes even more needlessly generic :-(
>
> Cheers,
> Rafael
>

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.

Thanks,
-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161025/5abc33d4/attachment.html>


More information about the llvm-dev mailing list