mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Provide operand indices to adjustSchedDependency
This allows targets to know exactly which operands are contributing to the dependency, which is required for targets with per-operand scheduling models. Differential Revision: https://reviews.llvm.org/D77135
This commit is contained in:
parent
29b2c863cc
commit
2e7316dbb2
@ -224,9 +224,13 @@ public:
|
||||
virtual void overrideSchedPolicy(MachineSchedPolicy &Policy,
|
||||
unsigned NumRegionInstrs) const {}
|
||||
|
||||
// Perform target specific adjustments to the latency of a schedule
|
||||
// Perform target-specific adjustments to the latency of a schedule
|
||||
// dependency.
|
||||
virtual void adjustSchedDependency(SUnit *def, SUnit *use, SDep &dep) const {}
|
||||
// If a pair of operands is associated with the schedule dependency, DefOpIdx
|
||||
// and UseOpIdx are the indices of the operands in Def and Use, respectively.
|
||||
// Otherwise, either may be -1.
|
||||
virtual void adjustSchedDependency(SUnit *Def, int DefOpIdx, SUnit *Use,
|
||||
int UseOpIdx, SDep &Dep) const {}
|
||||
|
||||
// For use with PostRAScheduling: get the anti-dependence breaking that should
|
||||
// be performed before post-RA scheduling.
|
||||
|
@ -809,7 +809,7 @@ void SwingSchedulerDAG::updatePhiDependences() {
|
||||
if (!MI->isPHI()) {
|
||||
SDep Dep(SU, SDep::Data, Reg);
|
||||
Dep.setLatency(0);
|
||||
ST.adjustSchedDependency(SU, &I, Dep);
|
||||
ST.adjustSchedDependency(SU, 0, &I, MI->getOperandNo(MOI), Dep);
|
||||
I.addPred(Dep);
|
||||
} else {
|
||||
HasPhiUse = Reg;
|
||||
|
@ -269,13 +269,13 @@ void ScheduleDAGInstrs::addPhysRegDataDeps(SUnit *SU, unsigned OperIdx) {
|
||||
if (!ImplicitPseudoDef && !ImplicitPseudoUse) {
|
||||
Dep.setLatency(SchedModel.computeOperandLatency(SU->getInstr(), OperIdx,
|
||||
RegUse, UseOp));
|
||||
ST.adjustSchedDependency(SU, UseSU, Dep);
|
||||
ST.adjustSchedDependency(SU, OperIdx, UseSU, UseOp, Dep);
|
||||
} else {
|
||||
Dep.setLatency(0);
|
||||
// FIXME: We could always let target to adjustSchedDependency(), and
|
||||
// remove this condition, but that currently asserts in Hexagon BE.
|
||||
if (SU->getInstr()->isBundle() || (RegUse && RegUse->isBundle()))
|
||||
ST.adjustSchedDependency(SU, UseSU, Dep);
|
||||
ST.adjustSchedDependency(SU, OperIdx, UseSU, UseOp, Dep);
|
||||
}
|
||||
|
||||
UseSU->addPred(Dep);
|
||||
@ -444,7 +444,7 @@ void ScheduleDAGInstrs::addVRegDefDeps(SUnit *SU, unsigned OperIdx) {
|
||||
SDep Dep(SU, SDep::Data, Reg);
|
||||
Dep.setLatency(SchedModel.computeOperandLatency(MI, OperIdx, Use,
|
||||
I->OperandIndex));
|
||||
ST.adjustSchedDependency(SU, UseSU, Dep);
|
||||
ST.adjustSchedDependency(SU, OperIdx, UseSU, I->OperandIndex, Dep);
|
||||
UseSU->addPred(Dep);
|
||||
}
|
||||
|
||||
|
@ -474,6 +474,7 @@ void ScheduleDAGSDNodes::AddSchedEdges() {
|
||||
|
||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
||||
SDNode *OpN = N->getOperand(i).getNode();
|
||||
unsigned DefIdx = N->getOperand(i).getResNo();
|
||||
if (isPassiveNode(OpN)) continue; // Not scheduled.
|
||||
SUnit *OpSU = &SUnits[OpN->getNodeId()];
|
||||
assert(OpSU && "Node has no SUnit!");
|
||||
@ -508,7 +509,7 @@ void ScheduleDAGSDNodes::AddSchedEdges() {
|
||||
Dep.setLatency(OpLatency);
|
||||
if (!isChain && !UnitLatencies) {
|
||||
computeOperandLatency(OpN, N, i, Dep);
|
||||
ST.adjustSchedDependency(OpSU, SU, Dep);
|
||||
ST.adjustSchedDependency(OpSU, DefIdx, SU, i, Dep);
|
||||
}
|
||||
|
||||
if (!SU->addPred(Dep) && !Dep.isCtrl() && OpSU->NumRegDefsLeft > 1) {
|
||||
|
@ -722,20 +722,20 @@ unsigned GCNSubtarget::getMaxNumVGPRs(const MachineFunction &MF) const {
|
||||
return MaxNumVGPRs;
|
||||
}
|
||||
|
||||
void GCNSubtarget::adjustSchedDependency(SUnit *Src, SUnit *Dst,
|
||||
SDep &Dep) const {
|
||||
void GCNSubtarget::adjustSchedDependency(SUnit *Def, int DefOpIdx, SUnit *Use,
|
||||
int UseOpIdx, SDep &Dep) const {
|
||||
if (Dep.getKind() != SDep::Kind::Data || !Dep.getReg() ||
|
||||
!Src->isInstr() || !Dst->isInstr())
|
||||
!Def->isInstr() || !Use->isInstr())
|
||||
return;
|
||||
|
||||
MachineInstr *SrcI = Src->getInstr();
|
||||
MachineInstr *DstI = Dst->getInstr();
|
||||
MachineInstr *DefI = Def->getInstr();
|
||||
MachineInstr *UseI = Use->getInstr();
|
||||
|
||||
if (SrcI->isBundle()) {
|
||||
if (DefI->isBundle()) {
|
||||
const SIRegisterInfo *TRI = getRegisterInfo();
|
||||
auto Reg = Dep.getReg();
|
||||
MachineBasicBlock::const_instr_iterator I(SrcI->getIterator());
|
||||
MachineBasicBlock::const_instr_iterator E(SrcI->getParent()->instr_end());
|
||||
MachineBasicBlock::const_instr_iterator I(DefI->getIterator());
|
||||
MachineBasicBlock::const_instr_iterator E(DefI->getParent()->instr_end());
|
||||
unsigned Lat = 0;
|
||||
for (++I; I != E && I->isBundledWithPred(); ++I) {
|
||||
if (I->modifiesRegister(Reg, TRI))
|
||||
@ -744,12 +744,12 @@ void GCNSubtarget::adjustSchedDependency(SUnit *Src, SUnit *Dst,
|
||||
--Lat;
|
||||
}
|
||||
Dep.setLatency(Lat);
|
||||
} else if (DstI->isBundle()) {
|
||||
} else if (UseI->isBundle()) {
|
||||
const SIRegisterInfo *TRI = getRegisterInfo();
|
||||
auto Reg = Dep.getReg();
|
||||
MachineBasicBlock::const_instr_iterator I(DstI->getIterator());
|
||||
MachineBasicBlock::const_instr_iterator E(DstI->getParent()->instr_end());
|
||||
unsigned Lat = InstrInfo.getInstrLatency(getInstrItineraryData(), *SrcI);
|
||||
MachineBasicBlock::const_instr_iterator I(UseI->getIterator());
|
||||
MachineBasicBlock::const_instr_iterator E(UseI->getParent()->instr_end());
|
||||
unsigned Lat = InstrInfo.getInstrLatency(getInstrItineraryData(), *DefI);
|
||||
for (++I; I != E && I->isBundledWithPred() && Lat; ++I) {
|
||||
if (I->readsRegister(Reg, TRI))
|
||||
break;
|
||||
|
@ -1193,7 +1193,8 @@ public:
|
||||
return AMDGPU::IsaInfo::getMinWavesPerEU(this);
|
||||
}
|
||||
|
||||
void adjustSchedDependency(SUnit *Src, SUnit *Dst, SDep &Dep) const override;
|
||||
void adjustSchedDependency(SUnit *Def, int DefOpIdx, SUnit *Use, int UseOpIdx,
|
||||
SDep &Dep) const override;
|
||||
};
|
||||
|
||||
class R600Subtarget final : public R600GenSubtargetInfo,
|
||||
|
@ -315,7 +315,8 @@ bool HexagonSubtarget::useAA() const {
|
||||
|
||||
/// Perform target specific adjustments to the latency of a schedule
|
||||
/// dependency.
|
||||
void HexagonSubtarget::adjustSchedDependency(SUnit *Src, SUnit *Dst,
|
||||
void HexagonSubtarget::adjustSchedDependency(SUnit *Src, int SrcOpIdx,
|
||||
SUnit *Dst, int DstOpIdx,
|
||||
SDep &Dep) const {
|
||||
MachineInstr *SrcInst = Src->getInstr();
|
||||
MachineInstr *DstInst = Dst->getInstr();
|
||||
|
@ -258,7 +258,8 @@ public:
|
||||
|
||||
/// Perform target specific adjustments to the latency of a schedule
|
||||
/// dependency.
|
||||
void adjustSchedDependency(SUnit *def, SUnit *use, SDep& dep) const override;
|
||||
void adjustSchedDependency(SUnit *Def, int DefOpIdx, SUnit *Use, int UseOpIdx,
|
||||
SDep &Dep) const override;
|
||||
|
||||
unsigned getVectorLength() const {
|
||||
assert(useHVXOps());
|
||||
|
Loading…
x
Reference in New Issue
Block a user