LLVM 24.0.0git
RegisterPressure.cpp
Go to the documentation of this file.
1//===- RegisterPressure.cpp - Dynamic Register Pressure -------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the RegisterPressure class which can be used to track
10// MachineInstr level register pressure.
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/ADT/ArrayRef.h"
16#include "llvm/ADT/STLExtras.h"
30#include "llvm/Config/llvm-config.h"
31#include "llvm/MC/LaneBitmask.h"
33#include "llvm/Support/Debug.h"
36#include <algorithm>
37#include <cassert>
38#include <cstdint>
39#include <cstdlib>
40#include <cstring>
41#include <iterator>
42#include <limits>
43#include <utility>
44#include <vector>
45
46using namespace llvm;
47
48/// Increase pressure for each pressure set provided by TargetRegisterInfo.
49static void increaseSetPressure(std::vector<unsigned> &CurrSetPressure,
50 const MachineRegisterInfo &MRI,
51 VirtRegOrUnit VRegOrUnit, LaneBitmask PrevMask,
52 LaneBitmask NewMask) {
53 assert((PrevMask & ~NewMask).none() && "Must not remove bits");
54 if (PrevMask.any() || NewMask.none())
55 return;
56
57 PSetIterator PSetI = MRI.getPressureSets(VRegOrUnit);
58 unsigned Weight = PSetI.getWeight();
59 for (; PSetI.isValid(); ++PSetI)
60 CurrSetPressure[*PSetI] += Weight;
61}
62
63/// Decrease pressure for each pressure set provided by TargetRegisterInfo.
64static void decreaseSetPressure(std::vector<unsigned> &CurrSetPressure,
65 const MachineRegisterInfo &MRI,
66 VirtRegOrUnit VRegOrUnit, LaneBitmask PrevMask,
67 LaneBitmask NewMask) {
68 assert((NewMask & ~PrevMask).none() && "Must not add bits");
69 if (NewMask.any() || PrevMask.none())
70 return;
71
72 PSetIterator PSetI = MRI.getPressureSets(VRegOrUnit);
73 unsigned Weight = PSetI.getWeight();
74 for (; PSetI.isValid(); ++PSetI) {
75 assert(CurrSetPressure[*PSetI] >= Weight && "register pressure underflow");
76 CurrSetPressure[*PSetI] -= Weight;
77 }
78}
79
80#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
83 const TargetRegisterInfo *TRI) {
84 for (unsigned i = 0, e = SetPressure.size(); i < e; ++i) {
85 if (SetPressure[i] != 0) {
86 dbgs() << TRI->getRegPressureSetName(i) << "=" << SetPressure[i] << ' ';
87 }
88 }
89 dbgs() << "\n";
90}
91
94 dbgs() << "Max Pressure: ";
96 dbgs() << "Live In: ";
97 for (const VRegMaskOrUnit &P : LiveInRegs) {
98 dbgs() << printVRegOrUnit(P.VRegOrUnit, TRI);
99 if (!P.LaneMask.all())
100 dbgs() << ':' << PrintLaneMask(P.LaneMask);
101 dbgs() << ' ';
102 }
103 dbgs() << '\n';
104 dbgs() << "Live Out: ";
105 for (const VRegMaskOrUnit &P : LiveOutRegs) {
106 dbgs() << printVRegOrUnit(P.VRegOrUnit, TRI);
107 if (!P.LaneMask.all())
108 dbgs() << ':' << PrintLaneMask(P.LaneMask);
109 dbgs() << ' ';
110 }
111 dbgs() << '\n';
112}
113
116 if (!isTopClosed() || !isBottomClosed()) {
117 dbgs() << "Curr Pressure: ";
118 dumpRegSetPressure(CurrSetPressure, TRI);
119 }
120 P.dump(TRI);
121}
122
125 const char *sep = "";
126 for (const PressureChange &Change : *this) {
127 if (!Change.isValid())
128 break;
129 dbgs() << sep << TRI.getRegPressureSetName(Change.getPSet())
130 << " " << Change.getUnitInc();
131 sep = " ";
132 }
133 dbgs() << '\n';
134}
135
138 dbgs() << "[" << getPSetOrMax() << ", " << getUnitInc() << "]\n";
139}
140
142 dbgs() << "[Excess=";
143 Excess.dump();
144 dbgs() << ", CriticalMax=";
145 CriticalMax.dump();
146 dbgs() << ", CurrentMax=";
147 CurrentMax.dump();
148 dbgs() << "]\n";
149}
150
151#endif
152
154 LaneBitmask PreviousMask,
155 LaneBitmask NewMask) {
156 if (PreviousMask.any() || NewMask.none())
157 return;
158
159 PSetIterator PSetI = MRI->getPressureSets(VRegOrUnit);
160 unsigned Weight = PSetI.getWeight();
161 for (; PSetI.isValid(); ++PSetI) {
162 CurrSetPressure[*PSetI] += Weight;
163 P.MaxSetPressure[*PSetI] =
164 std::max(P.MaxSetPressure[*PSetI], CurrSetPressure[*PSetI]);
165 }
166}
167
169 LaneBitmask PreviousMask,
170 LaneBitmask NewMask) {
171 decreaseSetPressure(CurrSetPressure, *MRI, VRegOrUnit, PreviousMask, NewMask);
172}
173
174/// Clear the result so it can be used for another round of pressure tracking.
177 MaxSetPressure.clear();
178 LiveInRegs.clear();
179 LiveOutRegs.clear();
180}
181
182/// Clear the result so it can be used for another round of pressure tracking.
189
190/// If the current top is not less than or equal to the next index, open it.
191/// We happen to need the SlotIndex for the next top for pressure update.
193 if (TopIdx <= NextTop)
194 return;
195 TopIdx = SlotIndex();
196 LiveInRegs.clear();
197}
198
199/// If the current top is the previous instruction (before receding), open it.
201 if (TopPos != PrevTop)
202 return;
204 LiveInRegs.clear();
205}
206
207/// If the current bottom is not greater than the previous index, open it.
209 if (BottomIdx > PrevBottom)
210 return;
212 LiveInRegs.clear();
213}
214
215/// If the current bottom is the previous instr (before advancing), open it.
217 if (BottomPos != PrevBottom)
218 return;
220 LiveInRegs.clear();
221}
222
225 unsigned NumRegUnits = TRI.getNumRegs();
226 unsigned NumVirtRegs = MRI.getNumVirtRegs();
227 Regs.setUniverse(NumRegUnits + NumVirtRegs);
228 this->NumRegUnits = NumRegUnits;
229}
230
232 Regs.clear();
233}
234
235static const LiveRange *getLiveRange(const LiveIntervals &LIS,
236 VirtRegOrUnit VRegOrUnit) {
237 if (VRegOrUnit.isVirtualReg())
238 return &LIS.getInterval(VRegOrUnit.asVirtualReg());
239 return LIS.getCachedRegUnit(VRegOrUnit.asMCRegUnit());
240}
241
243 MBB = nullptr;
244 LIS = nullptr;
245
246 CurrSetPressure.clear();
247 LiveThruPressure.clear();
248 P.MaxSetPressure.clear();
249
250 if (RequireIntervals)
251 static_cast<IntervalPressure&>(P).reset();
252 else
253 static_cast<RegionPressure&>(P).reset();
254
255 LiveRegs.clear();
256 UntiedDefs.clear();
257}
258
259/// Setup the RegPressureTracker.
260///
261/// TODO: Add support for pressure without LiveIntervals.
263 const RegisterClassInfo *rci,
264 const LiveIntervals *lis,
265 const MachineBasicBlock *mbb,
267 bool TrackLaneMasks, bool TrackUntiedDefs) {
268 reset();
269
270 MF = mf;
271 TRI = MF->getSubtarget().getRegisterInfo();
272 RCI = rci;
273 MRI = &MF->getRegInfo();
274 MBB = mbb;
275 this->TrackUntiedDefs = TrackUntiedDefs;
276 this->TrackLaneMasks = TrackLaneMasks;
277
278 if (RequireIntervals) {
279 assert(lis && "IntervalPressure requires LiveIntervals");
280 LIS = lis;
281 }
282
283 CurrPos = pos;
284 CurrSetPressure.assign(TRI->getNumRegPressureSets(), 0);
285
286 P.MaxSetPressure = CurrSetPressure;
287
288 LiveRegs.init(*MRI);
289 if (TrackUntiedDefs)
290 UntiedDefs.setUniverse(MRI->getNumVirtRegs());
291}
292
293/// Does this pressure result have a valid top position and live ins.
295 if (RequireIntervals)
296 return static_cast<IntervalPressure&>(P).TopIdx.isValid();
297 return (static_cast<RegionPressure&>(P).TopPos ==
299}
300
301/// Does this pressure result have a valid bottom position and live outs.
303 if (RequireIntervals)
304 return static_cast<IntervalPressure&>(P).BottomIdx.isValid();
305 return (static_cast<RegionPressure&>(P).BottomPos ==
307}
308
311 skipDebugInstructionsForward(CurrPos, MBB->end());
312 if (IdxPos == MBB->end())
313 return LIS->getMBBEndIdx(MBB);
314 return LIS->getInstructionIndex(*IdxPos).getRegSlot();
315}
316
317/// Set the boundary for the top of the region and summarize live ins.
319 if (RequireIntervals)
320 static_cast<IntervalPressure&>(P).TopIdx = getCurrSlot();
321 else
322 static_cast<RegionPressure&>(P).TopPos = CurrPos;
323
324 assert(P.LiveInRegs.empty() && "inconsistent max pressure result");
325 P.LiveInRegs.reserve(LiveRegs.size());
326 LiveRegs.appendTo(P.LiveInRegs);
327}
328
329/// Set the boundary for the bottom of the region and summarize live outs.
331 if (RequireIntervals)
332 static_cast<IntervalPressure&>(P).BottomIdx = getCurrSlot();
333 else
334 static_cast<RegionPressure&>(P).BottomPos = CurrPos;
335
336 assert(P.LiveOutRegs.empty() && "inconsistent max pressure result");
337 P.LiveOutRegs.reserve(LiveRegs.size());
338 LiveRegs.appendTo(P.LiveOutRegs);
339}
340
341/// Finalize the region boundaries and record live ins and live outs.
343 if (!isTopClosed() && !isBottomClosed()) {
344 assert(LiveRegs.size() == 0 && "no region boundary");
345 return;
346 }
347 if (!isBottomClosed())
348 closeBottom();
349 else if (!isTopClosed())
350 closeTop();
351 // If both top and bottom are closed, do nothing.
352}
353
354/// The register tracker is unaware of global liveness so ignores normal
355/// live-thru ranges. However, two-address or coalesced chains can also lead
356/// to live ranges with no holes. Count these to inform heuristics that we
357/// can never drop below this pressure.
359 LiveThruPressure.assign(TRI->getNumRegPressureSets(), 0);
360 assert(isBottomClosed() && "need bottom-up tracking to initialize.");
361 for (const VRegMaskOrUnit &Pair : P.LiveOutRegs) {
362 VirtRegOrUnit VRegOrUnit = Pair.VRegOrUnit;
363 if (VRegOrUnit.isVirtualReg() &&
364 !RPTracker.hasUntiedDef(VRegOrUnit.asVirtualReg()))
365 increaseSetPressure(LiveThruPressure, *MRI, VRegOrUnit,
367 }
368}
369
371 VirtRegOrUnit VRegOrUnit) {
372 auto I = llvm::find_if(RegUnits, [VRegOrUnit](const VRegMaskOrUnit Other) {
373 return Other.VRegOrUnit == VRegOrUnit;
374 });
375 if (I == RegUnits.end())
376 return LaneBitmask::getNone();
377 return I->LaneMask;
378}
379
381 VRegMaskOrUnit Pair) {
382 VirtRegOrUnit VRegOrUnit = Pair.VRegOrUnit;
383 assert(Pair.LaneMask.any());
384 auto I = llvm::find_if(RegUnits, [VRegOrUnit](const VRegMaskOrUnit Other) {
385 return Other.VRegOrUnit == VRegOrUnit;
386 });
387 if (I == RegUnits.end()) {
388 RegUnits.push_back(Pair);
389 } else {
390 I->LaneMask |= Pair.LaneMask;
391 }
392}
393
395 VirtRegOrUnit VRegOrUnit) {
396 auto I = llvm::find_if(RegUnits, [VRegOrUnit](const VRegMaskOrUnit Other) {
397 return Other.VRegOrUnit == VRegOrUnit;
398 });
399 if (I == RegUnits.end()) {
400 RegUnits.emplace_back(VRegOrUnit, LaneBitmask::getNone());
401 } else {
402 I->LaneMask = LaneBitmask::getNone();
403 }
404}
405
407 VRegMaskOrUnit Pair) {
408 VirtRegOrUnit VRegOrUnit = Pair.VRegOrUnit;
409 assert(Pair.LaneMask.any());
410 auto I = llvm::find_if(RegUnits, [VRegOrUnit](const VRegMaskOrUnit Other) {
411 return Other.VRegOrUnit == VRegOrUnit;
412 });
413 if (I != RegUnits.end()) {
414 I->LaneMask &= ~Pair.LaneMask;
415 if (I->LaneMask.none())
416 RegUnits.erase(I);
417 }
418}
419
420static LaneBitmask
422 bool TrackLaneMasks, VirtRegOrUnit VRegOrUnit,
423 SlotIndex Pos, LaneBitmask SafeDefault,
424 bool (*Property)(const LiveRange &LR, SlotIndex Pos)) {
425 if (VRegOrUnit.isVirtualReg()) {
426 const LiveInterval &LI = LIS.getInterval(VRegOrUnit.asVirtualReg());
427 LaneBitmask Result;
428 if (TrackLaneMasks && LI.hasSubRanges()) {
429 for (const LiveInterval::SubRange &SR : LI.subranges()) {
430 if (Property(SR, Pos))
431 Result |= SR.LaneMask;
432 }
433 } else if (Property(LI, Pos)) {
434 Result = TrackLaneMasks
435 ? MRI.getMaxLaneMaskForVReg(VRegOrUnit.asVirtualReg())
437 }
438
439 return Result;
440 } else {
441 const LiveRange *LR = LIS.getCachedRegUnit(VRegOrUnit.asMCRegUnit());
442 // Be prepared for missing liveranges: We usually do not compute liveranges
443 // for physical registers on targets with many registers (GPUs).
444 if (LR == nullptr)
445 return SafeDefault;
446 return Property(*LR, Pos) ? LaneBitmask::getAll() : LaneBitmask::getNone();
447 }
448}
449
451 const MachineRegisterInfo &MRI,
452 bool TrackLaneMasks, VirtRegOrUnit VRegOrUnit,
453 SlotIndex Pos) {
455 LIS, MRI, TrackLaneMasks, VRegOrUnit, Pos, LaneBitmask::getAll(),
456 [](const LiveRange &LR, SlotIndex Pos) { return LR.liveAt(Pos); });
457}
458
459namespace {
460
461/// Collect this instruction's unique uses and defs into SmallVectors for
462/// processing defs and uses in order.
463///
464/// FIXME: always ignore tied opers
465class RegisterOperandsCollector {
466 friend class llvm::RegisterOperands;
467
468 RegisterOperands &RegOpers;
469 const TargetRegisterInfo &TRI;
470 const MachineRegisterInfo &MRI;
471 bool IgnoreDead;
472
473 RegisterOperandsCollector(RegisterOperands &RegOpers,
474 const TargetRegisterInfo &TRI,
475 const MachineRegisterInfo &MRI, bool IgnoreDead)
476 : RegOpers(RegOpers), TRI(TRI), MRI(MRI), IgnoreDead(IgnoreDead) {}
477
478 void collectInstr(const MachineInstr &MI) const {
479 for (ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI)
480 collectOperand(*OperI);
481
482 // Remove redundant physreg dead defs.
483 for (const VRegMaskOrUnit &P : RegOpers.Defs)
484 removeRegLanes(RegOpers.DeadDefs, P);
485 }
486
487 void collectInstrLanes(const MachineInstr &MI) const {
488 for (ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI)
489 collectOperandLanes(*OperI);
490
491 // Remove redundant physreg dead defs.
492 for (const VRegMaskOrUnit &P : RegOpers.Defs)
493 removeRegLanes(RegOpers.DeadDefs, P);
494 }
495
496 /// Push this operand's register onto the correct vectors.
497 void collectOperand(const MachineOperand &MO) const {
498 if (!MO.isReg() || !MO.getReg())
499 return;
500 Register Reg = MO.getReg();
501 if (MO.isUse()) {
502 if (!MO.isUndef() && !MO.isInternalRead())
503 pushReg(Reg, RegOpers.Uses);
504 } else {
505 assert(MO.isDef());
506 // Subregister definitions may imply a register read.
507 if (MO.readsReg())
508 pushReg(Reg, RegOpers.Uses);
509
510 if (MO.isDead()) {
511 if (!IgnoreDead)
512 pushReg(Reg, RegOpers.DeadDefs);
513 } else
514 pushReg(Reg, RegOpers.Defs);
515 }
516 }
517
518 void pushReg(Register Reg, SmallVectorImpl<VRegMaskOrUnit> &RegUnits) const {
519 if (Reg.isVirtual()) {
520 addRegLanes(RegUnits,
521 VRegMaskOrUnit(VirtRegOrUnit(Reg), LaneBitmask::getAll()));
522 } else if (MRI.isAllocatable(Reg)) {
523 for (MCRegUnit Unit : TRI.regunits(Reg.asMCReg()))
524 addRegLanes(RegUnits,
525 VRegMaskOrUnit(VirtRegOrUnit(Unit), LaneBitmask::getAll()));
526 }
527 }
528
529 void collectOperandLanes(const MachineOperand &MO) const {
530 if (!MO.isReg() || !MO.getReg())
531 return;
532 Register Reg = MO.getReg();
533 unsigned SubRegIdx = MO.getSubReg();
534 if (MO.isUse()) {
535 if (!MO.isUndef() && !MO.isInternalRead())
536 pushRegLanes(Reg, SubRegIdx, RegOpers.Uses);
537 } else {
538 assert(MO.isDef());
539 // Treat read-undef subreg defs as definitions of the whole register.
540 if (MO.isUndef())
541 SubRegIdx = 0;
542
543 if (MO.isDead()) {
544 if (!IgnoreDead)
545 pushRegLanes(Reg, SubRegIdx, RegOpers.DeadDefs);
546 } else
547 pushRegLanes(Reg, SubRegIdx, RegOpers.Defs);
548 }
549 }
550
551 void pushRegLanes(Register Reg, unsigned SubRegIdx,
552 SmallVectorImpl<VRegMaskOrUnit> &RegUnits) const {
553 if (Reg.isVirtual()) {
554 LaneBitmask LaneMask = SubRegIdx != 0
555 ? TRI.getSubRegIndexLaneMask(SubRegIdx)
557 addRegLanes(RegUnits, VRegMaskOrUnit(VirtRegOrUnit(Reg), LaneMask));
558 } else if (MRI.isAllocatable(Reg)) {
559 for (MCRegUnit Unit : TRI.regunits(Reg.asMCReg()))
560 addRegLanes(RegUnits,
561 VRegMaskOrUnit(VirtRegOrUnit(Unit), LaneBitmask::getAll()));
562 }
563 }
564};
565
566} // end anonymous namespace
567
569 const TargetRegisterInfo &TRI,
570 const MachineRegisterInfo &MRI,
571 bool TrackLaneMasks, bool IgnoreDead) {
572 RegisterOperandsCollector Collector(*this, TRI, MRI, IgnoreDead);
573 if (TrackLaneMasks)
574 Collector.collectInstrLanes(MI);
575 else
576 Collector.collectInstr(MI);
577}
578
580 const LiveIntervals &LIS) {
581 SlotIndex SlotIdx = LIS.getInstructionIndex(MI);
582 for (auto *RI = Defs.begin(); RI != Defs.end(); /*empty*/) {
583 const LiveRange *LR = getLiveRange(LIS, RI->VRegOrUnit);
584 if (LR != nullptr) {
585 LiveQueryResult LRQ = LR->Query(SlotIdx);
586 if (LRQ.isDeadDef()) {
587 // LiveIntervals knows this is a dead even though it's MachineOperand is
588 // not flagged as such.
589 DeadDefs.push_back(*RI);
590 RI = Defs.erase(RI);
591 continue;
592 }
593 }
594 ++RI;
595 }
596}
597
599 const MachineRegisterInfo &MRI,
600 SlotIndex Pos) {
601 for (auto *I = Defs.begin(); I != Defs.end(); /*empty*/) {
602 LaneBitmask LiveAfter = getLiveLanesAt(LIS, MRI, /*TrackLaneMasks=*/true,
603 I->VRegOrUnit, Pos.getDeadSlot());
604 I = adjustDef(*I, LiveAfter);
605 }
606 adjustUses(LIS, MRI, Pos.getBaseIndex());
607}
608
610 const MachineRegisterInfo &MRI,
611 MachineInstr &MI) {
613 for (auto *I = Defs.begin(); I != Defs.end(); /*empty*/) {
614 LaneBitmask LiveAfter = getLiveLanesAt(LIS, MRI, /*TrackLaneMasks=*/true,
615 I->VRegOrUnit, Pos.getDeadSlot());
616 // If the def is all that is live after the instruction, then in case
617 // of a subregister def we need a read-undef flag.
618 VirtRegOrUnit VRegOrUnit = I->VRegOrUnit;
619 if (VRegOrUnit.isVirtualReg() && (LiveAfter & ~I->LaneMask).none())
620 MI.setRegisterDefReadUndef(VRegOrUnit.asVirtualReg());
621 I = adjustDef(*I, LiveAfter);
622 }
623
624 adjustUses(LIS, MRI, Pos);
625
626 for (const VRegMaskOrUnit &P : DeadDefs) {
627 VirtRegOrUnit VRegOrUnit = P.VRegOrUnit;
628 if (!VRegOrUnit.isVirtualReg())
629 continue;
630 LaneBitmask LiveAfter = getLiveLanesAt(LIS, MRI, /*TrackLaneMasks=*/true,
631 VRegOrUnit, Pos.getDeadSlot());
632 if (LiveAfter.none())
633 MI.setRegisterDefReadUndef(VRegOrUnit.asVirtualReg());
634 }
635}
636
637VRegMaskOrUnit *RegisterOperands::adjustDef(VRegMaskOrUnit &Def,
638 LaneBitmask LiveAfterDef) {
639 LaneBitmask ActualDef = Def.LaneMask & LiveAfterDef;
640 if (ActualDef.none())
641 return Defs.erase(&Def);
642
643 Def.LaneMask = ActualDef;
644 return &Def + 1;
645}
646
647void RegisterOperands::adjustUses(const LiveIntervals &LIS,
648 const MachineRegisterInfo &MRI,
649 SlotIndex Pos) {
650 for (auto &[VRegOrUnit, LaneMask] : Uses) {
651 LaneMask =
652 getLiveLanesAt(LIS, MRI, /*TrackLaneMasks=*/true, VRegOrUnit, Pos);
653 }
654}
655
656/// Initialize an array of N PressureDiffs.
657void PressureDiffs::init(unsigned N) {
658 Size = N;
659 if (N <= Max) {
660 memset(PDiffArray, 0, N * sizeof(PressureDiff));
661 return;
662 }
663 Max = Size;
664 free(PDiffArray);
665 PDiffArray = static_cast<PressureDiff*>(safe_calloc(N, sizeof(PressureDiff)));
666}
667
669 const RegisterOperands &RegOpers,
670 const MachineRegisterInfo &MRI) {
671 PressureDiff &PDiff = (*this)[Idx];
672 assert(!PDiff.begin()->isValid() && "stale PDiff");
673 for (const VRegMaskOrUnit &P : RegOpers.Defs)
674 PDiff.addPressureChange(P.VRegOrUnit, true, &MRI);
675
676 for (const VRegMaskOrUnit &P : RegOpers.Uses)
677 PDiff.addPressureChange(P.VRegOrUnit, false, &MRI);
678}
679
680/// Add a change in pressure to the pressure diff of a given instruction.
682 const MachineRegisterInfo *MRI) {
683 PSetIterator PSetI = MRI->getPressureSets(VRegOrUnit);
684 int Weight = IsDec ? -PSetI.getWeight() : PSetI.getWeight();
685 for (; PSetI.isValid(); ++PSetI) {
686 // Find an existing entry in the pressure diff for this PSet.
687 PressureDiff::iterator I = nonconst_begin(), E = nonconst_end();
688 for (; I != E && I->isValid(); ++I) {
689 if (I->getPSet() >= *PSetI)
690 break;
691 }
692 // If all pressure sets are more constrained, skip the remaining PSets.
693 if (I == E)
694 break;
695 // Insert this PressureChange.
696 if (!I->isValid() || I->getPSet() != *PSetI) {
697 PressureChange PTmp = PressureChange(*PSetI);
698 for (PressureDiff::iterator J = I; J != E && PTmp.isValid(); ++J)
699 std::swap(*J, PTmp);
700 }
701 // Update the units for this pressure set.
702 unsigned NewUnitInc = I->getUnitInc() + Weight;
703 if (NewUnitInc != 0) {
704 I->setUnitInc(NewUnitInc);
705 } else {
706 // Remove entry
707 PressureDiff::iterator J;
708 for (J = std::next(I); J != E && J->isValid(); ++J, ++I)
709 *I = *J;
710 *I = PressureChange();
711 }
712 }
713}
714
715/// Force liveness of registers.
717 for (const VRegMaskOrUnit &P : Regs) {
718 LaneBitmask PrevMask = LiveRegs.insert(P);
719 LaneBitmask NewMask = PrevMask | P.LaneMask;
720 increaseRegPressure(P.VRegOrUnit, PrevMask, NewMask);
721 }
722}
723
726 assert(Pair.LaneMask.any());
727
728 VirtRegOrUnit VRegOrUnit = Pair.VRegOrUnit;
729 auto I = find_if(LiveInOrOut, [VRegOrUnit](const VRegMaskOrUnit &Other) {
730 return Other.VRegOrUnit == VRegOrUnit;
731 });
732 LaneBitmask PrevMask;
733 LaneBitmask NewMask;
734 if (I == LiveInOrOut.end()) {
735 PrevMask = LaneBitmask::getNone();
736 NewMask = Pair.LaneMask;
737 LiveInOrOut.push_back(Pair);
738 } else {
739 PrevMask = I->LaneMask;
740 NewMask = PrevMask | Pair.LaneMask;
741 I->LaneMask = NewMask;
742 }
743 increaseSetPressure(P.MaxSetPressure, *MRI, VRegOrUnit, PrevMask, NewMask);
744}
745
749
753
755 for (const VRegMaskOrUnit &P : DeadDefs) {
756 LaneBitmask LiveMask = LiveRegs.contains(P.VRegOrUnit);
757 LaneBitmask BumpedMask = LiveMask | P.LaneMask;
758 increaseRegPressure(P.VRegOrUnit, LiveMask, BumpedMask);
759 }
760 for (const VRegMaskOrUnit &P : DeadDefs) {
761 LaneBitmask LiveMask = LiveRegs.contains(P.VRegOrUnit);
762 LaneBitmask BumpedMask = LiveMask | P.LaneMask;
763 decreaseRegPressure(P.VRegOrUnit, BumpedMask, LiveMask);
764 }
765}
766
767/// Recede across the previous instruction. If LiveUses is provided, record any
768/// RegUnits that are made live by the current instruction's uses. This includes
769/// registers that are both defined and used by the instruction. If a pressure
770/// difference pointer is provided record the changes is pressure caused by this
771/// instruction independent of liveness.
774 assert(!CurrPos->isDebugOrPseudoInstr());
775
776 // Boost pressure for all dead defs together.
777 bumpDeadDefs(RegOpers.DeadDefs);
778
779 // Kill liveness at live defs.
780 // TODO: consider earlyclobbers?
781 for (const VRegMaskOrUnit &Def : RegOpers.Defs) {
782 VirtRegOrUnit VRegOrUnit = Def.VRegOrUnit;
783
784 LaneBitmask PreviousMask = LiveRegs.erase(Def);
785 LaneBitmask NewMask = PreviousMask & ~Def.LaneMask;
786
787 LaneBitmask LiveOut = Def.LaneMask & ~PreviousMask;
788 if (LiveOut.any()) {
789 discoverLiveOut(VRegMaskOrUnit(VRegOrUnit, LiveOut));
790 // Retroactively model effects on pressure of the live out lanes.
791 increaseSetPressure(CurrSetPressure, *MRI, VRegOrUnit,
792 LaneBitmask::getNone(), LiveOut);
793 PreviousMask = LiveOut;
794 }
795
796 if (NewMask.none()) {
797 // Add a 0 entry to LiveUses as a marker that the complete vreg has become
798 // dead.
799 if (TrackLaneMasks && LiveUses != nullptr)
800 setRegZero(*LiveUses, VRegOrUnit);
801 }
802
803 decreaseRegPressure(VRegOrUnit, PreviousMask, NewMask);
804 }
805
806 SlotIndex SlotIdx;
807 if (RequireIntervals)
808 SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot();
809
810 // Generate liveness for uses.
811 for (const VRegMaskOrUnit &Use : RegOpers.Uses) {
812 VirtRegOrUnit VRegOrUnit = Use.VRegOrUnit;
813 assert(Use.LaneMask.any());
814 LaneBitmask PreviousMask = LiveRegs.insert(Use);
815 LaneBitmask NewMask = PreviousMask | Use.LaneMask;
816 if (NewMask == PreviousMask)
817 continue;
818
819 // Did the register just become live?
820 if (PreviousMask.none()) {
821 if (LiveUses != nullptr) {
822 if (!TrackLaneMasks) {
823 addRegLanes(*LiveUses, VRegMaskOrUnit(VRegOrUnit, NewMask));
824 } else {
825 auto I = find_if(*LiveUses, [VRegOrUnit](const VRegMaskOrUnit Other) {
826 return Other.VRegOrUnit == VRegOrUnit;
827 });
828 bool IsRedef = I != LiveUses->end();
829 if (IsRedef) {
830 // ignore re-defs here...
831 assert(I->LaneMask.none());
832 removeRegLanes(*LiveUses, VRegMaskOrUnit(VRegOrUnit, NewMask));
833 } else {
834 addRegLanes(*LiveUses, VRegMaskOrUnit(VRegOrUnit, NewMask));
835 }
836 }
837 }
838
839 // Discover live outs if this may be the first occurance of this register.
840 if (RequireIntervals) {
841 LaneBitmask LiveOut = getLiveThroughAt(VRegOrUnit, SlotIdx);
842 if (LiveOut.any())
843 discoverLiveOut(VRegMaskOrUnit(VRegOrUnit, LiveOut));
844 }
845 }
846
847 increaseRegPressure(VRegOrUnit, PreviousMask, NewMask);
848 }
849 if (TrackUntiedDefs) {
850 for (const VRegMaskOrUnit &Def : RegOpers.Defs) {
851 VirtRegOrUnit VRegOrUnit = Def.VRegOrUnit;
852 if (VRegOrUnit.isVirtualReg() &&
853 (LiveRegs.contains(VRegOrUnit) & Def.LaneMask).none())
854 UntiedDefs.insert(VRegOrUnit.asVirtualReg());
855 }
856 }
857}
858
860 assert(CurrPos != MBB->begin());
861 if (!isBottomClosed())
862 closeBottom();
863
864 // Open the top of the region using block iterators.
865 if (!RequireIntervals && isTopClosed())
866 static_cast<RegionPressure&>(P).openTop(CurrPos);
867
868 // Find the previous instruction.
869 CurrPos = prev_nodbg(CurrPos, MBB->begin());
870
871 SlotIndex SlotIdx;
872 if (RequireIntervals && !CurrPos->isDebugOrPseudoInstr())
873 SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot();
874
875 // Open the top of the region using slot indexes.
876 if (RequireIntervals && isTopClosed())
877 static_cast<IntervalPressure&>(P).openTop(SlotIdx);
878}
879
882 if (CurrPos->isDebugOrPseudoInstr()) {
883 // It's possible to only have debug_value and pseudo probe instructions and
884 // hit the start of the block.
885 assert(CurrPos == MBB->begin());
886 return;
887 }
888
889 const MachineInstr &MI = *CurrPos;
890 RegisterOperands RegOpers;
891 RegOpers.collect(MI, *TRI, *MRI, TrackLaneMasks, /*IgnoreDead=*/false);
892 if (TrackLaneMasks) {
893 SlotIndex SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot();
894 RegOpers.adjustLaneLiveness(*LIS, *MRI, SlotIdx);
895 } else if (RequireIntervals) {
896 RegOpers.detectDeadDefs(MI, *LIS);
897 }
898
899 recede(RegOpers, LiveUses);
900}
901
902/// Advance across the current instruction.
904 assert(!TrackUntiedDefs && "unsupported mode");
905 assert(CurrPos != MBB->end());
906 if (!isTopClosed())
907 closeTop();
908
909 SlotIndex SlotIdx;
910 if (RequireIntervals)
911 SlotIdx = getCurrSlot();
912
913 // Open the bottom of the region using slot indexes.
914 if (isBottomClosed()) {
915 if (RequireIntervals)
916 static_cast<IntervalPressure&>(P).openBottom(SlotIdx);
917 else
918 static_cast<RegionPressure&>(P).openBottom(CurrPos);
919 }
920
921 for (const VRegMaskOrUnit &Use : RegOpers.Uses) {
922 VirtRegOrUnit VRegOrUnit = Use.VRegOrUnit;
923 LaneBitmask LiveMask = LiveRegs.contains(VRegOrUnit);
924 LaneBitmask LiveIn = Use.LaneMask & ~LiveMask;
925 if (LiveIn.any()) {
926 discoverLiveIn(VRegMaskOrUnit(VRegOrUnit, LiveIn));
927 increaseRegPressure(VRegOrUnit, LiveMask, LiveMask | LiveIn);
928 LiveRegs.insert(VRegMaskOrUnit(VRegOrUnit, LiveIn));
929 }
930 // Kill liveness at last uses.
931 if (RequireIntervals) {
932 LaneBitmask LastUseMask = getLastUsedLanes(VRegOrUnit, SlotIdx);
933 if (LastUseMask.any()) {
934 LiveRegs.erase(VRegMaskOrUnit(VRegOrUnit, LastUseMask));
935 decreaseRegPressure(VRegOrUnit, LiveMask, LiveMask & ~LastUseMask);
936 }
937 }
938 }
939
940 // Generate liveness for defs.
941 for (const VRegMaskOrUnit &Def : RegOpers.Defs) {
942 LaneBitmask PreviousMask = LiveRegs.insert(Def);
943 LaneBitmask NewMask = PreviousMask | Def.LaneMask;
944 increaseRegPressure(Def.VRegOrUnit, PreviousMask, NewMask);
945 }
946
947 // Boost pressure for all dead defs together.
948 bumpDeadDefs(RegOpers.DeadDefs);
949
950 // Find the next instruction.
951 CurrPos = next_nodbg(CurrPos, MBB->end());
952}
953
955 const MachineInstr &MI = *CurrPos;
956 RegisterOperands RegOpers;
957 RegOpers.collect(MI, *TRI, *MRI, TrackLaneMasks, false);
958 if (TrackLaneMasks) {
959 SlotIndex SlotIdx = getCurrSlot();
960 RegOpers.adjustLaneLiveness(*LIS, *MRI, SlotIdx);
961 }
962 advance(RegOpers);
963}
964
965/// Find the max change in excess pressure across all sets.
967 ArrayRef<unsigned> NewPressureVec,
968 RegPressureDelta &Delta,
969 const RegisterClassInfo *RCI,
970 ArrayRef<unsigned> LiveThruPressureVec) {
971 Delta.Excess = PressureChange();
972 for (unsigned i = 0, e = OldPressureVec.size(); i < e; ++i) {
973 unsigned POld = OldPressureVec[i];
974 unsigned PNew = NewPressureVec[i];
975 int PDiff = (int)PNew - (int)POld;
976 if (!PDiff) // No change in this set in the common case.
977 continue;
978 // Only consider change beyond the limit.
979 unsigned Limit = RCI->getRegPressureSetLimit(i);
980 if (!LiveThruPressureVec.empty())
981 Limit += LiveThruPressureVec[i];
982
983 if (Limit > POld) {
984 if (Limit > PNew)
985 PDiff = 0; // Under the limit
986 else
987 PDiff = PNew - Limit; // Just exceeded limit.
988 } else if (Limit > PNew)
989 PDiff = Limit - POld; // Just obeyed limit.
990
991 if (PDiff) {
992 Delta.Excess = PressureChange(i);
993 Delta.Excess.setUnitInc(PDiff);
994 break;
995 }
996 }
997}
998
999/// Find the max change in max pressure that either surpasses a critical PSet
1000/// limit or exceeds the current MaxPressureLimit.
1001///
1002/// FIXME: comparing each element of the old and new MaxPressure vectors here is
1003/// silly. It's done now to demonstrate the concept but will go away with a
1004/// RegPressureTracker API change to work with pressure differences.
1005static void computeMaxPressureDelta(ArrayRef<unsigned> OldMaxPressureVec,
1006 ArrayRef<unsigned> NewMaxPressureVec,
1007 ArrayRef<PressureChange> CriticalPSets,
1008 ArrayRef<unsigned> MaxPressureLimit,
1009 RegPressureDelta &Delta) {
1010 Delta.CriticalMax = PressureChange();
1011 Delta.CurrentMax = PressureChange();
1012
1013 unsigned CritIdx = 0, CritEnd = CriticalPSets.size();
1014 for (unsigned i = 0, e = OldMaxPressureVec.size(); i < e; ++i) {
1015 unsigned POld = OldMaxPressureVec[i];
1016 unsigned PNew = NewMaxPressureVec[i];
1017 if (PNew == POld) // No change in this set in the common case.
1018 continue;
1019
1020 if (!Delta.CriticalMax.isValid()) {
1021 while (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() < i)
1022 ++CritIdx;
1023
1024 if (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() == i) {
1025 int PDiff = (int)PNew - CriticalPSets[CritIdx].getUnitInc();
1026 if (PDiff > 0) {
1027 Delta.CriticalMax = PressureChange(i);
1028 Delta.CriticalMax.setUnitInc(PDiff);
1029 }
1030 }
1031 }
1032 // Find the first increase above MaxPressureLimit.
1033 // (Ignores negative MDiff).
1034 if (!Delta.CurrentMax.isValid() && PNew > MaxPressureLimit[i]) {
1035 Delta.CurrentMax = PressureChange(i);
1036 Delta.CurrentMax.setUnitInc(PNew - POld);
1037 if (CritIdx == CritEnd || Delta.CriticalMax.isValid())
1038 break;
1039 }
1040 }
1041}
1042
1043/// Record the upward impact of a single instruction on current register
1044/// pressure. Unlike the advance/recede pressure tracking interface, this does
1045/// not discover live in/outs.
1046///
1047/// This is intended for speculative queries. It leaves pressure inconsistent
1048/// with the current position, so must be restored by the caller.
1050 assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction.");
1051
1052 SlotIndex SlotIdx;
1053 if (RequireIntervals)
1054 SlotIdx = LIS->getInstructionIndex(*MI).getRegSlot();
1055
1056 // Account for register pressure similar to RegPressureTracker::recede().
1057 RegisterOperands RegOpers;
1058 RegOpers.collect(*MI, *TRI, *MRI, TrackLaneMasks, /*IgnoreDead=*/true);
1059 assert(RegOpers.DeadDefs.empty());
1060 if (TrackLaneMasks)
1061 RegOpers.adjustLaneLiveness(*LIS, *MRI, SlotIdx);
1062 else if (RequireIntervals)
1063 RegOpers.detectDeadDefs(*MI, *LIS);
1064
1065 // Boost max pressure for all dead defs together.
1066 // Since CurrSetPressure and MaxSetPressure
1067 bumpDeadDefs(RegOpers.DeadDefs);
1068
1069 // Kill liveness at live defs.
1070 for (const VRegMaskOrUnit &P : RegOpers.Defs) {
1071 LaneBitmask LiveAfter = LiveRegs.contains(P.VRegOrUnit);
1072 LaneBitmask UseLanes = getRegLanes(RegOpers.Uses, P.VRegOrUnit);
1073 LaneBitmask DefLanes = P.LaneMask;
1074 LaneBitmask LiveBefore = (LiveAfter & ~DefLanes) | UseLanes;
1075
1076 // There may be parts of the register that were dead before the
1077 // instruction, but became live afterwards.
1078 decreaseRegPressure(P.VRegOrUnit, LiveAfter, LiveAfter & LiveBefore);
1079 }
1080 // Generate liveness for uses. Also handle any uses which overlap with defs.
1081 for (const VRegMaskOrUnit &P : RegOpers.Uses) {
1082 LaneBitmask LiveAfter = LiveRegs.contains(P.VRegOrUnit);
1083 LaneBitmask LiveBefore = LiveAfter | P.LaneMask;
1084 increaseRegPressure(P.VRegOrUnit, LiveAfter, LiveBefore);
1085 }
1086}
1087
1088/// Consider the pressure increase caused by traversing this instruction
1089/// bottom-up. Find the pressure set with the most change beyond its pressure
1090/// limit based on the tracker's current pressure, and return the change in
1091/// number of register units of that pressure set introduced by this
1092/// instruction.
1093///
1094/// This assumes that the current LiveOut set is sufficient.
1095///
1096/// This is expensive for an on-the-fly query because it calls
1097/// bumpUpwardPressure to recompute the pressure sets based on current
1098/// liveness. This mainly exists to verify correctness, e.g. with
1099/// -verify-misched. getUpwardPressureDelta is the fast version of this query
1100/// that uses the per-SUnit cache of the PressureDiff.
1103 RegPressureDelta &Delta,
1104 ArrayRef<PressureChange> CriticalPSets,
1105 ArrayRef<unsigned> MaxPressureLimit) {
1106 // Snapshot Pressure.
1107 // FIXME: The snapshot heap space should persist. But I'm planning to
1108 // summarize the pressure effect so we don't need to snapshot at all.
1109 std::vector<unsigned> SavedPressure = CurrSetPressure;
1110 std::vector<unsigned> SavedMaxPressure = P.MaxSetPressure;
1111
1113
1114 computeExcessPressureDelta(SavedPressure, CurrSetPressure, Delta, RCI,
1115 LiveThruPressure);
1116 computeMaxPressureDelta(SavedMaxPressure, P.MaxSetPressure, CriticalPSets,
1117 MaxPressureLimit, Delta);
1118 assert(Delta.CriticalMax.getUnitInc() >= 0 &&
1119 Delta.CurrentMax.getUnitInc() >= 0 && "cannot decrease max pressure");
1120
1121 // Restore the tracker's state.
1122 P.MaxSetPressure.swap(SavedMaxPressure);
1123 CurrSetPressure.swap(SavedPressure);
1124
1125#ifndef NDEBUG
1126 if (!PDiff)
1127 return;
1128
1129 // Check if the alternate algorithm yields the same result.
1130 RegPressureDelta Delta2;
1131 getUpwardPressureDelta(MI, *PDiff, Delta2, CriticalPSets, MaxPressureLimit);
1132 if (Delta != Delta2) {
1133 dbgs() << "PDiff: ";
1134 PDiff->dump(*TRI);
1135 dbgs() << "DELTA: " << *MI;
1136 if (Delta.Excess.isValid())
1137 dbgs() << "Excess1 " << TRI->getRegPressureSetName(Delta.Excess.getPSet())
1138 << " " << Delta.Excess.getUnitInc() << "\n";
1139 if (Delta.CriticalMax.isValid())
1140 dbgs() << "Critic1 " << TRI->getRegPressureSetName(Delta.CriticalMax.getPSet())
1141 << " " << Delta.CriticalMax.getUnitInc() << "\n";
1142 if (Delta.CurrentMax.isValid())
1143 dbgs() << "CurrMx1 " << TRI->getRegPressureSetName(Delta.CurrentMax.getPSet())
1144 << " " << Delta.CurrentMax.getUnitInc() << "\n";
1145 if (Delta2.Excess.isValid())
1146 dbgs() << "Excess2 " << TRI->getRegPressureSetName(Delta2.Excess.getPSet())
1147 << " " << Delta2.Excess.getUnitInc() << "\n";
1148 if (Delta2.CriticalMax.isValid())
1149 dbgs() << "Critic2 " << TRI->getRegPressureSetName(Delta2.CriticalMax.getPSet())
1150 << " " << Delta2.CriticalMax.getUnitInc() << "\n";
1151 if (Delta2.CurrentMax.isValid())
1152 dbgs() << "CurrMx2 " << TRI->getRegPressureSetName(Delta2.CurrentMax.getPSet())
1153 << " " << Delta2.CurrentMax.getUnitInc() << "\n";
1154 llvm_unreachable("RegP Delta Mismatch");
1155 }
1156#endif
1157}
1158
1159/// This is the fast version of querying register pressure that does not
1160/// directly depend on current liveness.
1161///
1162/// @param Delta captures information needed for heuristics.
1163///
1164/// @param CriticalPSets Are the pressure sets that are known to exceed some
1165/// limit within the region, not necessarily at the current position.
1166///
1167/// @param MaxPressureLimit Is the max pressure within the region, not
1168/// necessarily at the current position.
1170getUpwardPressureDelta(const MachineInstr *MI, /*const*/ PressureDiff &PDiff,
1171 RegPressureDelta &Delta,
1172 ArrayRef<PressureChange> CriticalPSets,
1173 ArrayRef<unsigned> MaxPressureLimit) const {
1174 unsigned CritIdx = 0, CritEnd = CriticalPSets.size();
1176 PDiffI = PDiff.begin(), PDiffE = PDiff.end();
1177 PDiffI != PDiffE && PDiffI->isValid(); ++PDiffI) {
1178
1179 unsigned PSetID = PDiffI->getPSet();
1180 unsigned Limit = RCI->getRegPressureSetLimit(PSetID);
1181 if (!LiveThruPressure.empty())
1182 Limit += LiveThruPressure[PSetID];
1183
1184 unsigned POld = CurrSetPressure[PSetID];
1185 unsigned MOld = P.MaxSetPressure[PSetID];
1186 unsigned MNew = MOld;
1187 // Ignore DeadDefs here because they aren't captured by PressureChange.
1188 unsigned PNew = POld + PDiffI->getUnitInc();
1189 assert((PDiffI->getUnitInc() >= 0) == (PNew >= POld)
1190 && "PSet overflow/underflow");
1191 if (PNew > MOld)
1192 MNew = PNew;
1193 // Check if current pressure has exceeded the limit.
1194 if (!Delta.Excess.isValid()) {
1195 unsigned ExcessInc = 0;
1196 if (PNew > Limit)
1197 ExcessInc = POld > Limit ? PNew - POld : PNew - Limit;
1198 else if (POld > Limit)
1199 ExcessInc = Limit - POld;
1200 if (ExcessInc) {
1201 Delta.Excess = PressureChange(PSetID);
1202 Delta.Excess.setUnitInc(ExcessInc);
1203 }
1204 }
1205 // Check if max pressure has exceeded a critical pressure set max.
1206 if (MNew == MOld)
1207 continue;
1208 if (!Delta.CriticalMax.isValid()) {
1209 while (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() < PSetID)
1210 ++CritIdx;
1211
1212 if (CritIdx != CritEnd && CriticalPSets[CritIdx].getPSet() == PSetID) {
1213 int CritInc = (int)MNew - CriticalPSets[CritIdx].getUnitInc();
1214 if (CritInc > 0 && CritInc <= std::numeric_limits<int16_t>::max()) {
1215 Delta.CriticalMax = PressureChange(PSetID);
1216 Delta.CriticalMax.setUnitInc(CritInc);
1217 }
1218 }
1219 }
1220 // Check if max pressure has exceeded the current max.
1221 if (!Delta.CurrentMax.isValid() && MNew > MaxPressureLimit[PSetID]) {
1222 Delta.CurrentMax = PressureChange(PSetID);
1223 Delta.CurrentMax.setUnitInc(MNew - MOld);
1224 }
1225 }
1226}
1227
1228/// Helper to find a vreg use between two indices [PriorUseIdx, NextUseIdx).
1229/// The query starts with a lane bitmask which gets lanes/bits removed for every
1230/// use we find.
1232 LaneBitmask LastUseMask,
1233 SlotIndex PriorUseIdx, SlotIndex NextUseIdx,
1234 const MachineRegisterInfo &MRI,
1235 const LiveIntervals *LIS) {
1237 // FIXME: The static_cast is a bug.
1238 Register Reg =
1239 VRegOrUnit.isVirtualReg()
1240 ? VRegOrUnit.asVirtualReg()
1241 : Register(static_cast<unsigned>(VRegOrUnit.asMCRegUnit()));
1242 for (const MachineOperand &MO : MRI.use_nodbg_operands(Reg)) {
1243 if (MO.isUndef())
1244 continue;
1245 const MachineInstr *MI = MO.getParent();
1246 SlotIndex InstSlot = LIS->getInstructionIndex(*MI).getRegSlot();
1247 if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx) {
1248 unsigned SubRegIdx = MO.getSubReg();
1249 LaneBitmask UseMask = TRI.getSubRegIndexLaneMask(SubRegIdx);
1250 LastUseMask &= ~UseMask;
1251 if (LastUseMask.none())
1252 return LaneBitmask::getNone();
1253 }
1254 }
1255 return LastUseMask;
1256}
1257
1259 SlotIndex Pos) const {
1260 assert(RequireIntervals);
1261 return getLanesWithProperty(
1262 *LIS, *MRI, TrackLaneMasks, VRegOrUnit, Pos, LaneBitmask::getAll(),
1263 [](const LiveRange &LR, SlotIndex Pos) { return LR.liveAt(Pos); });
1264}
1265
1267 SlotIndex Pos) const {
1268 assert(RequireIntervals);
1269 return getLanesWithProperty(
1270 *LIS, *MRI, TrackLaneMasks, VRegOrUnit, Pos.getBaseIndex(),
1271 LaneBitmask::getNone(), [](const LiveRange &LR, SlotIndex Pos) {
1272 const LiveRange::Segment *S = LR.getSegmentContaining(Pos);
1273 return S != nullptr && S->end == Pos.getRegSlot();
1274 });
1275}
1276
1278 SlotIndex Pos) const {
1279 assert(RequireIntervals);
1280 return getLanesWithProperty(
1281 *LIS, *MRI, TrackLaneMasks, VRegOrUnit, Pos, LaneBitmask::getNone(),
1282 [](const LiveRange &LR, SlotIndex Pos) {
1283 const LiveRange::Segment *S = LR.getSegmentContaining(Pos);
1284 return S != nullptr && S->start < Pos.getRegSlot(true) &&
1285 S->end != Pos.getDeadSlot();
1286 });
1287}
1288
1289/// Record the downward impact of a single instruction on current register
1290/// pressure. Unlike the advance/recede pressure tracking interface, this does
1291/// not discover live in/outs.
1292///
1293/// This is intended for speculative queries. It leaves pressure inconsistent
1294/// with the current position, so must be restored by the caller.
1296 assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction.");
1297
1298 SlotIndex SlotIdx;
1299 if (RequireIntervals)
1300 SlotIdx = LIS->getInstructionIndex(*MI).getRegSlot();
1301
1302 // Account for register pressure similar to RegPressureTracker::advance().
1303 RegisterOperands RegOpers;
1304 RegOpers.collect(*MI, *TRI, *MRI, TrackLaneMasks, /*IgnoreDead=*/false);
1305 if (TrackLaneMasks)
1306 RegOpers.adjustLaneLiveness(*LIS, *MRI, SlotIdx);
1307
1308 if (RequireIntervals) {
1309 for (const VRegMaskOrUnit &Use : RegOpers.Uses) {
1310 VirtRegOrUnit VRegOrUnit = Use.VRegOrUnit;
1311 LaneBitmask LastUseMask = getLastUsedLanes(VRegOrUnit, SlotIdx);
1312 if (LastUseMask.none())
1313 continue;
1314 // The LastUseMask is queried from the liveness information of instruction
1315 // which may be further down the schedule. Some lanes may actually not be
1316 // last uses for the current position.
1317 // FIXME: allow the caller to pass in the list of vreg uses that remain
1318 // to be bottom-scheduled to avoid searching uses at each query.
1319 SlotIndex CurrIdx = getCurrSlot();
1320 LastUseMask =
1321 findUseBetween(VRegOrUnit, LastUseMask, CurrIdx, SlotIdx, *MRI, LIS);
1322 if (LastUseMask.none())
1323 continue;
1324
1325 LaneBitmask LiveMask = LiveRegs.contains(VRegOrUnit);
1326 LaneBitmask NewMask = LiveMask & ~LastUseMask;
1327 decreaseRegPressure(VRegOrUnit, LiveMask, NewMask);
1328 }
1329 }
1330
1331 // Generate liveness for defs.
1332 for (const VRegMaskOrUnit &Def : RegOpers.Defs) {
1333 LaneBitmask LiveMask = LiveRegs.contains(Def.VRegOrUnit);
1334 LaneBitmask NewMask = LiveMask | Def.LaneMask;
1335 increaseRegPressure(Def.VRegOrUnit, LiveMask, NewMask);
1336 }
1337
1338 // Boost pressure for all dead defs together.
1339 bumpDeadDefs(RegOpers.DeadDefs);
1340}
1341
1342/// Consider the pressure increase caused by traversing this instruction
1343/// top-down. Find the register class with the most change in its pressure limit
1344/// based on the tracker's current pressure, and return the number of excess
1345/// register units of that pressure set introduced by this instruction.
1346///
1347/// This assumes that the current LiveIn set is sufficient.
1348///
1349/// This is expensive for an on-the-fly query because it calls
1350/// bumpDownwardPressure to recompute the pressure sets based on current
1351/// liveness. We don't yet have a fast version of downward pressure tracking
1352/// analogous to getUpwardPressureDelta.
1355 ArrayRef<PressureChange> CriticalPSets,
1356 ArrayRef<unsigned> MaxPressureLimit) {
1357 // Snapshot Pressure.
1358 std::vector<unsigned> SavedPressure = CurrSetPressure;
1359 std::vector<unsigned> SavedMaxPressure = P.MaxSetPressure;
1360
1362
1363 computeExcessPressureDelta(SavedPressure, CurrSetPressure, Delta, RCI,
1364 LiveThruPressure);
1365 computeMaxPressureDelta(SavedMaxPressure, P.MaxSetPressure, CriticalPSets,
1366 MaxPressureLimit, Delta);
1367 assert(Delta.CriticalMax.getUnitInc() >= 0 &&
1368 Delta.CurrentMax.getUnitInc() >= 0 && "cannot decrease max pressure");
1369
1370 // Restore the tracker's state.
1371 P.MaxSetPressure.swap(SavedMaxPressure);
1372 CurrSetPressure.swap(SavedPressure);
1373}
1374
1375/// Get the pressure of each PSet after traversing this instruction bottom-up.
1378 std::vector<unsigned> &PressureResult,
1379 std::vector<unsigned> &MaxPressureResult) {
1380 // Snapshot pressure.
1381 PressureResult = CurrSetPressure;
1382 MaxPressureResult = P.MaxSetPressure;
1383
1385
1386 // Current pressure becomes the result. Restore current pressure.
1387 P.MaxSetPressure.swap(MaxPressureResult);
1388 CurrSetPressure.swap(PressureResult);
1389}
1390
1391/// Get the pressure of each PSet after traversing this instruction top-down.
1394 std::vector<unsigned> &PressureResult,
1395 std::vector<unsigned> &MaxPressureResult) {
1396 // Snapshot pressure.
1397 PressureResult = CurrSetPressure;
1398 MaxPressureResult = P.MaxSetPressure;
1399
1401
1402 // Current pressure becomes the result. Restore current pressure.
1403 P.MaxSetPressure.swap(MaxPressureResult);
1404 CurrSetPressure.swap(PressureResult);
1405}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:678
IRTranslator LLVM IR MI
A common definition of LaneBitmask for use in TableGen and CodeGen.
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
#define P(N)
Register Usage Information Collector
static void computeExcessPressureDelta(ArrayRef< unsigned > OldPressureVec, ArrayRef< unsigned > NewPressureVec, RegPressureDelta &Delta, const RegisterClassInfo *RCI, ArrayRef< unsigned > LiveThruPressureVec)
Find the max change in excess pressure across all sets.
static LaneBitmask getLiveLanesAt(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, VirtRegOrUnit VRegOrUnit, SlotIndex Pos)
static void increaseSetPressure(std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, VirtRegOrUnit VRegOrUnit, LaneBitmask PrevMask, LaneBitmask NewMask)
Increase pressure for each pressure set provided by TargetRegisterInfo.
static LaneBitmask getRegLanes(ArrayRef< VRegMaskOrUnit > RegUnits, VirtRegOrUnit VRegOrUnit)
static void removeRegLanes(SmallVectorImpl< VRegMaskOrUnit > &RegUnits, VRegMaskOrUnit Pair)
static void computeMaxPressureDelta(ArrayRef< unsigned > OldMaxPressureVec, ArrayRef< unsigned > NewMaxPressureVec, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit, RegPressureDelta &Delta)
Find the max change in max pressure that either surpasses a critical PSet limit or exceeds the curren...
static LaneBitmask getLanesWithProperty(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, bool TrackLaneMasks, VirtRegOrUnit VRegOrUnit, SlotIndex Pos, LaneBitmask SafeDefault, bool(*Property)(const LiveRange &LR, SlotIndex Pos))
static void setRegZero(SmallVectorImpl< VRegMaskOrUnit > &RegUnits, VirtRegOrUnit VRegOrUnit)
static LaneBitmask findUseBetween(VirtRegOrUnit VRegOrUnit, LaneBitmask LastUseMask, SlotIndex PriorUseIdx, SlotIndex NextUseIdx, const MachineRegisterInfo &MRI, const LiveIntervals *LIS)
Helper to find a vreg use between two indices [PriorUseIdx, NextUseIdx).
static const LiveRange * getLiveRange(const LiveIntervals &LIS, VirtRegOrUnit VRegOrUnit)
static void addRegLanes(SmallVectorImpl< VRegMaskOrUnit > &RegUnits, VRegMaskOrUnit Pair)
static void decreaseSetPressure(std::vector< unsigned > &CurrSetPressure, const MachineRegisterInfo &MRI, VirtRegOrUnit VRegOrUnit, LaneBitmask PrevMask, LaneBitmask NewMask)
Decrease pressure for each pressure set provided by TargetRegisterInfo.
Remove Loads Into Fake Uses
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
iterator end() const
Definition ArrayRef.h:130
size_t size() const
Get the array size.
Definition ArrayRef.h:141
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
A live range for subregisters.
LiveInterval - This class represents the liveness of a register, or stack slot.
bool hasSubRanges() const
Returns true if subregister liveness information is available.
iterator_range< subrange_iterator > subranges()
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
LiveInterval & getInterval(Register Reg)
LiveRange * getCachedRegUnit(MCRegUnit Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't...
Result of a LiveRange query.
bool isDeadDef() const
Return true if this instruction has a dead def.
This class represents the liveness of a register, stack slot, etc.
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
bool liveAt(SlotIndex index) const
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
LLVM_ABI void clear()
LLVM_ABI void init(const MachineRegisterInfo &MRI)
MachineInstrBundleIterator< const MachineInstr > const_iterator
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
Register getReg() const
getReg - Returns the register number.
bool isInternalRead() const
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
iterator_range< use_nodbg_iterator > use_nodbg_operands(Register Reg) const
PSetIterator getPressureSets(VirtRegOrUnit VRegOrUnit) const
Get an iterator over the pressure sets affected by the virtual register or register unit.
bool isAllocatable(MCRegister PhysReg) const
isAllocatable - Returns true when PhysReg belongs to an allocatable register class and it hasn't been...
const TargetRegisterInfo * getTargetRegisterInfo() const
LLVM_ABI LaneBitmask getMaxLaneMaskForVReg(Register Reg) const
Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual registe...
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
Iterate over the pressure sets affected by the given physical or virtual register.
unsigned getWeight() const
Capture a change in pressure for a single pressure set.
unsigned getPSetOrMax() const
LLVM_ABI void dump() const
unsigned getPSet() const
List of PressureChanges in order of increasing, unique PSetID.
const PressureChange * const_iterator
LLVM_ABI void dump(const TargetRegisterInfo &TRI) const
const_iterator end() const
LLVM_ABI void addPressureChange(VirtRegOrUnit VRegOrUnit, bool IsDec, const MachineRegisterInfo *MRI)
Add a change in pressure to the pressure diff of a given instruction.
const_iterator begin() const
LLVM_ABI void addInstruction(unsigned Idx, const RegisterOperands &RegOpers, const MachineRegisterInfo &MRI)
Record pressure difference induced by the given operand list to node with index Idx.
LLVM_ABI void init(unsigned N)
Initialize an array of N PressureDiffs.
LLVM_ABI void closeRegion()
Finalize the region boundaries and recored live ins and live outs.
LLVM_ABI void discoverLiveIn(VRegMaskOrUnit Pair)
Add Reg to the live in set and increase max pressure.
LLVM_ABI void closeBottom()
Set the boundary for the bottom of the region and summarize live outs.
LLVM_ABI void recede(SmallVectorImpl< VRegMaskOrUnit > *LiveUses=nullptr)
Recede across the previous instruction.
LLVM_ABI void bumpDownwardPressure(const MachineInstr *MI)
Record the downward impact of a single instruction on current register pressure.
LLVM_ABI void addLiveRegs(ArrayRef< VRegMaskOrUnit > Regs)
Force liveness of virtual registers or physical register units.
LLVM_ABI void recedeSkipDebugValues()
Recede until we find an instruction which is not a DebugValue.
LLVM_ABI void getMaxUpwardPressureDelta(const MachineInstr *MI, PressureDiff *PDiff, RegPressureDelta &Delta, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit)
Consider the pressure increase caused by traversing this instruction bottom-up.
LLVM_ABI void initLiveThru(const RegPressureTracker &RPTracker)
Initialize the LiveThru pressure set based on the untied defs found in RPTracker.
LLVM_ABI void bumpDeadDefs(ArrayRef< VRegMaskOrUnit > DeadDefs)
RegPressureTracker(IntervalPressure &rp)
LLVM_ABI void dump() const
LLVM_ABI void init(const MachineFunction *mf, const RegisterClassInfo *rci, const LiveIntervals *lis, const MachineBasicBlock *mbb, MachineBasicBlock::const_iterator pos, bool TrackLaneMasks, bool TrackUntiedDefs)
Setup the RegPressureTracker.
LLVM_ABI void discoverLiveInOrOut(VRegMaskOrUnit Pair, SmallVectorImpl< VRegMaskOrUnit > &LiveInOrOut)
LLVM_ABI LaneBitmask getLiveThroughAt(VirtRegOrUnit VRegOrUnit, SlotIndex Pos) const
LLVM_ABI bool isBottomClosed() const
Does this pressure result have a valid bottom position and live outs.
LLVM_ABI LaneBitmask getLiveLanesAt(VirtRegOrUnit VRegOrUnit, SlotIndex Pos) const
bool hasUntiedDef(Register VirtReg) const
LLVM_ABI void closeTop()
Set the boundary for the top of the region and summarize live ins.
LLVM_ABI void getMaxDownwardPressureDelta(const MachineInstr *MI, RegPressureDelta &Delta, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit)
Consider the pressure increase caused by traversing this instruction top-down.
LLVM_ABI void advance()
Advance across the current instruction.
LLVM_ABI bool isTopClosed() const
Does this pressure result have a valid top position and live ins.
LLVM_ABI void bumpUpwardPressure(const MachineInstr *MI)
Record the upward impact of a single instruction on current register pressure.
LLVM_ABI LaneBitmask getLastUsedLanes(VirtRegOrUnit VRegOrUnit, SlotIndex Pos) const
LLVM_ABI void increaseRegPressure(VirtRegOrUnit VRegOrUnit, LaneBitmask PreviousMask, LaneBitmask NewMask)
LLVM_ABI void getDownwardPressure(const MachineInstr *MI, std::vector< unsigned > &PressureResult, std::vector< unsigned > &MaxPressureResult)
Get the pressure of each PSet after traversing this instruction top-down.
LLVM_ABI SlotIndex getCurrSlot() const
Get the SlotIndex for the first nondebug instruction including or after the current position.
LLVM_ABI void decreaseRegPressure(VirtRegOrUnit VRegOrUnit, LaneBitmask PreviousMask, LaneBitmask NewMask)
LLVM_ABI void getUpwardPressure(const MachineInstr *MI, std::vector< unsigned > &PressureResult, std::vector< unsigned > &MaxPressureResult)
Get the pressure of each PSet after traversing this instruction bottom-up.
LLVM_ABI void discoverLiveOut(VRegMaskOrUnit Pair)
Add Reg to the live out set and increase max pressure.
LLVM_ABI void getUpwardPressureDelta(const MachineInstr *MI, PressureDiff &PDiff, RegPressureDelta &Delta, ArrayRef< PressureChange > CriticalPSets, ArrayRef< unsigned > MaxPressureLimit) const
This is the fast version of querying register pressure that does not directly depend on current liven...
unsigned getRegPressureSetLimit(unsigned Idx) const
Get the register unit limit for the given pressure set index.
List of registers defined and used by a machine instruction.
LLVM_ABI void adjustLaneLiveness(const LiveIntervals &LIS, const MachineRegisterInfo &MRI, SlotIndex Pos)
Use liveness information to find out which uses/defs are partially undefined/dead at Pos and adjust t...
SmallVector< VRegMaskOrUnit, 8 > Defs
List of virtual registers and register units defined by the instruction which are not dead.
LLVM_ABI void collect(const MachineInstr &MI, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, bool TrackLaneMasks, bool IgnoreDead)
Analyze the given instruction MI and fill in the Uses, Defs and DeadDefs list based on the MachineOpe...
SmallVector< VRegMaskOrUnit, 8 > DeadDefs
List of virtual registers and register units defined by the instruction but dead.
LLVM_ABI void detectDeadDefs(const MachineInstr &MI, const LiveIntervals &LIS)
Use liveness information to find dead defs not marked with a dead flag and move them to the DeadDefs ...
SmallVector< VRegMaskOrUnit, 8 > Uses
List of virtual registers and register units read by the instruction.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
MCRegister asMCReg() const
Utility to check-convert this value to a MCRegister.
Definition Register.h:107
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
Definition Register.h:79
SlotIndex - An opaque wrapper around machine indexes.
Definition SlotIndexes.h:66
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
iterator erase(const_iterator CI)
void push_back(const T &Elt)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
Wrapper class representing a virtual register or register unit.
Definition Register.h:175
constexpr bool isVirtualReg() const
Definition Register.h:191
constexpr MCRegUnit asMCRegUnit() const
Definition Register.h:195
constexpr Register asVirtualReg() const
Definition Register.h:200
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
IterT next_nodbg(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It, then continue incrementing it while it points to a debug instruction.
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
Definition LaneBitmask.h:92
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_calloc(size_t Count, size_t Sz)
Definition MemAlloc.h:38
IterT skipDebugInstructionsForward(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It until it points to a non-debug instruction or to End and return the resulting iterator.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
@ Other
Any other memory.
Definition ModRef.h:68
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1772
LLVM_ABI void dumpRegSetPressure(ArrayRef< unsigned > SetPressure, const TargetRegisterInfo *TRI)
IterT prev_nodbg(IterT It, IterT Begin, bool SkipPseudoOp=true)
Decrement It, then continue decrementing it while it points to a debug instruction.
LLVM_ABI Printable printVRegOrUnit(VirtRegOrUnit VRegOrUnit, const TargetRegisterInfo *TRI)
Create Printable object to print virtual registers and physical registers on a raw_ostream.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:880
#define N
RegisterPressure computed within a region of instructions delimited by TopIdx and BottomIdx.
LLVM_ABI void reset()
Clear the result so it can be used for another round of pressure tracking.
LLVM_ABI void openBottom(SlotIndex PrevBottom)
If the current bottom is not greater than the previous index, open it.
SlotIndex TopIdx
Record the boundary of the region being tracked.
LLVM_ABI void openTop(SlotIndex NextTop)
If the current top is not less than or equal to the next index, open it.
static constexpr LaneBitmask getAll()
Definition LaneBitmask.h:82
constexpr bool none() const
Definition LaneBitmask.h:52
constexpr bool any() const
Definition LaneBitmask.h:53
static constexpr LaneBitmask getNone()
Definition LaneBitmask.h:81
This represents a simple continuous liveness interval for a value.
Store the effects of a change in pressure on things that MI scheduler cares about.
LLVM_ABI void dump() const
RegisterPressure computed within a region of instructions delimited by TopPos and BottomPos.
MachineBasicBlock::const_iterator TopPos
Record the boundary of the region being tracked.
MachineBasicBlock::const_iterator BottomPos
LLVM_ABI void openTop(MachineBasicBlock::const_iterator PrevTop)
If the current top is the previous instruction (before receding), open it.
LLVM_ABI void reset()
Clear the result so it can be used for another round of pressure tracking.
LLVM_ABI void openBottom(MachineBasicBlock::const_iterator PrevBottom)
If the current bottom is the previous instr (before advancing), open it.
SmallVector< VRegMaskOrUnit, 8 > LiveOutRegs
SmallVector< VRegMaskOrUnit, 8 > LiveInRegs
List of live in virtual registers or physical register units.
LLVM_ABI void dump(const TargetRegisterInfo *TRI) const
std::vector< unsigned > MaxSetPressure
Map of max reg pressure indexed by pressure set ID, not class ID.