forked from OSchip/llvm-project
[NFC][MC] Use MCRegister in Machine{Sink|Pipeliner}.cpp
Differential Revision: https://reviews.llvm.org/D89328
This commit is contained in:
parent
efd84a5f5d
commit
c8fcffe775
|
@ -304,7 +304,7 @@ private:
|
|||
void checkValidNodeOrder(const NodeSetType &Circuits) const;
|
||||
bool schedulePipeline(SMSchedule &Schedule);
|
||||
bool computeDelta(MachineInstr &MI, unsigned &Delta);
|
||||
MachineInstr *findDefInLoop(unsigned Reg);
|
||||
MachineInstr *findDefInLoop(Register Reg);
|
||||
bool canUseLastOffsetValue(MachineInstr *MI, unsigned &BasePos,
|
||||
unsigned &OffsetPos, unsigned &NewBase,
|
||||
int64_t &NewOffset);
|
||||
|
|
|
@ -1632,7 +1632,8 @@ static void computeLiveOuts(MachineFunction &MF, RegPressureTracker &RPTracker,
|
|||
if (Register::isVirtualRegister(Reg))
|
||||
Uses.insert(Reg);
|
||||
else if (MRI.isAllocatable(Reg))
|
||||
for (MCRegUnitIterator Units(Reg, TRI); Units.isValid(); ++Units)
|
||||
for (MCRegUnitIterator Units(Reg.asMCReg(), TRI); Units.isValid();
|
||||
++Units)
|
||||
Uses.insert(*Units);
|
||||
}
|
||||
}
|
||||
|
@ -1645,7 +1646,8 @@ static void computeLiveOuts(MachineFunction &MF, RegPressureTracker &RPTracker,
|
|||
LiveOutRegs.push_back(RegisterMaskPair(Reg,
|
||||
LaneBitmask::getNone()));
|
||||
} else if (MRI.isAllocatable(Reg)) {
|
||||
for (MCRegUnitIterator Units(Reg, TRI); Units.isValid(); ++Units)
|
||||
for (MCRegUnitIterator Units(Reg.asMCReg(), TRI); Units.isValid();
|
||||
++Units)
|
||||
if (!Uses.count(*Units))
|
||||
LiveOutRegs.push_back(RegisterMaskPair(*Units,
|
||||
LaneBitmask::getNone()));
|
||||
|
@ -2270,7 +2272,7 @@ void SwingSchedulerDAG::applyInstrChange(MachineInstr *MI,
|
|||
/// Return the instruction in the loop that defines the register.
|
||||
/// If the definition is a Phi, then follow the Phi operand to
|
||||
/// the instruction in the loop.
|
||||
MachineInstr *SwingSchedulerDAG::findDefInLoop(unsigned Reg) {
|
||||
MachineInstr *SwingSchedulerDAG::findDefInLoop(Register Reg) {
|
||||
SmallPtrSet<MachineInstr *, 8> Visited;
|
||||
MachineInstr *Def = MRI.getVRegDef(Reg);
|
||||
while (Def->isPHI()) {
|
||||
|
|
|
@ -184,12 +184,12 @@ namespace {
|
|||
/// to the copy source.
|
||||
void SalvageUnsunkDebugUsersOfCopy(MachineInstr &,
|
||||
MachineBasicBlock *TargetBlock);
|
||||
bool AllUsesDominatedByBlock(unsigned Reg, MachineBasicBlock *MBB,
|
||||
MachineBasicBlock *DefMBB,
|
||||
bool &BreakPHIEdge, bool &LocalUse) const;
|
||||
bool AllUsesDominatedByBlock(Register Reg, MachineBasicBlock *MBB,
|
||||
MachineBasicBlock *DefMBB, bool &BreakPHIEdge,
|
||||
bool &LocalUse) const;
|
||||
MachineBasicBlock *FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
|
||||
bool &BreakPHIEdge, AllSuccsCache &AllSuccessors);
|
||||
bool isProfitableToSinkTo(unsigned Reg, MachineInstr &MI,
|
||||
bool isProfitableToSinkTo(Register Reg, MachineInstr &MI,
|
||||
MachineBasicBlock *MBB,
|
||||
MachineBasicBlock *SuccToSinkTo,
|
||||
AllSuccsCache &AllSuccessors);
|
||||
|
@ -253,12 +253,11 @@ bool MachineSinking::PerformTrivialForwardCoalescing(MachineInstr &MI,
|
|||
/// occur in blocks dominated by the specified block. If any use is in the
|
||||
/// definition block, then return false since it is never legal to move def
|
||||
/// after uses.
|
||||
bool
|
||||
MachineSinking::AllUsesDominatedByBlock(unsigned Reg,
|
||||
MachineBasicBlock *MBB,
|
||||
MachineBasicBlock *DefMBB,
|
||||
bool &BreakPHIEdge,
|
||||
bool &LocalUse) const {
|
||||
bool MachineSinking::AllUsesDominatedByBlock(Register Reg,
|
||||
MachineBasicBlock *MBB,
|
||||
MachineBasicBlock *DefMBB,
|
||||
bool &BreakPHIEdge,
|
||||
bool &LocalUse) const {
|
||||
assert(Register::isVirtualRegister(Reg) && "Only makes sense for vregs");
|
||||
|
||||
// Ignore debug uses because debug info doesn't affect the code.
|
||||
|
@ -560,7 +559,7 @@ bool MachineSinking::PostponeSplitCriticalEdge(MachineInstr &MI,
|
|||
}
|
||||
|
||||
/// isProfitableToSinkTo - Return true if it is profitable to sink MI.
|
||||
bool MachineSinking::isProfitableToSinkTo(unsigned Reg, MachineInstr &MI,
|
||||
bool MachineSinking::isProfitableToSinkTo(Register Reg, MachineInstr &MI,
|
||||
MachineBasicBlock *MBB,
|
||||
MachineBasicBlock *SuccToSinkTo,
|
||||
AllSuccsCache &AllSuccessors) {
|
||||
|
@ -1312,9 +1311,9 @@ static bool hasRegisterDependency(MachineInstr *MI,
|
|||
return HasRegDependency;
|
||||
}
|
||||
|
||||
static SmallSet<unsigned, 4> getRegUnits(unsigned Reg,
|
||||
const TargetRegisterInfo *TRI) {
|
||||
SmallSet<unsigned, 4> RegUnits;
|
||||
static SmallSet<MCRegister, 4> getRegUnits(MCRegister Reg,
|
||||
const TargetRegisterInfo *TRI) {
|
||||
SmallSet<MCRegister, 4> RegUnits;
|
||||
for (auto RI = MCRegUnitIterator(Reg, TRI); RI.isValid(); ++RI)
|
||||
RegUnits.insert(*RI);
|
||||
return RegUnits;
|
||||
|
@ -1364,8 +1363,8 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
|
|||
continue;
|
||||
|
||||
// Record debug use of each reg unit.
|
||||
SmallSet<unsigned, 4> Units = getRegUnits(MO.getReg(), TRI);
|
||||
for (unsigned Reg : Units)
|
||||
SmallSet<MCRegister, 4> Units = getRegUnits(MO.getReg(), TRI);
|
||||
for (MCRegister Reg : Units)
|
||||
SeenDbgInstrs[Reg].push_back(MI);
|
||||
}
|
||||
continue;
|
||||
|
@ -1414,8 +1413,8 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
|
|||
if (!MO.isReg() || !MO.isDef())
|
||||
continue;
|
||||
|
||||
SmallSet<unsigned, 4> Units = getRegUnits(MO.getReg(), TRI);
|
||||
for (unsigned Reg : Units)
|
||||
SmallSet<MCRegister, 4> Units = getRegUnits(MO.getReg(), TRI);
|
||||
for (MCRegister Reg : Units)
|
||||
for (auto *MI : SeenDbgInstrs.lookup(Reg))
|
||||
DbgValsToSinkSet.insert(MI);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue