@@ -701,17 +701,15 @@ static void updatePhysDepsDownwards(const MachineInstr *UseMI,
701
701
SmallVectorImpl<DataDep> &Deps,
702
702
SparseSet<LiveRegUnit> &RegUnits,
703
703
const TargetRegisterInfo *TRI) {
704
- SmallVector<unsigned , 8 > Kills;
704
+ SmallVector<MCRegister , 8 > Kills;
705
705
SmallVector<unsigned , 8 > LiveDefOps;
706
706
707
707
for (MachineInstr::const_mop_iterator MI = UseMI->operands_begin (),
708
708
ME = UseMI->operands_end (); MI != ME; ++MI) {
709
709
const MachineOperand &MO = *MI;
710
- if (!MO.isReg ())
711
- continue ;
712
- Register Reg = MO.getReg ();
713
- if (!Register::isPhysicalRegister (Reg))
710
+ if (!MO.isReg () || !MO.getReg ().isPhysical ())
714
711
continue ;
712
+ MCRegister Reg = MO.getReg ().asMCReg ();
715
713
// Track live defs and kills for updating RegUnits.
716
714
if (MO.isDef ()) {
717
715
if (MO.isDead ())
@@ -734,13 +732,14 @@ static void updatePhysDepsDownwards(const MachineInstr *UseMI,
734
732
735
733
// Update RegUnits to reflect live registers after UseMI.
736
734
// First kills.
737
- for (unsigned Kill : Kills)
735
+ for (MCRegister Kill : Kills)
738
736
for (MCRegUnitIterator Units (Kill, TRI); Units.isValid (); ++Units)
739
737
RegUnits.erase (*Units);
740
738
741
739
// Second, live defs.
742
740
for (unsigned DefOp : LiveDefOps) {
743
- for (MCRegUnitIterator Units (UseMI->getOperand (DefOp).getReg (), TRI);
741
+ for (MCRegUnitIterator Units (UseMI->getOperand (DefOp).getReg ().asMCReg (),
742
+ TRI);
744
743
Units.isValid (); ++Units) {
745
744
LiveRegUnit &LRU = RegUnits[*Units];
746
745
LRU.MI = UseMI;
@@ -766,7 +765,7 @@ computeCrossBlockCriticalPath(const TraceBlockInfo &TBI) {
766
765
assert (TBI.HasValidInstrHeights && " Missing height info" );
767
766
unsigned MaxLen = 0 ;
768
767
for (const LiveInReg &LIR : TBI.LiveIns ) {
769
- if (!Register::isVirtualRegister ( LIR.Reg ))
768
+ if (!LIR.Reg . isVirtual ( ))
770
769
continue ;
771
770
const MachineInstr *DefMI = MTM.MRI ->getVRegDef (LIR.Reg );
772
771
// Ignore dependencies outside the current trace.
@@ -912,7 +911,8 @@ static unsigned updatePhysDepsUpwards(const MachineInstr &MI, unsigned Height,
912
911
continue ;
913
912
// This is a def of Reg. Remove corresponding entries from RegUnits, and
914
913
// update MI Height to consider the physreg dependencies.
915
- for (MCRegUnitIterator Units (Reg, TRI); Units.isValid (); ++Units) {
914
+ for (MCRegUnitIterator Units (Reg.asMCReg (), TRI); Units.isValid ();
915
+ ++Units) {
916
916
SparseSet<LiveRegUnit>::iterator I = RegUnits.find (*Units);
917
917
if (I == RegUnits.end ())
918
918
continue ;
@@ -930,15 +930,15 @@ static unsigned updatePhysDepsUpwards(const MachineInstr &MI, unsigned Height,
930
930
}
931
931
932
932
// Now we know the height of MI. Update any regunits read.
933
- for (unsigned i = 0 , e = ReadOps.size (); i != e ; ++i ) {
934
- Register Reg = MI.getOperand (ReadOps[i ]).getReg ();
933
+ for (size_t I = 0 , E = ReadOps.size (); I != E ; ++I ) {
934
+ MCRegister Reg = MI.getOperand (ReadOps[I ]).getReg (). asMCReg ();
935
935
for (MCRegUnitIterator Units (Reg, TRI); Units.isValid (); ++Units) {
936
936
LiveRegUnit &LRU = RegUnits[*Units];
937
937
// Set the height to the highest reader of the unit.
938
938
if (LRU.Cycle <= Height && LRU.MI != &MI) {
939
939
LRU.Cycle = Height;
940
940
LRU.MI = &MI;
941
- LRU.Op = ReadOps[i ];
941
+ LRU.Op = ReadOps[I ];
942
942
}
943
943
}
944
944
}
@@ -979,7 +979,7 @@ void MachineTraceMetrics::Ensemble::
979
979
addLiveIns (const MachineInstr *DefMI, unsigned DefOp,
980
980
ArrayRef<const MachineBasicBlock*> Trace) {
981
981
assert (!Trace.empty () && " Trace should contain at least one block" );
982
- unsigned Reg = DefMI->getOperand (DefOp).getReg ();
982
+ Register Reg = DefMI->getOperand (DefOp).getReg ();
983
983
assert (Register::isVirtualRegister (Reg));
984
984
const MachineBasicBlock *DefMBB = DefMI->getParent ();
985
985
@@ -1027,7 +1027,7 @@ computeInstrHeights(const MachineBasicBlock *MBB) {
1027
1027
if (MBB) {
1028
1028
TraceBlockInfo &TBI = BlockInfo[MBB->getNumber ()];
1029
1029
for (LiveInReg &LI : TBI.LiveIns ) {
1030
- if (Register::isVirtualRegister ( LI.Reg )) {
1030
+ if (LI.Reg . isVirtual ( )) {
1031
1031
// For virtual registers, the def latency is included.
1032
1032
unsigned &Height = Heights[MTM.MRI ->getVRegDef (LI.Reg )];
1033
1033
if (Height < LI.Height )
0 commit comments