@@ -169,7 +169,7 @@ class MachineSinking : public MachineFunctionPass {
169
169
170
170
// / Record of DBG_VALUE uses of vregs in a block, so that we can identify
171
171
// / debug instructions to sink.
172
- SmallDenseMap<unsigned , TinyPtrVector<SeenDbgUser>> SeenDbgUsers;
172
+ SmallDenseMap<Register , TinyPtrVector<SeenDbgUser>> SeenDbgUsers;
173
173
174
174
// / Record of debug variables that have had their locations set in the
175
175
// / current block.
@@ -1518,7 +1518,7 @@ static bool attemptDebugCopyProp(MachineInstr &SinkInst, MachineInstr &DbgMI,
1518
1518
return true ;
1519
1519
}
1520
1520
1521
- using MIRegs = std::pair<MachineInstr *, SmallVector<unsigned , 2 >>;
1521
+ using MIRegs = std::pair<MachineInstr *, SmallVector<Register , 2 >>;
1522
1522
// / Sink an instruction and its associated debug instructions.
1523
1523
static void performSink (MachineInstr &MI, MachineBasicBlock &SuccToSinkTo,
1524
1524
MachineBasicBlock::iterator InsertPos,
@@ -1547,7 +1547,7 @@ static void performSink(MachineInstr &MI, MachineBasicBlock &SuccToSinkTo,
1547
1547
SuccToSinkTo.insert (InsertPos, NewDbgMI);
1548
1548
1549
1549
bool PropagatedAllSunkOps = true ;
1550
- for (unsigned Reg : DbgValueToSink.second ) {
1550
+ for (Register Reg : DbgValueToSink.second ) {
1551
1551
if (DbgMI->hasDebugOperandForReg (Reg)) {
1552
1552
if (!attemptDebugCopyProp (MI, *DbgMI, Reg)) {
1553
1553
PropagatedAllSunkOps = false ;
@@ -1883,7 +1883,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
1883
1883
DbgMI->setDebugValueUndef ();
1884
1884
} else {
1885
1885
DbgUsersToSink.push_back (
1886
- {DbgMI, SmallVector<unsigned , 2 >(1 , MO.getReg ())});
1886
+ {DbgMI, SmallVector<Register , 2 >(1 , MO.getReg ())});
1887
1887
}
1888
1888
}
1889
1889
}
@@ -2010,7 +2010,7 @@ class PostRAMachineSinking : public MachineFunctionPass {
2010
2010
// / entry in this map for each unit it touches. The DBG_VALUE's entry
2011
2011
// / consists of a pointer to the instruction itself, and a vector of registers
2012
2012
// / 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;
2014
2014
2015
2015
// / Sink Copy instructions unused in the same block close to their uses in
2016
2016
// / successors.
@@ -2025,7 +2025,7 @@ char &llvm::PostRAMachineSinkingID = PostRAMachineSinking::ID;
2025
2025
INITIALIZE_PASS (PostRAMachineSinking, " postra-machine-sink" ,
2026
2026
" PostRA Machine Sink" , false , false )
2027
2027
2028
- static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB, unsigned Reg,
2028
+ static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB, Register Reg,
2029
2029
const TargetRegisterInfo *TRI) {
2030
2030
LiveRegUnits LiveInRegUnits (*TRI);
2031
2031
LiveInRegUnits.addLiveIns (MBB);
@@ -2035,7 +2035,7 @@ static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB, unsigned Reg,
2035
2035
static MachineBasicBlock *
2036
2036
getSingleLiveInSuccBB (MachineBasicBlock &CurBB,
2037
2037
const SmallPtrSetImpl<MachineBasicBlock *> &SinkableBBs,
2038
- unsigned Reg, const TargetRegisterInfo *TRI) {
2038
+ Register Reg, const TargetRegisterInfo *TRI) {
2039
2039
// Try to find a single sinkable successor in which Reg is live-in.
2040
2040
MachineBasicBlock *BB = nullptr ;
2041
2041
for (auto *SI : SinkableBBs) {
@@ -2062,7 +2062,7 @@ getSingleLiveInSuccBB(MachineBasicBlock &CurBB,
2062
2062
static MachineBasicBlock *
2063
2063
getSingleLiveInSuccBB (MachineBasicBlock &CurBB,
2064
2064
const SmallPtrSetImpl<MachineBasicBlock *> &SinkableBBs,
2065
- ArrayRef<unsigned > DefedRegsInCopy,
2065
+ ArrayRef<Register > DefedRegsInCopy,
2066
2066
const TargetRegisterInfo *TRI) {
2067
2067
MachineBasicBlock *SingleBB = nullptr ;
2068
2068
for (auto DefReg : DefedRegsInCopy) {
@@ -2076,8 +2076,8 @@ getSingleLiveInSuccBB(MachineBasicBlock &CurBB,
2076
2076
}
2077
2077
2078
2078
static void clearKillFlags (MachineInstr *MI, MachineBasicBlock &CurBB,
2079
- SmallVectorImpl<unsigned > &UsedOpsInCopy,
2080
- LiveRegUnits &UsedRegUnits,
2079
+ const SmallVectorImpl<unsigned > &UsedOpsInCopy,
2080
+ const LiveRegUnits &UsedRegUnits,
2081
2081
const TargetRegisterInfo *TRI) {
2082
2082
for (auto U : UsedOpsInCopy) {
2083
2083
MachineOperand &MO = MI->getOperand (U);
@@ -2096,11 +2096,11 @@ static void clearKillFlags(MachineInstr *MI, MachineBasicBlock &CurBB,
2096
2096
}
2097
2097
2098
2098
static void updateLiveIn (MachineInstr *MI, MachineBasicBlock *SuccBB,
2099
- SmallVectorImpl<unsigned > &UsedOpsInCopy,
2100
- SmallVectorImpl<unsigned > &DefedRegsInCopy) {
2099
+ const SmallVectorImpl<unsigned > &UsedOpsInCopy,
2100
+ const SmallVectorImpl<Register > &DefedRegsInCopy) {
2101
2101
MachineFunction &MF = *SuccBB->getParent ();
2102
2102
const TargetRegisterInfo *TRI = MF.getSubtarget ().getRegisterInfo ();
2103
- for (unsigned DefReg : DefedRegsInCopy)
2103
+ for (Register DefReg : DefedRegsInCopy)
2104
2104
for (MCPhysReg S : TRI->subregs_inclusive (DefReg))
2105
2105
SuccBB->removeLiveIn (S);
2106
2106
for (auto U : UsedOpsInCopy)
@@ -2110,7 +2110,7 @@ static void updateLiveIn(MachineInstr *MI, MachineBasicBlock *SuccBB,
2110
2110
2111
2111
static bool hasRegisterDependency (MachineInstr *MI,
2112
2112
SmallVectorImpl<unsigned > &UsedOpsInCopy,
2113
- SmallVectorImpl<unsigned > &DefedRegsInCopy,
2113
+ SmallVectorImpl<Register > &DefedRegsInCopy,
2114
2114
LiveRegUnits &ModifiedRegUnits,
2115
2115
LiveRegUnits &UsedRegUnits) {
2116
2116
bool HasRegDependency = false ;
@@ -2170,12 +2170,12 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
2170
2170
// Track the operand index for use in Copy.
2171
2171
SmallVector<unsigned , 2 > UsedOpsInCopy;
2172
2172
// Track the register number defed in Copy.
2173
- SmallVector<unsigned , 2 > DefedRegsInCopy;
2173
+ SmallVector<Register , 2 > DefedRegsInCopy;
2174
2174
2175
2175
// We must sink this DBG_VALUE if its operand is sunk. To avoid searching
2176
2176
// for DBG_VALUEs later, record them when they're encountered.
2177
2177
if (MI.isDebugValue () && !MI.isDebugRef ()) {
2178
- SmallDenseMap<MCRegister , SmallVector<unsigned , 2 >, 4 > MIUnits;
2178
+ SmallDenseMap<MCRegUnit , SmallVector<Register , 2 >, 4 > MIUnits;
2179
2179
bool IsValid = true ;
2180
2180
for (MachineOperand &MO : MI.debug_operands ()) {
2181
2181
if (MO.isReg () && MO.getReg ().isPhysical ()) {
@@ -2242,7 +2242,7 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
2242
2242
for (MCRegUnit Unit : TRI->regunits (MO.getReg ())) {
2243
2243
for (const auto &MIRegs : SeenDbgInstrs.lookup (Unit)) {
2244
2244
auto &Regs = DbgValsToSinkMap[MIRegs.first ];
2245
- for (unsigned Reg : MIRegs.second )
2245
+ for (Register Reg : MIRegs.second )
2246
2246
Regs.push_back (Reg);
2247
2247
}
2248
2248
}
0 commit comments