mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Fix counting of Post-RA scheduling stalls. Improve debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -823,6 +823,10 @@ void SchedulePostRATDList::ListScheduleTopDown() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In any cycle where we can't schedule any instructions, we must
|
||||||
|
// stall or emit a noop, depending on the target.
|
||||||
|
bool CycleInstCnt = 0;
|
||||||
|
|
||||||
// While Available queue is not empty, grab the node with the highest
|
// While Available queue is not empty, grab the node with the highest
|
||||||
// priority. If it is not ready put it back. Schedule the node.
|
// priority. If it is not ready put it back. Schedule the node.
|
||||||
std::vector<SUnit*> NotReady;
|
std::vector<SUnit*> NotReady;
|
||||||
@@ -879,6 +883,7 @@ void SchedulePostRATDList::ListScheduleTopDown() {
|
|||||||
if (FoundSUnit) {
|
if (FoundSUnit) {
|
||||||
ScheduleNodeTopDown(FoundSUnit, CurCycle);
|
ScheduleNodeTopDown(FoundSUnit, CurCycle);
|
||||||
HazardRec->EmitInstruction(FoundSUnit);
|
HazardRec->EmitInstruction(FoundSUnit);
|
||||||
|
CycleInstCnt++;
|
||||||
|
|
||||||
// If we are using the target-specific hazards, then don't
|
// If we are using the target-specific hazards, then don't
|
||||||
// advance the cycle time just because we schedule a node. If
|
// advance the cycle time just because we schedule a node. If
|
||||||
@@ -888,22 +893,28 @@ void SchedulePostRATDList::ListScheduleTopDown() {
|
|||||||
if (FoundSUnit->Latency) // Don't increment CurCycle for pseudo-ops!
|
if (FoundSUnit->Latency) // Don't increment CurCycle for pseudo-ops!
|
||||||
++CurCycle;
|
++CurCycle;
|
||||||
}
|
}
|
||||||
} else if (!HasNoopHazards) {
|
|
||||||
// Otherwise, we have a pipeline stall, but no other problem, just advance
|
|
||||||
// the current cycle and try again.
|
|
||||||
DEBUG(errs() << "*** Advancing cycle, no work to do\n");
|
|
||||||
HazardRec->AdvanceCycle();
|
|
||||||
++NumStalls;
|
|
||||||
++CurCycle;
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we have no instructions to issue and we have instructions
|
if (CycleInstCnt > 0) {
|
||||||
// that will fault if we don't do this right. This is the case for
|
DEBUG(errs() << "*** Finished cycle " << CurCycle << '\n');
|
||||||
// processors without pipeline interlocks and other cases.
|
HazardRec->AdvanceCycle();
|
||||||
DEBUG(errs() << "*** Emitting noop\n");
|
} else if (!HasNoopHazards) {
|
||||||
HazardRec->EmitNoop();
|
// Otherwise, we have a pipeline stall, but no other problem,
|
||||||
Sequence.push_back(0); // NULL here means noop
|
// just advance the current cycle and try again.
|
||||||
++NumNoops;
|
DEBUG(errs() << "*** Stall in cycle " << CurCycle << '\n');
|
||||||
|
HazardRec->AdvanceCycle();
|
||||||
|
++NumStalls;
|
||||||
|
} else {
|
||||||
|
// Otherwise, we have no instructions to issue and we have instructions
|
||||||
|
// that will fault if we don't do this right. This is the case for
|
||||||
|
// processors without pipeline interlocks and other cases.
|
||||||
|
DEBUG(errs() << "*** Emitting noop in cycle " << CurCycle << '\n');
|
||||||
|
HazardRec->EmitNoop();
|
||||||
|
Sequence.push_back(0); // NULL here means noop
|
||||||
|
++NumNoops;
|
||||||
|
}
|
||||||
|
|
||||||
++CurCycle;
|
++CurCycle;
|
||||||
|
CycleInstCnt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user