@@ -138,24 +138,27 @@ using VarLocSet = CoalescingBitVector<uint64_t>;
138
138
// / to find the open VarLocs killed by a register def very quickly. This is a
139
139
// / performance-critical operation for LiveDebugValues.
140
140
struct LocIndex {
141
- uint32_t Location; // Physical registers live in the range [1;2^30) (see
142
- // \ref MCRegister), so we have plenty of range left here
143
- // to encode non-register locations.
144
- uint32_t Index;
141
+ using u32_location_t = uint32_t ;
142
+ using u32_index_t = uint32_t ;
143
+
144
+ u32_location_t Location; // Physical registers live in the range [1;2^30) (see
145
+ // \ref MCRegister), so we have plenty of range left
146
+ // here to encode non-register locations.
147
+ u32_index_t Index;
145
148
146
149
// / The first location greater than 0 that is not reserved for VarLocs of
147
150
// / kind RegisterKind.
148
- static constexpr uint32_t kFirstInvalidRegLocation = 1 << 30 ;
151
+ static constexpr u32_location_t kFirstInvalidRegLocation = 1 << 30 ;
149
152
150
153
// / A special location reserved for VarLocs of kind SpillLocKind.
151
- static constexpr uint32_t kSpillLocation = kFirstInvalidRegLocation ;
154
+ static constexpr u32_location_t kSpillLocation = kFirstInvalidRegLocation ;
152
155
153
156
// / A special location reserved for VarLocs of kind EntryValueBackupKind and
154
157
// / EntryValueCopyBackupKind.
155
- static constexpr uint32_t kEntryValueBackupLocation =
158
+ static constexpr u32_location_t kEntryValueBackupLocation =
156
159
kFirstInvalidRegLocation + 1 ;
157
160
158
- LocIndex (uint32_t Location, uint32_t Index)
161
+ LocIndex (u32_location_t Location, u32_index_t Index)
159
162
: Location(Location), Index(Index) {}
160
163
161
164
uint64_t getAsRawInteger () const {
@@ -166,7 +169,8 @@ struct LocIndex {
166
169
static_assert (std::is_unsigned<IntT>::value &&
167
170
sizeof (ID) == sizeof (uint64_t ),
168
171
" Cannot convert raw integer to LocIndex" );
169
- return {static_cast <uint32_t >(ID >> 32 ), static_cast <uint32_t >(ID)};
172
+ return {static_cast <u32_location_t >(ID >> 32 ),
173
+ static_cast <u32_index_t >(ID)};
170
174
}
171
175
172
176
// / Get the start of the interval reserved for VarLocs of kind RegisterKind
@@ -177,7 +181,8 @@ struct LocIndex {
177
181
178
182
// / Return a range covering all set indices in the interval reserved for
179
183
// / \p Location in \p Set.
180
- static auto indexRangeForLocation (const VarLocSet &Set, uint32_t Location) {
184
+ static auto indexRangeForLocation (const VarLocSet &Set,
185
+ u32_location_t Location) {
181
186
uint64_t Start = LocIndex (Location, 0 ).getAsRawInteger ();
182
187
uint64_t End = LocIndex (Location + 1 , 0 ).getAsRawInteger ();
183
188
return Set.half_open_range (Start, End);
@@ -490,14 +495,14 @@ class LiveDebugValues : public MachineFunctionPass {
490
495
class VarLocMap {
491
496
// / Map a VarLoc to an index within the vector reserved for its location
492
497
// / within Loc2Vars.
493
- std::map<VarLoc, uint32_t > Var2Index;
498
+ std::map<VarLoc, LocIndex:: u32_index_t > Var2Index;
494
499
495
500
// / Map a location to a vector which holds VarLocs which live in that
496
501
// / location.
497
- SmallDenseMap<uint32_t , std::vector<VarLoc>> Loc2Vars;
502
+ SmallDenseMap<LocIndex:: u32_location_t , std::vector<VarLoc>> Loc2Vars;
498
503
499
504
// / Determine the 32-bit location reserved for \p VL, based on its kind.
500
- static uint32_t getLocationForVar (const VarLoc &VL) {
505
+ static LocIndex:: u32_location_t getLocationForVar (const VarLoc &VL) {
501
506
switch (VL.Kind ) {
502
507
case VarLoc::RegisterKind:
503
508
assert ((VL.Loc .RegNo < LocIndex::kFirstInvalidRegLocation ) &&
@@ -516,8 +521,8 @@ class LiveDebugValues : public MachineFunctionPass {
516
521
public:
517
522
// / Retrieve a unique LocIndex for \p VL.
518
523
LocIndex insert (const VarLoc &VL) {
519
- uint32_t Location = getLocationForVar (VL);
520
- uint32_t &Index = Var2Index[VL];
524
+ LocIndex:: u32_location_t Location = getLocationForVar (VL);
525
+ LocIndex:: u32_index_t &Index = Var2Index[VL];
521
526
if (!Index) {
522
527
auto &Vars = Loc2Vars[Location];
523
528
Vars.push_back (VL);
0 commit comments