[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 11:29:50 PDT 2016


On Tue, Oct 25, 2016 at 5:49 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> >>> @foo = globalconst i32 42
> >>>
> >>>
> >>> This is equivalent to writing "foo = 42" in assembly?
> >>
> >>
> >> Yes.
> >
> >
> > Back in the day the idea was to use an alias whose ConstantExpr was
> > just 42. Would that work?
>
> In fact, it already works:
>
> @foo = alias i64, inttoptr (i64 42 to i64*)
>
> produces
>
> foo = 42
>
> Cheers,
> Rafael
>

Right, I should have brought up that we can already use aliases for
definitions -- that's what I've been using in my prototype. What I think we
need to decide on here is a representation for declarations. From that, I
think our representation for definitions should be clear. For example, I
think that if we decide to require GlobalConstant to have a pointer type,
it may be reasonable to use it only for declarations and to use GlobalAlias
for definitions. This I think would be analogous to the current state where
a GlobalAlias can be referenced by either a Function or a GlobalVariable.

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


More information about the llvm-dev mailing list