Peng Yu via llvm-dev
2019-Jan-20 02:24 UTC
[llvm-dev] DIGlobalVariableExpression doc in langref
Hi, I don't find DIGlobalVariableExpression in langref. Should it be documented? Could anybody explain what it is? https://llvm.org/docs/LangRef.html In one ll file converted from bitcode, I mostly see something like this. !8273 = !DIGlobalVariableExpression(var: !8274, expr: !DIExpression()) Only one looks like this. !8945 = !DIGlobalVariableExpression(var: !8946, expr: !DIExpression(DW_OP_constu, 44, DW_OP_stack_value)) Why DIExpression is mostly empty? -- Regards, Peng
David Blaikie via llvm-dev
2019-Jan-20 21:52 UTC
[llvm-dev] DIGlobalVariableExpression doc in langref
Adrian - looks like LangRef didn't get updated when DIGlobalVariableExpression was introduced - could you add a little info there? Peng - yeah, looks like the documentation is a bit out of date, no worries. DIGlobalVariableExpressions are referenced from LLVM global variables, eg: @x = dso_local global i32 3, align 4, !dbg !0 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 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. 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) On Sat, Jan 19, 2019 at 6:25 PM Peng Yu via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I don't find DIGlobalVariableExpression in langref. Should it be > documented? Could anybody explain what it is? > > https://llvm.org/docs/LangRef.html > > In one ll file converted from bitcode, I mostly see something like this. > > !8273 = !DIGlobalVariableExpression(var: !8274, expr: !DIExpression()) > > Only one looks like this. > > !8945 = !DIGlobalVariableExpression(var: !8946, expr: > !DIExpression(DW_OP_constu, 44, DW_OP_stack_value)) > > Why DIExpression is mostly empty? > > -- > Regards, > Peng > _______________________________________________ > 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/20190120/2d1e2959/attachment.html>
Peng Yu via llvm-dev
2019-Jan-20 22:45 UTC
[llvm-dev] DIGlobalVariableExpression doc in langref
Hi David,> 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)Do you have an example minimal .c file that can demonstrate this in action? This will make it easier to understand what you mean. -- Regards, Peng
Adrian Prantl via llvm-dev
2019-Jan-22 16:40 UTC
[llvm-dev] DIGlobalVariableExpression doc in langref
> On Jan 20, 2019, at 1:52 PM, David Blaikie <dblaikie at gmail.com> wrote: > > Adrian - looks like LangRef didn't get updated when DIGlobalVariableExpression was introduced - could you add a little info there?Done in r351837. -- adrian