@@ -219,10 +219,10 @@ class RegAllocFastImpl {
219219 // / Stores assigned virtual registers present in the bundle MI.
220220 DenseMap<Register, LiveReg> BundleVirtRegsMap;
221221
222- DenseMap<unsigned , SmallVector<MachineOperand *, 2 >> LiveDbgValueMap;
222+ DenseMap<Register , SmallVector<MachineOperand *, 2 >> LiveDbgValueMap;
223223 // / List of DBG_VALUE that we encountered without the vreg being assigned
224224 // / because they were placed after the last use of the vreg.
225- DenseMap<unsigned , SmallVector<MachineInstr *, 1 >> DanglingDbgValues;
225+ DenseMap<Register , SmallVector<MachineInstr *, 1 >> DanglingDbgValues;
226226
227227 // / Has a bit set for every virtual register for which it was determined
228228 // / that it is alive across blocks.
@@ -276,7 +276,7 @@ class RegAllocFastImpl {
276276 InstrPosIndexes PosIndexes;
277277
278278 void setPhysRegState (MCRegister PhysReg, unsigned NewState);
279- bool isPhysRegFree (MCPhysReg PhysReg) const ;
279+ bool isPhysRegFree (MCRegister PhysReg) const ;
280280
281281 // / Mark a physreg as used in this instruction.
282282 void markRegUsedInInstr (MCPhysReg PhysReg) {
@@ -285,14 +285,14 @@ class RegAllocFastImpl {
285285 }
286286
287287 // Check if physreg is clobbered by instruction's regmask(s).
288- bool isClobberedByRegMasks (MCPhysReg PhysReg) const {
288+ bool isClobberedByRegMasks (MCRegister PhysReg) const {
289289 return llvm::any_of (RegMasks, [PhysReg](const uint32_t *Mask) {
290290 return MachineOperand::clobbersPhysReg (Mask, PhysReg);
291291 });
292292 }
293293
294294 // / Check if a physreg or any of its aliases are used in this instruction.
295- bool isRegUsedInInstr (MCPhysReg PhysReg, bool LookAtPhysRegUses) const {
295+ bool isRegUsedInInstr (MCRegister PhysReg, bool LookAtPhysRegUses) const {
296296 if (LookAtPhysRegUses && isClobberedByRegMasks (PhysReg))
297297 return true ;
298298 for (MCRegUnit Unit : TRI->regunits (PhysReg))
@@ -303,15 +303,15 @@ class RegAllocFastImpl {
303303
304304 // / Mark physical register as being used in a register use operand.
305305 // / This is only used by the special livethrough handling code.
306- void markPhysRegUsedInInstr (MCPhysReg PhysReg) {
306+ void markPhysRegUsedInInstr (MCRegister PhysReg) {
307307 for (MCRegUnit Unit : TRI->regunits (PhysReg)) {
308308 assert (UsedInInstr[Unit] <= InstrGen && " non-phys use before phys use?" );
309309 UsedInInstr[Unit] = InstrGen;
310310 }
311311 }
312312
313313 // / Remove mark of physical register being used in the instruction.
314- void unmarkRegUsedInInstr (MCPhysReg PhysReg) {
314+ void unmarkRegUsedInInstr (MCRegister PhysReg) {
315315 for (MCRegUnit Unit : TRI->regunits (PhysReg))
316316 UsedInInstr[Unit] = 0 ;
317317 }
@@ -340,10 +340,10 @@ class RegAllocFastImpl {
340340 void handleDebugValue (MachineInstr &MI);
341341 void handleBundle (MachineInstr &MI);
342342
343- bool usePhysReg (MachineInstr &MI, MCPhysReg PhysReg);
344- bool definePhysReg (MachineInstr &MI, MCPhysReg PhysReg);
345- bool displacePhysReg (MachineInstr &MI, MCPhysReg PhysReg);
346- void freePhysReg (MCPhysReg PhysReg);
343+ bool usePhysReg (MachineInstr &MI, MCRegister PhysReg);
344+ bool definePhysReg (MachineInstr &MI, MCRegister PhysReg);
345+ bool displacePhysReg (MachineInstr &MI, MCRegister PhysReg);
346+ void freePhysReg (MCRegister PhysReg);
347347
348348 unsigned calcSpillCost (MCPhysReg PhysReg) const ;
349349
@@ -355,12 +355,12 @@ class RegAllocFastImpl {
355355 return LiveVirtRegs.find (VirtReg.virtRegIndex ());
356356 }
357357
358- void assignVirtToPhysReg (MachineInstr &MI, LiveReg &, MCPhysReg PhysReg);
358+ void assignVirtToPhysReg (MachineInstr &MI, LiveReg &, MCRegister PhysReg);
359359 void allocVirtReg (MachineInstr &MI, LiveReg &LR, Register Hint,
360360 bool LookAtPhysRegUses = false );
361361 void allocVirtRegUndef (MachineOperand &MO);
362362 void assignDanglingDebugValues (MachineInstr &Def, Register VirtReg,
363- MCPhysReg Reg);
363+ MCRegister Reg);
364364 bool defineLiveThroughVirtReg (MachineInstr &MI, unsigned OpNum,
365365 Register VirtReg);
366366 bool defineVirtReg (MachineInstr &MI, unsigned OpNum, Register VirtReg,
@@ -454,7 +454,7 @@ void RegAllocFastImpl::setPhysRegState(MCRegister PhysReg, unsigned NewState) {
454454 RegUnitStates[Unit] = NewState;
455455}
456456
457- bool RegAllocFastImpl::isPhysRegFree (MCPhysReg PhysReg) const {
457+ bool RegAllocFastImpl::isPhysRegFree (MCRegister PhysReg) const {
458458 for (MCRegUnit Unit : TRI->regunits (PhysReg)) {
459459 if (RegUnitStates[Unit] != regFree)
460460 return false ;
@@ -709,15 +709,15 @@ void RegAllocFastImpl::reloadAtBegin(MachineBasicBlock &MBB) {
709709// / Handle the direct use of a physical register. Check that the register is
710710// / not used by a virtreg. Kill the physreg, marking it free. This may add
711711// / implicit kills to MO->getParent() and invalidate MO.
712- bool RegAllocFastImpl::usePhysReg (MachineInstr &MI, MCPhysReg Reg) {
712+ bool RegAllocFastImpl::usePhysReg (MachineInstr &MI, MCRegister Reg) {
713713 assert (Register::isPhysicalRegister (Reg) && " expected physreg" );
714714 bool displacedAny = displacePhysReg (MI, Reg);
715715 setPhysRegState (Reg, regPreAssigned);
716716 markRegUsedInInstr (Reg);
717717 return displacedAny;
718718}
719719
720- bool RegAllocFastImpl::definePhysReg (MachineInstr &MI, MCPhysReg Reg) {
720+ bool RegAllocFastImpl::definePhysReg (MachineInstr &MI, MCRegister Reg) {
721721 bool displacedAny = displacePhysReg (MI, Reg);
722722 setPhysRegState (Reg, regPreAssigned);
723723 return displacedAny;
@@ -726,7 +726,7 @@ bool RegAllocFastImpl::definePhysReg(MachineInstr &MI, MCPhysReg Reg) {
726726// / Mark PhysReg as reserved or free after spilling any virtregs. This is very
727727// / similar to defineVirtReg except the physreg is reserved instead of
728728// / allocated.
729- bool RegAllocFastImpl::displacePhysReg (MachineInstr &MI, MCPhysReg PhysReg) {
729+ bool RegAllocFastImpl::displacePhysReg (MachineInstr &MI, MCRegister PhysReg) {
730730 bool displacedAny = false ;
731731
732732 for (MCRegUnit Unit : TRI->regunits (PhysReg)) {
@@ -755,7 +755,7 @@ bool RegAllocFastImpl::displacePhysReg(MachineInstr &MI, MCPhysReg PhysReg) {
755755 return displacedAny;
756756}
757757
758- void RegAllocFastImpl::freePhysReg (MCPhysReg PhysReg) {
758+ void RegAllocFastImpl::freePhysReg (MCRegister PhysReg) {
759759 LLVM_DEBUG (dbgs () << " Freeing " << printReg (PhysReg, TRI) << ' :' );
760760
761761 MCRegUnit FirstUnit = *TRI->regunits (PhysReg).begin ();
@@ -803,7 +803,7 @@ unsigned RegAllocFastImpl::calcSpillCost(MCPhysReg PhysReg) const {
803803
804804void RegAllocFastImpl::assignDanglingDebugValues (MachineInstr &Definition,
805805 Register VirtReg,
806- MCPhysReg Reg) {
806+ MCRegister Reg) {
807807 auto UDBGValIter = DanglingDbgValues.find (VirtReg);
808808 if (UDBGValIter == DanglingDbgValues.end ())
809809 return ;
@@ -840,14 +840,14 @@ void RegAllocFastImpl::assignDanglingDebugValues(MachineInstr &Definition,
840840// / proper container for VirtReg now. The physical register must not be used
841841// / for anything else when this is called.
842842void RegAllocFastImpl::assignVirtToPhysReg (MachineInstr &AtMI, LiveReg &LR,
843- MCPhysReg PhysReg) {
843+ MCRegister PhysReg) {
844844 Register VirtReg = LR.VirtReg ;
845845 LLVM_DEBUG (dbgs () << " Assigning " << printReg (VirtReg, TRI) << " to "
846846 << printReg (PhysReg, TRI) << ' \n ' );
847847 assert (LR.PhysReg == 0 && " Already assigned a physreg" );
848848 assert (PhysReg != 0 && " Trying to assign no register" );
849849 LR.PhysReg = PhysReg;
850- setPhysRegState (PhysReg, VirtReg);
850+ setPhysRegState (PhysReg, VirtReg. id () );
851851
852852 assignDanglingDebugValues (AtMI, VirtReg, PhysReg);
853853}
0 commit comments