[llvm-dev] RFC: Extending DISubrange count field
Sander De Smalen via llvm-dev
llvm-dev at lists.llvm.org
Thu Jan 4 08:53:16 PST 2018
To improve debug information for variable length arrays (https://bugs.llvm.org/show_bug.cgi?id=30553) I have proposed some changes to Metadata IR's DISubrange node. To get some wider visibility on this, I'm sharing this as an RFC with llvm-dev.
The proposed change is to extend the 'count' field to also accept a Metadata node, rather than only accepting a signed integer. For example:
!10 = !DILocalVariable(name: "count", scope: !8, file: !6, line: 42, type: !9)
!11 = !DISubrange(count !10, lowerBound: 0)
^^^ references the local variable
This allows specifying the size of an array by referencing the DIE of a local variable that holds the size expression. Another reason to extend the count field is to specify the length with a DIExpression. For instance, we need this to specify the length of an SVE vector as a DWARF expression that is based on a (runtime defined) DWARF pseudo register.
Some preliminary feedback was that we may want to use something similar for lowerBound as well. Also Adrian suggested (https://reviews.llvm.org/D41697#966736) that it may be useful in general to reference Metadata nodes in DIExpressions if we ever need to combine local variables with DWARF expressions. Something like that might be needed to e.g. reference a value from an offset of a pointer when using an array descriptor, although I could use some suggestions on what DWARF code needs to be generated for this general case.
The whole patch-series can be found here:
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev