<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 25, 2016 at 1:48 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>>> In fact, it already works:<br>
>><br>
>> @foo = alias i64, inttoptr (i64 42 to i64*)<br>
>><br>
>> produces<br>
>><br>
>> foo = 42<br>
>><br>
>> Cheers,<br>
>> Rafael<br>
><br>
><br>
> Right, I should have brought up that we can already use aliases for<br>
> definitions -- that's what I've been using in my prototype. What I think we<br>
> need to decide on here is a representation for declarations. From that, I<br>
> think our representation for definitions should be clear. For example, I<br>
> think that if we decide to require GlobalConstant to have a pointer type, it<br>
> may be reasonable to use it only for declarations and to use GlobalAlias for<br>
> definitions. This I think would be analogous to the current state where a<br>
> GlobalAlias can be referenced by either a Function or a GlobalVariable.<br>
<br>
</span>So, for the declaration, do you expect to know the value? If not just<br>
a declaration to a GlobalVariable should be sufficient.<br></blockquote><div><br></div><div>Not on its own. We need some way to distinguish absolute symbols from regular symbols so that we know to create absolute relocations instead of PC-relative relocations in PIC mode. That's what I was doing in D25878 with !range metadata.</div><div><br></div><div>What I found odd about that representation is that we would have a global variable with metadata that says "by the way, this isn't actually a global variable". So I wanted to see if there was some representational fix for that.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Otherwise, can you use an available_externally alias?<br>
<br>
Since we are talking about the class hierarchy, it is somewhat<br>
annoying that there are function declaration and variable<br>
declarations. At the object level, there is only undefined symbols.<br></blockquote><div><br></div><div>Although that is strange, I think the point is to allow attributes on the declaration that allow optimizers to assume things about the pointer (e.g. is it a readnone function). You could imagine some separate ExternalSymbol global that is a sort of a discriminated union of the function/global attributes, but at that point there doesn't seem to be a benefit over the specialized function/global representations. I imagine that the "range" of the globalconst would be one such attribute in this case.</div><div><br></div><div>Thanks,</div></div><div>-- <br></div><div class="gmail-m_-5683674027531473225gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div>