@@ -710,7 +710,7 @@ void SwingSchedulerDAG::schedule() {
710
710
Stages[SU->getInstr ()] = Schedule.stageScheduled (SU);
711
711
}
712
712
}
713
- DenseMap<MachineInstr *, std::pair<unsigned , int64_t >> NewInstrChanges;
713
+ DenseMap<MachineInstr *, std::pair<Register , int64_t >> NewInstrChanges;
714
714
for (auto &KV : NewMIs) {
715
715
Cycles[KV.first ] = Cycles[KV.second ];
716
716
Stages[KV.first ] = Stages[KV.second ];
@@ -756,27 +756,27 @@ void SwingSchedulerDAG::finishBlock() {
756
756
// / Return the register values for the operands of a Phi instruction.
757
757
// / This function assume the instruction is a Phi.
758
758
static void getPhiRegs (MachineInstr &Phi, MachineBasicBlock *Loop,
759
- unsigned &InitVal, unsigned &LoopVal) {
759
+ Register &InitVal, Register &LoopVal) {
760
760
assert (Phi.isPHI () && " Expecting a Phi." );
761
761
762
- InitVal = 0 ;
763
- LoopVal = 0 ;
762
+ InitVal = Register () ;
763
+ LoopVal = Register () ;
764
764
for (unsigned i = 1 , e = Phi.getNumOperands (); i != e; i += 2 )
765
765
if (Phi.getOperand (i + 1 ).getMBB () != Loop)
766
766
InitVal = Phi.getOperand (i).getReg ();
767
767
else
768
768
LoopVal = Phi.getOperand (i).getReg ();
769
769
770
- assert (InitVal != 0 && LoopVal != 0 && " Unexpected Phi structure." );
770
+ assert (InitVal && LoopVal && " Unexpected Phi structure." );
771
771
}
772
772
773
773
// / Return the Phi register value that comes the loop block.
774
- static unsigned getLoopPhiReg (const MachineInstr &Phi,
774
+ static Register getLoopPhiReg (const MachineInstr &Phi,
775
775
const MachineBasicBlock *LoopBB) {
776
776
for (unsigned i = 1 , e = Phi.getNumOperands (); i != e; i += 2 )
777
777
if (Phi.getOperand (i + 1 ).getMBB () == LoopBB)
778
778
return Phi.getOperand (i).getReg ();
779
- return 0 ;
779
+ return Register () ;
780
780
}
781
781
782
782
// / Return true if SUb can be reached from SUa following the chain edges.
@@ -937,8 +937,8 @@ void SwingSchedulerDAG::updatePhiDependences() {
937
937
for (SUnit &I : SUnits) {
938
938
RemoveDeps.clear ();
939
939
// Set to true if the instruction has an operand defined by a Phi.
940
- unsigned HasPhiUse = 0 ;
941
- unsigned HasPhiDef = 0 ;
940
+ Register HasPhiUse;
941
+ Register HasPhiDef;
942
942
MachineInstr *MI = I.getInstr ();
943
943
// Iterate over each operand, and we process the definitions.
944
944
for (const MachineOperand &MO : MI->operands ()) {
@@ -1017,7 +1017,8 @@ void SwingSchedulerDAG::changeDependences() {
1017
1017
// If so, we update the base and offset of the instruction and change
1018
1018
// the dependences.
1019
1019
for (SUnit &I : SUnits) {
1020
- unsigned BasePos = 0 , OffsetPos = 0 , NewBase = 0 ;
1020
+ unsigned BasePos = 0 , OffsetPos = 0 ;
1021
+ Register NewBase;
1021
1022
int64_t NewOffset = 0 ;
1022
1023
if (!canUseLastOffsetValue (I.getInstr (), BasePos, OffsetPos, NewBase,
1023
1024
NewOffset))
@@ -1982,7 +1983,7 @@ static void computeLiveOuts(MachineFunction &MF, RegPressureTracker &RPTracker,
1982
1983
const TargetRegisterInfo *TRI = MF.getSubtarget ().getRegisterInfo ();
1983
1984
MachineRegisterInfo &MRI = MF.getRegInfo ();
1984
1985
SmallVector<VRegMaskOrUnit, 8 > LiveOutRegs;
1985
- SmallSet<unsigned , 4 > Uses;
1986
+ SmallSet<Register , 4 > Uses;
1986
1987
for (SUnit *SU : NS) {
1987
1988
const MachineInstr *MI = SU->getInstr ();
1988
1989
if (MI->isPHI ())
@@ -2646,7 +2647,7 @@ bool SwingSchedulerDAG::computeDelta(const MachineInstr &MI, int &Delta) const {
2646
2647
bool SwingSchedulerDAG::canUseLastOffsetValue (MachineInstr *MI,
2647
2648
unsigned &BasePos,
2648
2649
unsigned &OffsetPos,
2649
- unsigned &NewBase,
2650
+ Register &NewBase,
2650
2651
int64_t &Offset) {
2651
2652
// Get the load instruction.
2652
2653
if (TII->isPostIncrement (*MI))
@@ -2662,7 +2663,7 @@ bool SwingSchedulerDAG::canUseLastOffsetValue(MachineInstr *MI,
2662
2663
if (!Phi || !Phi->isPHI ())
2663
2664
return false ;
2664
2665
// Get the register defined in the loop block.
2665
- unsigned PrevReg = getLoopPhiReg (*Phi, MI->getParent ());
2666
+ Register PrevReg = getLoopPhiReg (*Phi, MI->getParent ());
2666
2667
if (!PrevReg)
2667
2668
return false ;
2668
2669
@@ -2702,10 +2703,10 @@ bool SwingSchedulerDAG::canUseLastOffsetValue(MachineInstr *MI,
2702
2703
void SwingSchedulerDAG::applyInstrChange (MachineInstr *MI,
2703
2704
SMSchedule &Schedule) {
2704
2705
SUnit *SU = getSUnit (MI);
2705
- DenseMap<SUnit *, std::pair<unsigned , int64_t >>::iterator It =
2706
+ DenseMap<SUnit *, std::pair<Register , int64_t >>::iterator It =
2706
2707
InstrChanges.find (SU);
2707
2708
if (It != InstrChanges.end ()) {
2708
- std::pair<unsigned , int64_t > RegAndOffset = It->second ;
2709
+ std::pair<Register , int64_t > RegAndOffset = It->second ;
2709
2710
unsigned BasePos, OffsetPos;
2710
2711
if (!TII->getBaseAndOffsetPosition (*MI, BasePos, OffsetPos))
2711
2712
return ;
@@ -2789,10 +2790,10 @@ bool SwingSchedulerDAG::mayOverlapInLaterIter(
2789
2790
if (!DefB || !DefO || !DefB->isPHI () || !DefO->isPHI ())
2790
2791
return true ;
2791
2792
2792
- unsigned InitValB = 0 ;
2793
- unsigned LoopValB = 0 ;
2794
- unsigned InitValO = 0 ;
2795
- unsigned LoopValO = 0 ;
2793
+ Register InitValB;
2794
+ Register LoopValB;
2795
+ Register InitValO;
2796
+ Register LoopValO;
2796
2797
getPhiRegs (*DefB, BB, InitValB, LoopValB);
2797
2798
getPhiRegs (*DefO, BB, InitValO, LoopValO);
2798
2799
MachineInstr *InitDefB = MRI.getVRegDef (InitValB);
@@ -3062,7 +3063,7 @@ void SMSchedule::orderDependence(const SwingSchedulerDAG *SSD, SUnit *SU,
3062
3063
unsigned BasePos, OffsetPos;
3063
3064
if (ST.getInstrInfo ()->getBaseAndOffsetPosition (*MI, BasePos, OffsetPos))
3064
3065
if (MI->getOperand (BasePos).getReg () == Reg)
3065
- if (unsigned NewReg = SSD->getInstrBaseReg (SU))
3066
+ if (Register NewReg = SSD->getInstrBaseReg (SU))
3066
3067
Reg = NewReg;
3067
3068
bool Reads, Writes;
3068
3069
std::tie (Reads, Writes) =
@@ -3180,8 +3181,8 @@ bool SMSchedule::isLoopCarried(const SwingSchedulerDAG *SSD,
3180
3181
unsigned DefCycle = cycleScheduled (DefSU);
3181
3182
int DefStage = stageScheduled (DefSU);
3182
3183
3183
- unsigned InitVal = 0 ;
3184
- unsigned LoopVal = 0 ;
3184
+ Register InitVal;
3185
+ Register LoopVal;
3185
3186
getPhiRegs (Phi, Phi.getParent (), InitVal, LoopVal);
3186
3187
SUnit *UseSU = SSD->getSUnit (MRI.getVRegDef (LoopVal));
3187
3188
if (!UseSU)
@@ -3212,7 +3213,7 @@ bool SMSchedule::isLoopCarriedDefOfUse(const SwingSchedulerDAG *SSD,
3212
3213
return false ;
3213
3214
if (!isLoopCarried (SSD, *Phi))
3214
3215
return false ;
3215
- unsigned LoopReg = getLoopPhiReg (*Phi, Phi->getParent ());
3216
+ Register LoopReg = getLoopPhiReg (*Phi, Phi->getParent ());
3216
3217
for (MachineOperand &DMO : Def->all_defs ()) {
3217
3218
if (DMO.getReg () == LoopReg)
3218
3219
return true ;
@@ -3434,8 +3435,8 @@ void SwingSchedulerDAG::checkValidNodeOrder(const NodeSetType &Circuits) const {
3434
3435
// / In this case p and p' overlap, which means that two registers are needed.
3435
3436
// / Instead, this function changes the load to use p' and updates the offset.
3436
3437
void SwingSchedulerDAG::fixupRegisterOverlaps (std::deque<SUnit *> &Instrs) {
3437
- unsigned OverlapReg = 0 ;
3438
- unsigned NewBaseReg = 0 ;
3438
+ Register OverlapReg;
3439
+ Register NewBaseReg;
3439
3440
for (SUnit *SU : Instrs) {
3440
3441
MachineInstr *MI = SU->getInstr ();
3441
3442
for (unsigned i = 0 , e = MI->getNumOperands (); i < e; ++i) {
@@ -3445,8 +3446,8 @@ void SwingSchedulerDAG::fixupRegisterOverlaps(std::deque<SUnit *> &Instrs) {
3445
3446
if (MO.isReg () && MO.isUse () && MO.getReg () == OverlapReg) {
3446
3447
// Check that the instruction appears in the InstrChanges structure,
3447
3448
// which contains instructions that can have the offset updated.
3448
- DenseMap<SUnit *, std::pair<unsigned , int64_t >>::iterator It =
3449
- InstrChanges.find (SU);
3449
+ DenseMap<SUnit *, std::pair<Register , int64_t >>::iterator It =
3450
+ InstrChanges.find (SU);
3450
3451
if (It != InstrChanges.end ()) {
3451
3452
unsigned BasePos, OffsetPos;
3452
3453
// Update the base register and adjust the offset.
@@ -3461,8 +3462,8 @@ void SwingSchedulerDAG::fixupRegisterOverlaps(std::deque<SUnit *> &Instrs) {
3461
3462
NewMIs[MI] = NewMI;
3462
3463
}
3463
3464
}
3464
- OverlapReg = 0 ;
3465
- NewBaseReg = 0 ;
3465
+ OverlapReg = Register () ;
3466
+ NewBaseReg = Register () ;
3466
3467
break ;
3467
3468
}
3468
3469
// Look for an instruction of the form p' = op(p), which uses and defines
0 commit comments