[PATCH] D83890: [DebugInfo] Process DBG_VALUE_LIST in LiveDebugValues
Stephen Tozer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 10:58:08 PDT 2020
StephenTozer created this revision.
StephenTozer added reviewers: aprantl, probinson, vsk, djtodoro, dblaikie.
StephenTozer added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya, qcolombet.
Herald added a project: LLVM.
Continuing the work discussed in the RFC[0], this patch implements DBG_VALUE_LIST handling in the LiveDebugValues pass.
This is without question the largest change to a single pass in terms of both line count and complexity, largely due to the complexity of the pass and the extent to which it is currently coupled with single machine location variables. Although the line count for this change is high, the logical changes to the patch derive largely from a few basic changes.
First and foremost, the VarLocSet+VarLocMap model has changed:
Previously, VarLocMap acted as a simple bidirectional map between machine locations and VarLocs. Each VarLoc would be assigned a single unique LocIndex by VarLocMap, which could be used to look up that VarLoc in the map. This coupled with VarLocSet, which was a set of LocIndexes optimized for range lookups (using the CoalescingBitVector class). Due to how LocIndex was structured, this allowed VarLocSet to be used to look up every LocIndex associated with a given machine location - either a specific register, or one of several shared buckets for spill locations, entry values, entry value backups, or constants (undef or immediate). VarLocSet also supports all other basic set operations, and was used to track all live VarLocs at a given point.
In order to support DBG_VALUE_LIST, a few changes have been made to this model. VarLocMap no longer provides a single unique LocIndex for a VarLoc, but a set of them corresponding to each machine location used; a single VarLoc will still never have multiple indices in a single bucket, and every LocIndex of a VarLoc must be inserted into any associated VarLocSet. Any one of these indices can be used by itself to look up the VarLoc they are assigned to. Within this index set, every VarLoc has an index in the "constant" bucket; the purpose of this is to provide a means of looking up every current VarLoc in VarLocSet.
VarLocSet is no longer strictly a "set of VarLocs", but a set of LocIndexes (this probably warrants a name change), as each VarLoc may have multiple LocIndexes inserted into the VarLocSet. Functionally, this means that VarLocSet is used slightly differently; the methods for looking up every VarLoc that uses a given bucket (a specific register, spill location, entry value, or entry value backup) is unchanged. When looking up every active VarLoc, instead of fetching the entire set we simply fetch every LocIndex with Location=0 (the "constant" bucket), as every VarLoc appears exactly once in there. While these changes make up a significant bulk of the line count, there are few resulting changes outside of the functions that directly operate on VarLocSets - the signatures of these functions are mostly unchanged.
The other major change is the VarLoc class itself. This mostly consists of cleaning up its interface to work with multiple machine locations, as well as separating the old "Kind" enum into MachineLocKind (for machine locations) and EntryValueKind (describing the VarLoc as a whole). The majority of these changes are simply using more specific functions to do things that didn't need them before, such as replacing `if (VarLoc.getSpillLoc())` with `if (VarLoc.containsSpillLocs())`, or `if (VarLoc.getReg() == RegNo)` with `if (VarLoc.usesReg(RegNo)`.
[0] http://lists.llvm.org/pipermail/llvm-dev/2020-February/139376.html
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83890
Files:
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-clobber.mir
llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-join.mir
llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-movements.mir
llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-spillrestore.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83890.278233.patch
Type: text/x-patch
Size: 78753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/a8adae03/attachment.bin>
More information about the llvm-commits
mailing list