@@ -35,11 +35,11 @@ class MachineInstr;
35
35
class MachineRegisterInfo ;
36
36
class RegisterClassInfo ;
37
37
38
- struct RegisterMaskPair {
38
+ struct VRegMaskOrUnit {
39
39
Register RegUnit; // /< Virtual register or register unit.
40
40
LaneBitmask LaneMask;
41
41
42
- RegisterMaskPair (Register RegUnit, LaneBitmask LaneMask)
42
+ VRegMaskOrUnit (Register RegUnit, LaneBitmask LaneMask)
43
43
: RegUnit(RegUnit), LaneMask(LaneMask) {}
44
44
};
45
45
@@ -49,8 +49,8 @@ struct RegisterPressure {
49
49
std::vector<unsigned > MaxSetPressure;
50
50
51
51
// / List of live in virtual registers or physical register units.
52
- SmallVector<RegisterMaskPair, 8 > LiveInRegs;
53
- SmallVector<RegisterMaskPair, 8 > LiveOutRegs;
52
+ SmallVector<VRegMaskOrUnit, 8 > LiveInRegs;
53
+ SmallVector<VRegMaskOrUnit, 8 > LiveOutRegs;
54
54
55
55
void dump (const TargetRegisterInfo *TRI) const ;
56
56
};
@@ -166,13 +166,13 @@ class PressureDiff {
166
166
class RegisterOperands {
167
167
public:
168
168
// / List of virtual registers and register units read by the instruction.
169
- SmallVector<RegisterMaskPair , 8 > Uses;
169
+ SmallVector<VRegMaskOrUnit , 8 > Uses;
170
170
// / List of virtual registers and register units defined by the
171
171
// / instruction which are not dead.
172
- SmallVector<RegisterMaskPair , 8 > Defs;
172
+ SmallVector<VRegMaskOrUnit , 8 > Defs;
173
173
// / List of virtual registers and register units defined by the
174
174
// / instruction but dead.
175
- SmallVector<RegisterMaskPair , 8 > DeadDefs;
175
+ SmallVector<VRegMaskOrUnit , 8 > DeadDefs;
176
176
177
177
// / Analyze the given instruction \p MI and fill in the Uses, Defs and
178
178
// / DeadDefs list based on the MachineOperand flags.
@@ -185,7 +185,7 @@ class RegisterOperands {
185
185
void detectDeadDefs (const MachineInstr &MI, const LiveIntervals &LIS);
186
186
187
187
// / Use liveness information to find out which uses/defs are partially
188
- // / undefined/dead and adjust the RegisterMaskPairs accordingly.
188
+ // / undefined/dead and adjust the VRegMaskOrUnits accordingly.
189
189
// / If \p AddFlagsMI is given then missing read-undef and dead flags will be
190
190
// / added to the instruction.
191
191
void adjustLaneLiveness (const LiveIntervals &LIS,
@@ -303,7 +303,7 @@ class LiveRegSet {
303
303
304
304
// / Mark the \p Pair.LaneMask lanes of \p Pair.Reg as live.
305
305
// / Returns the previously live lanes of \p Pair.Reg.
306
- LaneBitmask insert (RegisterMaskPair Pair) {
306
+ LaneBitmask insert (VRegMaskOrUnit Pair) {
307
307
unsigned SparseIndex = getSparseIndexFromReg (Pair.RegUnit );
308
308
auto InsertRes = Regs.insert (IndexMaskPair (SparseIndex, Pair.LaneMask ));
309
309
if (!InsertRes.second ) {
@@ -316,7 +316,7 @@ class LiveRegSet {
316
316
317
317
// / Clears the \p Pair.LaneMask lanes of \p Pair.Reg (mark them as dead).
318
318
// / Returns the previously live lanes of \p Pair.Reg.
319
- LaneBitmask erase (RegisterMaskPair Pair) {
319
+ LaneBitmask erase (VRegMaskOrUnit Pair) {
320
320
unsigned SparseIndex = getSparseIndexFromReg (Pair.RegUnit );
321
321
RegSet::iterator I = Regs.find (SparseIndex);
322
322
if (I == Regs.end ())
@@ -330,12 +330,11 @@ class LiveRegSet {
330
330
return Regs.size ();
331
331
}
332
332
333
- template <typename ContainerT>
334
- void appendTo (ContainerT &To) const {
333
+ void appendTo (SmallVectorImpl<VRegMaskOrUnit> &To) const {
335
334
for (const IndexMaskPair &P : Regs) {
336
335
Register Reg = getRegFromSparseIndex (P.Index );
337
336
if (P.LaneMask .any ())
338
- To.push_back ( RegisterMaskPair ( Reg, P.LaneMask ) );
337
+ To.emplace_back ( Reg, P.LaneMask );
339
338
}
340
339
}
341
340
};
@@ -409,7 +408,7 @@ class RegPressureTracker {
409
408
// / Force liveness of virtual registers or physical register
410
409
// / units. Particularly useful to initialize the livein/out state of the
411
410
// / tracker before the first call to advance/recede.
412
- void addLiveRegs (ArrayRef<RegisterMaskPair > Regs);
411
+ void addLiveRegs (ArrayRef<VRegMaskOrUnit > Regs);
413
412
414
413
// / Get the MI position corresponding to this register pressure.
415
414
MachineBasicBlock::const_iterator getPos () const { return CurrPos; }
@@ -421,14 +420,14 @@ class RegPressureTracker {
421
420
void setPos (MachineBasicBlock::const_iterator Pos) { CurrPos = Pos; }
422
421
423
422
// / Recede across the previous instruction.
424
- void recede (SmallVectorImpl<RegisterMaskPair > *LiveUses = nullptr );
423
+ void recede (SmallVectorImpl<VRegMaskOrUnit > *LiveUses = nullptr );
425
424
426
425
// / Recede across the previous instruction.
427
426
// / This "low-level" variant assumes that recedeSkipDebugValues() was
428
427
// / called previously and takes precomputed RegisterOperands for the
429
428
// / instruction.
430
429
void recede (const RegisterOperands &RegOpers,
431
- SmallVectorImpl<RegisterMaskPair > *LiveUses = nullptr );
430
+ SmallVectorImpl<VRegMaskOrUnit > *LiveUses = nullptr );
432
431
433
432
// / Recede until we find an instruction which is not a DebugValue.
434
433
void recedeSkipDebugValues ();
@@ -546,21 +545,21 @@ class RegPressureTracker {
546
545
547
546
protected:
548
547
// / Add Reg to the live out set and increase max pressure.
549
- void discoverLiveOut (RegisterMaskPair Pair);
548
+ void discoverLiveOut (VRegMaskOrUnit Pair);
550
549
// / Add Reg to the live in set and increase max pressure.
551
- void discoverLiveIn (RegisterMaskPair Pair);
550
+ void discoverLiveIn (VRegMaskOrUnit Pair);
552
551
553
552
// / Get the SlotIndex for the first nondebug instruction including or
554
553
// / after the current position.
555
554
SlotIndex getCurrSlot () const ;
556
555
557
- void bumpDeadDefs (ArrayRef<RegisterMaskPair > DeadDefs);
556
+ void bumpDeadDefs (ArrayRef<VRegMaskOrUnit > DeadDefs);
558
557
559
558
void bumpUpwardPressure (const MachineInstr *MI);
560
559
void bumpDownwardPressure (const MachineInstr *MI);
561
560
562
- void discoverLiveInOrOut (RegisterMaskPair Pair,
563
- SmallVectorImpl<RegisterMaskPair > &LiveInOrOut);
561
+ void discoverLiveInOrOut (VRegMaskOrUnit Pair,
562
+ SmallVectorImpl<VRegMaskOrUnit > &LiveInOrOut);
564
563
565
564
LaneBitmask getLastUsedLanes (Register RegUnit, SlotIndex Pos) const ;
566
565
LaneBitmask getLiveLanesAt (Register RegUnit, SlotIndex Pos) const ;
0 commit comments