[llvm-dev] [DebugInfo]: Representing constants in debug-info
Tomar, Sourabh Singh via llvm-dev
llvm-dev at lists.llvm.org
Tue Feb 9 21:54:22 PST 2021
[AMD Public Use]
Hi Everyone,
Is there a way of representing **constants** in LLVM debug-info ? Languages such as FORTRAN has constants
i.e, consider the following Fortran snippet
[...]
Module foo
Integer, parameter :: bar = 200 ! Constant
End module foo
[...]
A front-end may choose to emit as Global Constant in LLVM IR as:
[...]
@bar.. = internal constant i32 200
A naïve attempt to represent it as GlobalVariable(or constant) as
[...]
!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_consts, 200))
!8 = distinct !DIGlobalVariable(name: "bar", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true)
This will materialize in DWARF as:
0x0000004a: DW_TAG_variable
DW_AT_name ("bar")
...
DW_AT_location (DW_OP_addr 0x2007d4, DW_OP_consts +200) // This is incorrect, pointing to data section
[...]
Gfortran is representing this as: **DW_TAG_constant**
0x00000055: **DW_TAG_constant**
DW_AT_name ("bar")
...
DW_AT_type (0x0000006a "const integer(kind=4)")
DW_AT_external (true)
DW_AT_const_value (0xc8)
Do we have Metadata analog of (DW_TAG_constant) ? I think the primary question here is to how represent this ?
Any inputs appreciated!
Thanks.. much!
Sourabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210210/26897da4/attachment.html>
More information about the llvm-dev
mailing list