<div dir="ltr">Adrian - looks like LangRef didn't get updated when DIGlobalVariableExpression was introduced - could you add a little info there?<br><br>Peng - yeah, looks like the documentation is a bit out of date, no worries.<br><br>DIGlobalVariableExpressions are referenced from LLVM global variables, eg:<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">@x = dso_local global i32 3, align 4, !dbg !0</div><div dir="ltr" class="gmail_attr">!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())<br><br>One where there is an empty DIExpression means that the underlying LLVM IR global describes the whole source level global variable - the value doesn't need to be modified at all to represent the source variable.<br><br>If an expression is involved, that expression (possibly along with the underlying LLVM IR global variable) is used to compute the value of the source level global variable. (in the example you have - there may not be any LLVM IR global variable at all - just the expression computing the constant value of the source level global variable - but in other cases, say if a big constant that only holds a few different values is optimized into a lookup table (rather than storing a big integer, just store 0 or 1, if it's 0 that means teh value is XXXXXXX, if the value is 1 that means the value is YYYYYY) it might be a combination, using the LLVM IR global variable to compute the source level value)<br><br>On Sat, Jan 19, 2019 at 6:25 PM Peng Yu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I don't find DIGlobalVariableExpression in langref. Should it be<br>
documented? Could anybody explain what it is?<br>
<br>
<a href="https://llvm.org/docs/LangRef.html" rel="noreferrer" target="_blank">https://llvm.org/docs/LangRef.html</a><br>
<br>
In one ll file converted from bitcode, I mostly see something like this.<br>
<br>
!8273 = !DIGlobalVariableExpression(var: !8274, expr: !DIExpression())<br>
<br>
Only one looks like this.<br>
<br>
!8945 = !DIGlobalVariableExpression(var: !8946, expr:<br>
!DIExpression(DW_OP_constu, 44, DW_OP_stack_value))<br>
<br>
Why DIExpression is mostly empty?<br>
<br>
-- <br>
Regards,<br>
Peng<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>