Rename registers to break output dependencies in addition to anti-dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87015 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Goodwin 2009-11-12 19:08:21 +00:00
parent 70d75ca310
commit 12dd99dc30
4 changed files with 30 additions and 10 deletions

View File

@ -285,7 +285,7 @@ static void AntiDepPathStep(SUnit *SU, AntiDepBreaker::AntiDepRegVector& Regs,
for (SUnit::pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
P != PE; ++P) {
if (P->getKind() == SDep::Anti) {
if ((P->getKind() == SDep::Anti) || (P->getKind() == SDep::Output)) {
unsigned Reg = P->getReg();
if (RegSet.count(Reg) != 0) {
Edges.push_back(&*P);
@ -716,7 +716,8 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
SDep *Edge = Edges[i];
SUnit *NextSU = Edge->getSUnit();
if (Edge->getKind() != SDep::Anti) continue;
if ((Edge->getKind() != SDep::Anti) &&
(Edge->getKind() != SDep::Output)) continue;
unsigned AntiDepReg = Edge->getReg();
DEBUG(errs() << "\tAntidep reg: " << TRI->getName(AntiDepReg));

View File

@ -55,7 +55,10 @@ SUnit *LatencyPriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
SUnit *OnlyAvailablePred = 0;
for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
I != E; ++I) {
if (IgnoreAntiDep && (I->getKind() == SDep::Anti)) continue;
if (IgnoreAntiDep &&
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
continue;
SUnit &Pred = *I->getSUnit();
if (!Pred.isScheduled) {
// We found an available, but not scheduled, predecessor. If it's the
@ -75,7 +78,10 @@ void LatencyPriorityQueue::push_impl(SUnit *SU) {
unsigned NumNodesBlocking = 0;
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
if (IgnoreAntiDep && (I->getKind() == SDep::Anti)) continue;
if (IgnoreAntiDep &&
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
continue;
if (getSingleUnscheduledPred(I->getSUnit()) == SU)
++NumNodesBlocking;
}
@ -92,7 +98,10 @@ void LatencyPriorityQueue::push_impl(SUnit *SU) {
void LatencyPriorityQueue::ScheduledNode(SUnit *SU) {
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
if (IgnoreAntiDep && (I->getKind() == SDep::Anti)) continue;
if (IgnoreAntiDep &&
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
continue;
AdjustPriorityOfUnscheduledPreds(I->getSUnit());
}
}

View File

@ -603,7 +603,9 @@ void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge,
void SchedulePostRATDList::ReleaseSuccessors(SUnit *SU, bool IgnoreAntiDep) {
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
if (IgnoreAntiDep && (I->getKind() == SDep::Anti)) continue;
if (IgnoreAntiDep &&
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
continue;
ReleaseSucc(SU, &*I, IgnoreAntiDep);
}
}
@ -658,7 +660,7 @@ void SchedulePostRATDList::ListScheduleTopDown(
available = true;
for (SUnit::const_pred_iterator I = SUnits[i].Preds.begin(),
E = SUnits[i].Preds.end(); I != E; ++I) {
if (I->getKind() != SDep::Anti) {
if ((I->getKind() != SDep::Anti) && (I->getKind() != SDep::Output)) {
available = false;
} else {
SUnits[i].NumPredsLeft -= 1;
@ -737,7 +739,9 @@ void SchedulePostRATDList::ListScheduleTopDown(
AntiDepBreaker::AntiDepRegVector AntiDepRegs;
for (SUnit::const_pred_iterator I = FoundSUnit->Preds.begin(),
E = FoundSUnit->Preds.end(); I != E; ++I) {
if ((I->getKind() == SDep::Anti) && !I->getSUnit()->isScheduled)
if (((I->getKind() == SDep::Anti) ||
(I->getKind() == SDep::Output)) &&
!I->getSUnit()->isScheduled)
AntiDepRegs.push_back(I->getReg());
}

View File

@ -214,7 +214,10 @@ void SUnit::ComputeDepth(bool IgnoreAntiDep) {
unsigned MaxPredDepth = 0;
for (SUnit::const_pred_iterator I = Cur->Preds.begin(),
E = Cur->Preds.end(); I != E; ++I) {
if (IgnoreAntiDep && (I->getKind() == SDep::Anti)) continue;
if (IgnoreAntiDep &&
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
continue;
SUnit *PredSU = I->getSUnit();
if (PredSU->isDepthCurrent)
MaxPredDepth = std::max(MaxPredDepth,
@ -248,7 +251,10 @@ void SUnit::ComputeHeight(bool IgnoreAntiDep) {
unsigned MaxSuccHeight = 0;
for (SUnit::const_succ_iterator I = Cur->Succs.begin(),
E = Cur->Succs.end(); I != E; ++I) {
if (IgnoreAntiDep && (I->getKind() == SDep::Anti)) continue;
if (IgnoreAntiDep &&
((I->getKind() == SDep::Anti) || (I->getKind() == SDep::Output)))
continue;
SUnit *SuccSU = I->getSUnit();
if (SuccSU->isHeightCurrent)
MaxSuccHeight = std::max(MaxSuccHeight,