@@ -710,7 +710,7 @@ void SwingSchedulerDAG::schedule() {
710710 Stages[SU->getInstr ()] = Schedule.stageScheduled (SU);
711711 }
712712 }
713- DenseMap<MachineInstr *, std::pair<unsigned , int64_t >> NewInstrChanges;
713+ DenseMap<MachineInstr *, std::pair<Register , int64_t >> NewInstrChanges;
714714 for (auto &KV : NewMIs) {
715715 Cycles[KV.first ] = Cycles[KV.second ];
716716 Stages[KV.first ] = Stages[KV.second ];
@@ -756,27 +756,27 @@ void SwingSchedulerDAG::finishBlock() {
756756// / Return the register values for the operands of a Phi instruction.
757757// / This function assume the instruction is a Phi.
758758static void getPhiRegs (MachineInstr &Phi, MachineBasicBlock *Loop,
759- unsigned &InitVal, unsigned &LoopVal) {
759+ Register &InitVal, Register &LoopVal) {
760760 assert (Phi.isPHI () && " Expecting a Phi." );
761761
762- InitVal = 0 ;
763- LoopVal = 0 ;
762+ InitVal = Register () ;
763+ LoopVal = Register () ;
764764 for (unsigned i = 1 , e = Phi.getNumOperands (); i != e; i += 2 )
765765 if (Phi.getOperand (i + 1 ).getMBB () != Loop)
766766 InitVal = Phi.getOperand (i).getReg ();
767767 else
768768 LoopVal = Phi.getOperand (i).getReg ();
769769
770- assert (InitVal != 0 && LoopVal != 0 && " Unexpected Phi structure." );
770+ assert (InitVal && LoopVal && " Unexpected Phi structure." );
771771}
772772
773773// / Return the Phi register value that comes the loop block.
774- static unsigned getLoopPhiReg (const MachineInstr &Phi,
774+ static Register getLoopPhiReg (const MachineInstr &Phi,
775775 const MachineBasicBlock *LoopBB) {
776776 for (unsigned i = 1 , e = Phi.getNumOperands (); i != e; i += 2 )
777777 if (Phi.getOperand (i + 1 ).getMBB () == LoopBB)
778778 return Phi.getOperand (i).getReg ();
779- return 0 ;
779+ return Register () ;
780780}
781781
782782// / Return true if SUb can be reached from SUa following the chain edges.
@@ -937,8 +937,8 @@ void SwingSchedulerDAG::updatePhiDependences() {
937937 for (SUnit &I : SUnits) {
938938 RemoveDeps.clear ();
939939 // 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;
942942 MachineInstr *MI = I.getInstr ();
943943 // Iterate over each operand, and we process the definitions.
944944 for (const MachineOperand &MO : MI->operands ()) {
@@ -1017,7 +1017,8 @@ void SwingSchedulerDAG::changeDependences() {
10171017 // If so, we update the base and offset of the instruction and change
10181018 // the dependences.
10191019 for (SUnit &I : SUnits) {
1020- unsigned BasePos = 0 , OffsetPos = 0 , NewBase = 0 ;
1020+ unsigned BasePos = 0 , OffsetPos = 0 ;
1021+ Register NewBase;
10211022 int64_t NewOffset = 0 ;
10221023 if (!canUseLastOffsetValue (I.getInstr (), BasePos, OffsetPos, NewBase,
10231024 NewOffset))
@@ -1982,7 +1983,7 @@ static void computeLiveOuts(MachineFunction &MF, RegPressureTracker &RPTracker,
19821983 const TargetRegisterInfo *TRI = MF.getSubtarget ().getRegisterInfo ();
19831984 MachineRegisterInfo &MRI = MF.getRegInfo ();
19841985 SmallVector<VRegMaskOrUnit, 8 > LiveOutRegs;
1985- SmallSet<unsigned , 4 > Uses;
1986+ SmallSet<Register , 4 > Uses;
19861987 for (SUnit *SU : NS) {
19871988 const MachineInstr *MI = SU->getInstr ();
19881989 if (MI->isPHI ())
@@ -2646,7 +2647,7 @@ bool SwingSchedulerDAG::computeDelta(const MachineInstr &MI, int &Delta) const {
26462647bool SwingSchedulerDAG::canUseLastOffsetValue (MachineInstr *MI,
26472648 unsigned &BasePos,
26482649 unsigned &OffsetPos,
2649- unsigned &NewBase,
2650+ Register &NewBase,
26502651 int64_t &Offset) {
26512652 // Get the load instruction.
26522653 if (TII->isPostIncrement (*MI))
@@ -2662,7 +2663,7 @@ bool SwingSchedulerDAG::canUseLastOffsetValue(MachineInstr *MI,
26622663 if (!Phi || !Phi->isPHI ())
26632664 return false ;
26642665 // Get the register defined in the loop block.
2665- unsigned PrevReg = getLoopPhiReg (*Phi, MI->getParent ());
2666+ Register PrevReg = getLoopPhiReg (*Phi, MI->getParent ());
26662667 if (!PrevReg)
26672668 return false ;
26682669
@@ -2702,10 +2703,10 @@ bool SwingSchedulerDAG::canUseLastOffsetValue(MachineInstr *MI,
27022703void SwingSchedulerDAG::applyInstrChange (MachineInstr *MI,
27032704 SMSchedule &Schedule) {
27042705 SUnit *SU = getSUnit (MI);
2705- DenseMap<SUnit *, std::pair<unsigned , int64_t >>::iterator It =
2706+ DenseMap<SUnit *, std::pair<Register , int64_t >>::iterator It =
27062707 InstrChanges.find (SU);
27072708 if (It != InstrChanges.end ()) {
2708- std::pair<unsigned , int64_t > RegAndOffset = It->second ;
2709+ std::pair<Register , int64_t > RegAndOffset = It->second ;
27092710 unsigned BasePos, OffsetPos;
27102711 if (!TII->getBaseAndOffsetPosition (*MI, BasePos, OffsetPos))
27112712 return ;
@@ -2789,10 +2790,10 @@ bool SwingSchedulerDAG::mayOverlapInLaterIter(
27892790 if (!DefB || !DefO || !DefB->isPHI () || !DefO->isPHI ())
27902791 return true ;
27912792
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;
27962797 getPhiRegs (*DefB, BB, InitValB, LoopValB);
27972798 getPhiRegs (*DefO, BB, InitValO, LoopValO);
27982799 MachineInstr *InitDefB = MRI.getVRegDef (InitValB);
@@ -3062,7 +3063,7 @@ void SMSchedule::orderDependence(const SwingSchedulerDAG *SSD, SUnit *SU,
30623063 unsigned BasePos, OffsetPos;
30633064 if (ST.getInstrInfo ()->getBaseAndOffsetPosition (*MI, BasePos, OffsetPos))
30643065 if (MI->getOperand (BasePos).getReg () == Reg)
3065- if (unsigned NewReg = SSD->getInstrBaseReg (SU))
3066+ if (Register NewReg = SSD->getInstrBaseReg (SU))
30663067 Reg = NewReg;
30673068 bool Reads, Writes;
30683069 std::tie (Reads, Writes) =
@@ -3180,8 +3181,8 @@ bool SMSchedule::isLoopCarried(const SwingSchedulerDAG *SSD,
31803181 unsigned DefCycle = cycleScheduled (DefSU);
31813182 int DefStage = stageScheduled (DefSU);
31823183
3183- unsigned InitVal = 0 ;
3184- unsigned LoopVal = 0 ;
3184+ Register InitVal;
3185+ Register LoopVal;
31853186 getPhiRegs (Phi, Phi.getParent (), InitVal, LoopVal);
31863187 SUnit *UseSU = SSD->getSUnit (MRI.getVRegDef (LoopVal));
31873188 if (!UseSU)
@@ -3212,7 +3213,7 @@ bool SMSchedule::isLoopCarriedDefOfUse(const SwingSchedulerDAG *SSD,
32123213 return false ;
32133214 if (!isLoopCarried (SSD, *Phi))
32143215 return false ;
3215- unsigned LoopReg = getLoopPhiReg (*Phi, Phi->getParent ());
3216+ Register LoopReg = getLoopPhiReg (*Phi, Phi->getParent ());
32163217 for (MachineOperand &DMO : Def->all_defs ()) {
32173218 if (DMO.getReg () == LoopReg)
32183219 return true ;
@@ -3434,8 +3435,8 @@ void SwingSchedulerDAG::checkValidNodeOrder(const NodeSetType &Circuits) const {
34343435// / In this case p and p' overlap, which means that two registers are needed.
34353436// / Instead, this function changes the load to use p' and updates the offset.
34363437void SwingSchedulerDAG::fixupRegisterOverlaps (std::deque<SUnit *> &Instrs) {
3437- unsigned OverlapReg = 0 ;
3438- unsigned NewBaseReg = 0 ;
3438+ Register OverlapReg;
3439+ Register NewBaseReg;
34393440 for (SUnit *SU : Instrs) {
34403441 MachineInstr *MI = SU->getInstr ();
34413442 for (unsigned i = 0 , e = MI->getNumOperands (); i < e; ++i) {
@@ -3445,8 +3446,8 @@ void SwingSchedulerDAG::fixupRegisterOverlaps(std::deque<SUnit *> &Instrs) {
34453446 if (MO.isReg () && MO.isUse () && MO.getReg () == OverlapReg) {
34463447 // Check that the instruction appears in the InstrChanges structure,
34473448 // 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);
34503451 if (It != InstrChanges.end ()) {
34513452 unsigned BasePos, OffsetPos;
34523453 // Update the base register and adjust the offset.
@@ -3461,8 +3462,8 @@ void SwingSchedulerDAG::fixupRegisterOverlaps(std::deque<SUnit *> &Instrs) {
34613462 NewMIs[MI] = NewMI;
34623463 }
34633464 }
3464- OverlapReg = 0 ;
3465- NewBaseReg = 0 ;
3465+ OverlapReg = Register () ;
3466+ NewBaseReg = Register () ;
34663467 break ;
34673468 }
34683469 // Look for an instruction of the form p' = op(p), which uses and defines
0 commit comments