[LiveDebugValues] Encode a location in VarLoc IDs, NFC [2/3]
authorVedant Kumar <vsk@apple.com>
Thu, 20 Feb 2020 17:40:27 +0000 (09:40 -0800)
committerVedant Kumar <vsk@apple.com>
Thu, 27 Feb 2020 20:39:47 +0000 (12:39 -0800)
commit210c4853de20c36da207dfc5f524e0d7f013eec4
treea71ac3958375a6d302985cf928bd38092b42424b
parentb0142cd9867d720375008969fd9555cc1a17c098
[LiveDebugValues] Encode a location in VarLoc IDs, NFC [2/3]

This is part 2 of a 3-part series to address a compile-time explosion
issue in LiveDebugValues.

---

Each VarLoc has a unique ID: this ID is used to look up a VarLoc in the
VarLocMap, and to virtually insert a VarLoc into a VarLocSet. Instead of
inserting the VarLoc /itself/ into the VarLocSet, we insert just the ID,
because this can be represented efficiently with a SparseBitVector.

This change introduces LocIndex, a layer of abstraction on top of VarLoc
IDs. Prior to this change, an ID was just an index into a vector. With
this change, an ID encodes both an index /and/ a register location. The
type-checker ensures that conversions to and from LocIndex are correct.

For the moment the register location is always 0 (undef). We have plenty
of bits left over to encode physregs, stack slots, and other locations
in the future.

Differential Revision: https://reviews.llvm.org/D74985
llvm/lib/CodeGen/LiveDebugValues.cpp