[llvm-dev] RFC: metadata attachments for global variables

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Fri May 6 14:10:47 PDT 2016


On Fri, May 6, 2016 at 2:09 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Fri, May 6, 2016 at 1:55 PM, Peter Collingbourne via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>>
>>
>> On Fri, May 6, 2016 at 1:21 PM, Duncan P. N. Exon Smith <
>> dexonsmith at apple.com> wrote:
>>
>>>
>>> > On 2016-May-06, at 13:17, Peter Collingbourne <peter at pcc.me.uk> wrote:
>>> >
>>> > Hi all,
>>> >
>>> > I'd like to add support for metadata attachments for global variables
>>> in the same way as we did for functions.
>>> >
>>> > Syntax would be pretty simple:
>>> > @foo = global i32 0, !foo !0, !bar !1
>>> > (the extra commas are required to disambiguate from a named metadata
>>> on the next line)
>>>
>>> SGTM.
>>>
>>> > Benefits:
>>> > 1) Lets us reverse the DIGlobalVariable -> GlobalVariable edge, which
>>> should hopefully clear the way for removing the llvm.dbg.cu named
>>> metadata node.
>>>
>>> A little harder than it sounds (need to somehow support a GlobalVariable
>>> that is RAUW'ed with a ConstantInt), but I think this is important to do.
>>>
>>
>> How can a GlobalVariable be replaced with a ConstantInt? Wouldn't that
>> just be an absolute address?
>>
>
> If the global variable has a known constant value & the address is never
> needed, then we might optimize away the storage and still want debug info
> describing the constant.
>

I'm not sure under what conditions, if any, that currently works - so this
may be more of a "nice to have" or "be good to think about how any future
design wouldn't preclude fixing this gap" sort of thing.

- David


>
>
>>
>> Thanks,
>> --
>> --
>> Peter
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160506/074835fa/attachment.html>


More information about the llvm-dev mailing list