@@ -169,7 +169,7 @@ class MachineSinking : public MachineFunctionPass {
169169
170170 // / Record of DBG_VALUE uses of vregs in a block, so that we can identify
171171 // / debug instructions to sink.
172- SmallDenseMap<unsigned , TinyPtrVector<SeenDbgUser>> SeenDbgUsers;
172+ SmallDenseMap<Register , TinyPtrVector<SeenDbgUser>> SeenDbgUsers;
173173
174174 // / Record of debug variables that have had their locations set in the
175175 // / current block.
@@ -1518,7 +1518,7 @@ static bool attemptDebugCopyProp(MachineInstr &SinkInst, MachineInstr &DbgMI,
15181518 return true ;
15191519}
15201520
1521- using MIRegs = std::pair<MachineInstr *, SmallVector<unsigned , 2 >>;
1521+ using MIRegs = std::pair<MachineInstr *, SmallVector<Register , 2 >>;
15221522// / Sink an instruction and its associated debug instructions.
15231523static void performSink (MachineInstr &MI, MachineBasicBlock &SuccToSinkTo,
15241524 MachineBasicBlock::iterator InsertPos,
@@ -1547,7 +1547,7 @@ static void performSink(MachineInstr &MI, MachineBasicBlock &SuccToSinkTo,
15471547 SuccToSinkTo.insert (InsertPos, NewDbgMI);
15481548
15491549 bool PropagatedAllSunkOps = true ;
1550- for (unsigned Reg : DbgValueToSink.second ) {
1550+ for (Register Reg : DbgValueToSink.second ) {
15511551 if (DbgMI->hasDebugOperandForReg (Reg)) {
15521552 if (!attemptDebugCopyProp (MI, *DbgMI, Reg)) {
15531553 PropagatedAllSunkOps = false ;
@@ -1883,7 +1883,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
18831883 DbgMI->setDebugValueUndef ();
18841884 } else {
18851885 DbgUsersToSink.push_back (
1886- {DbgMI, SmallVector<unsigned , 2 >(1 , MO.getReg ())});
1886+ {DbgMI, SmallVector<Register , 2 >(1 , MO.getReg ())});
18871887 }
18881888 }
18891889 }
@@ -2010,7 +2010,7 @@ class PostRAMachineSinking : public MachineFunctionPass {
20102010 // / entry in this map for each unit it touches. The DBG_VALUE's entry
20112011 // / consists of a pointer to the instruction itself, and a vector of registers
20122012 // / referred to by the instruction that overlap the key register unit.
2013- DenseMap<unsigned , SmallVector<MIRegs, 2 >> SeenDbgInstrs;
2013+ DenseMap<MCRegUnit , SmallVector<MIRegs, 2 >> SeenDbgInstrs;
20142014
20152015 // / Sink Copy instructions unused in the same block close to their uses in
20162016 // / successors.
@@ -2025,7 +2025,7 @@ char &llvm::PostRAMachineSinkingID = PostRAMachineSinking::ID;
20252025INITIALIZE_PASS (PostRAMachineSinking, " postra-machine-sink" ,
20262026 " PostRA Machine Sink" , false , false )
20272027
2028- static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB, unsigned Reg,
2028+ static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB, Register Reg,
20292029 const TargetRegisterInfo *TRI) {
20302030 LiveRegUnits LiveInRegUnits (*TRI);
20312031 LiveInRegUnits.addLiveIns (MBB);
@@ -2035,7 +2035,7 @@ static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB, unsigned Reg,
20352035static MachineBasicBlock *
20362036getSingleLiveInSuccBB (MachineBasicBlock &CurBB,
20372037 const SmallPtrSetImpl<MachineBasicBlock *> &SinkableBBs,
2038- unsigned Reg, const TargetRegisterInfo *TRI) {
2038+ Register Reg, const TargetRegisterInfo *TRI) {
20392039 // Try to find a single sinkable successor in which Reg is live-in.
20402040 MachineBasicBlock *BB = nullptr ;
20412041 for (auto *SI : SinkableBBs) {
@@ -2062,7 +2062,7 @@ getSingleLiveInSuccBB(MachineBasicBlock &CurBB,
20622062static MachineBasicBlock *
20632063getSingleLiveInSuccBB (MachineBasicBlock &CurBB,
20642064 const SmallPtrSetImpl<MachineBasicBlock *> &SinkableBBs,
2065- ArrayRef<unsigned > DefedRegsInCopy,
2065+ ArrayRef<Register > DefedRegsInCopy,
20662066 const TargetRegisterInfo *TRI) {
20672067 MachineBasicBlock *SingleBB = nullptr ;
20682068 for (auto DefReg : DefedRegsInCopy) {
@@ -2076,8 +2076,8 @@ getSingleLiveInSuccBB(MachineBasicBlock &CurBB,
20762076}
20772077
20782078static void clearKillFlags (MachineInstr *MI, MachineBasicBlock &CurBB,
2079- SmallVectorImpl<unsigned > &UsedOpsInCopy,
2080- LiveRegUnits &UsedRegUnits,
2079+ const SmallVectorImpl<unsigned > &UsedOpsInCopy,
2080+ const LiveRegUnits &UsedRegUnits,
20812081 const TargetRegisterInfo *TRI) {
20822082 for (auto U : UsedOpsInCopy) {
20832083 MachineOperand &MO = MI->getOperand (U);
@@ -2096,11 +2096,11 @@ static void clearKillFlags(MachineInstr *MI, MachineBasicBlock &CurBB,
20962096}
20972097
20982098static void updateLiveIn (MachineInstr *MI, MachineBasicBlock *SuccBB,
2099- SmallVectorImpl<unsigned > &UsedOpsInCopy,
2100- SmallVectorImpl<unsigned > &DefedRegsInCopy) {
2099+ const SmallVectorImpl<unsigned > &UsedOpsInCopy,
2100+ const SmallVectorImpl<Register > &DefedRegsInCopy) {
21012101 MachineFunction &MF = *SuccBB->getParent ();
21022102 const TargetRegisterInfo *TRI = MF.getSubtarget ().getRegisterInfo ();
2103- for (unsigned DefReg : DefedRegsInCopy)
2103+ for (Register DefReg : DefedRegsInCopy)
21042104 for (MCPhysReg S : TRI->subregs_inclusive (DefReg))
21052105 SuccBB->removeLiveIn (S);
21062106 for (auto U : UsedOpsInCopy)
@@ -2110,7 +2110,7 @@ static void updateLiveIn(MachineInstr *MI, MachineBasicBlock *SuccBB,
21102110
21112111static bool hasRegisterDependency (MachineInstr *MI,
21122112 SmallVectorImpl<unsigned > &UsedOpsInCopy,
2113- SmallVectorImpl<unsigned > &DefedRegsInCopy,
2113+ SmallVectorImpl<Register > &DefedRegsInCopy,
21142114 LiveRegUnits &ModifiedRegUnits,
21152115 LiveRegUnits &UsedRegUnits) {
21162116 bool HasRegDependency = false ;
@@ -2170,12 +2170,12 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
21702170 // Track the operand index for use in Copy.
21712171 SmallVector<unsigned , 2 > UsedOpsInCopy;
21722172 // Track the register number defed in Copy.
2173- SmallVector<unsigned , 2 > DefedRegsInCopy;
2173+ SmallVector<Register , 2 > DefedRegsInCopy;
21742174
21752175 // We must sink this DBG_VALUE if its operand is sunk. To avoid searching
21762176 // for DBG_VALUEs later, record them when they're encountered.
21772177 if (MI.isDebugValue () && !MI.isDebugRef ()) {
2178- SmallDenseMap<MCRegister , SmallVector<unsigned , 2 >, 4 > MIUnits;
2178+ SmallDenseMap<MCRegUnit , SmallVector<Register , 2 >, 4 > MIUnits;
21792179 bool IsValid = true ;
21802180 for (MachineOperand &MO : MI.debug_operands ()) {
21812181 if (MO.isReg () && MO.getReg ().isPhysical ()) {
@@ -2242,7 +2242,7 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
22422242 for (MCRegUnit Unit : TRI->regunits (MO.getReg ())) {
22432243 for (const auto &MIRegs : SeenDbgInstrs.lookup (Unit)) {
22442244 auto &Regs = DbgValsToSinkMap[MIRegs.first ];
2245- for (unsigned Reg : MIRegs.second )
2245+ for (Register Reg : MIRegs.second )
22462246 Regs.push_back (Reg);
22472247 }
22482248 }
0 commit comments