| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 1 | //===----- ScoreboardHazardRecognizer.cpp - Scheduler Support -------------===// | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 2 | // | 
|  | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
|  | 5 | // This file is distributed under the University of Illinois Open Source | 
|  | 6 | // License. See LICENSE.TXT for details. | 
|  | 7 | // | 
|  | 8 | //===----------------------------------------------------------------------===// | 
|  | 9 | // | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 10 | // This file implements the ScoreboardHazardRecognizer class, which | 
|  | 11 | // encapsultes hazard-avoidance heuristics for scheduling, based on the | 
|  | 12 | // scheduling itineraries specified for the target. | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 13 | // | 
|  | 14 | //===----------------------------------------------------------------------===// | 
|  | 15 |  | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 16 | #include "llvm/CodeGen/ScoreboardHazardRecognizer.h" | 
| Evan Cheng | 078f4ce | 2010-06-14 21:06:53 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/ScheduleDAG.h" | 
| Evan Cheng | 8264e27 | 2011-06-29 01:14:12 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCInstrItineraries.h" | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 19 | #include "llvm/Support/Debug.h" | 
|  | 20 | #include "llvm/Support/ErrorHandling.h" | 
| David Goodwin | f20236a | 2009-08-11 01:44:26 +0000 | [diff] [blame] | 21 | #include "llvm/Support/raw_ostream.h" | 
| Andrew Trick | 47ff14b | 2011-01-21 05:51:33 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetInstrInfo.h" | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 23 |  | 
| Bill Wendling | a2c4594 | 2009-08-22 20:08:44 +0000 | [diff] [blame] | 24 | using namespace llvm; | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 25 |  | 
| Chandler Carruth | 1b9dde0 | 2014-04-22 02:02:50 +0000 | [diff] [blame] | 26 | #define DEBUG_TYPE ::llvm::ScoreboardHazardRecognizer::DebugType | 
|  | 27 |  | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 28 | #ifndef NDEBUG | 
|  | 29 | const char *ScoreboardHazardRecognizer::DebugType = ""; | 
|  | 30 | #endif | 
|  | 31 |  | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 32 | ScoreboardHazardRecognizer:: | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 33 | ScoreboardHazardRecognizer(const InstrItineraryData *II, | 
|  | 34 | const ScheduleDAG *SchedDAG, | 
|  | 35 | const char *ParentDebugType) : | 
|  | 36 | ScheduleHazardRecognizer(), ItinData(II), DAG(SchedDAG), IssueWidth(0), | 
|  | 37 | IssueCount(0) { | 
|  | 38 |  | 
|  | 39 | #ifndef NDEBUG | 
|  | 40 | DebugType = ParentDebugType; | 
|  | 41 | #endif | 
|  | 42 |  | 
| Andrew Trick | ed7c96d | 2012-06-05 03:44:32 +0000 | [diff] [blame] | 43 | // Determine the maximum depth of any itinerary. This determines the depth of | 
|  | 44 | // the scoreboard. We always make the scoreboard at least 1 cycle deep to | 
|  | 45 | // avoid dealing with the boundary condition. | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 46 | unsigned ScoreboardDepth = 1; | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 47 | if (ItinData && !ItinData->isEmpty()) { | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 48 | for (unsigned idx = 0; ; ++idx) { | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 49 | if (ItinData->isEndMarker(idx)) | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 50 | break; | 
|  | 51 |  | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 52 | const InstrStage *IS = ItinData->beginStage(idx); | 
|  | 53 | const InstrStage *E = ItinData->endStage(idx); | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 54 | unsigned CurCycle = 0; | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 55 | unsigned ItinDepth = 0; | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 56 | for (; IS != E; ++IS) { | 
|  | 57 | unsigned StageDepth = CurCycle + IS->getCycles(); | 
|  | 58 | if (ItinDepth < StageDepth) ItinDepth = StageDepth; | 
|  | 59 | CurCycle += IS->getNextCycles(); | 
|  | 60 | } | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 61 |  | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 62 | // Find the next power-of-2 >= ItinDepth | 
|  | 63 | while (ItinDepth > ScoreboardDepth) { | 
|  | 64 | ScoreboardDepth *= 2; | 
| Andrew Trick | ed7c96d | 2012-06-05 03:44:32 +0000 | [diff] [blame] | 65 | // Don't set MaxLookAhead until we find at least one nonzero stage. | 
|  | 66 | // This way, an itinerary with no stages has MaxLookAhead==0, which | 
|  | 67 | // completely bypasses the scoreboard hazard logic. | 
|  | 68 | MaxLookAhead = ScoreboardDepth; | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 69 | } | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 70 | } | 
|  | 71 | } | 
|  | 72 |  | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 73 | ReservedScoreboard.reset(ScoreboardDepth); | 
|  | 74 | RequiredScoreboard.reset(ScoreboardDepth); | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 75 |  | 
| Andrew Trick | 87255e3 | 2012-07-07 04:00:00 +0000 | [diff] [blame] | 76 | // If MaxLookAhead is not set above, then we are not enabled. | 
| Andrew Trick | 73d7736 | 2012-06-05 03:44:40 +0000 | [diff] [blame] | 77 | if (!isEnabled()) | 
| Andrew Trick | ed7c96d | 2012-06-05 03:44:32 +0000 | [diff] [blame] | 78 | DEBUG(dbgs() << "Disabled scoreboard hazard recognizer\n"); | 
| Andrew Trick | 73d7736 | 2012-06-05 03:44:40 +0000 | [diff] [blame] | 79 | else { | 
| Andrew Trick | 87255e3 | 2012-07-07 04:00:00 +0000 | [diff] [blame] | 80 | // A nonempty itinerary must have a SchedModel. | 
| Pete Cooper | 1175945 | 2014-09-02 17:43:54 +0000 | [diff] [blame] | 81 | IssueWidth = ItinData->SchedModel.IssueWidth; | 
| Andrew Trick | ed7c96d | 2012-06-05 03:44:32 +0000 | [diff] [blame] | 82 | DEBUG(dbgs() << "Using scoreboard hazard recognizer: Depth = " | 
|  | 83 | << ScoreboardDepth << '\n'); | 
| Andrew Trick | 73d7736 | 2012-06-05 03:44:40 +0000 | [diff] [blame] | 84 | } | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 85 | } | 
|  | 86 |  | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 87 | void ScoreboardHazardRecognizer::Reset() { | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 88 | IssueCount = 0; | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 89 | RequiredScoreboard.reset(); | 
|  | 90 | ReservedScoreboard.reset(); | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 91 | } | 
|  | 92 |  | 
| Manman Ren | 19f49ac | 2012-09-11 22:23:19 +0000 | [diff] [blame] | 93 | #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 94 | void ScoreboardHazardRecognizer::Scoreboard::dump() const { | 
| David Greene | 964a982 | 2010-01-04 21:26:07 +0000 | [diff] [blame] | 95 | dbgs() << "Scoreboard:\n"; | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 96 |  | 
|  | 97 | unsigned last = Depth - 1; | 
|  | 98 | while ((last > 0) && ((*this)[last] == 0)) | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 99 | last--; | 
|  | 100 |  | 
|  | 101 | for (unsigned i = 0; i <= last; i++) { | 
| Hal Finkel | 8db5547 | 2012-06-22 20:27:13 +0000 | [diff] [blame] | 102 | unsigned FUs = (*this)[i]; | 
| David Greene | 964a982 | 2010-01-04 21:26:07 +0000 | [diff] [blame] | 103 | dbgs() << "\t"; | 
| Hal Finkel | 8db5547 | 2012-06-22 20:27:13 +0000 | [diff] [blame] | 104 | for (int j = 31; j >= 0; j--) | 
|  | 105 | dbgs() << ((FUs & (1 << j)) ? '1' : '0'); | 
| David Greene | 964a982 | 2010-01-04 21:26:07 +0000 | [diff] [blame] | 106 | dbgs() << '\n'; | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 107 | } | 
|  | 108 | } | 
| Manman Ren | 742534c | 2012-09-06 19:06:06 +0000 | [diff] [blame] | 109 | #endif | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 110 |  | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 111 | bool ScoreboardHazardRecognizer::atIssueLimit() const { | 
|  | 112 | if (IssueWidth == 0) | 
|  | 113 | return false; | 
|  | 114 |  | 
|  | 115 | return IssueCount == IssueWidth; | 
|  | 116 | } | 
|  | 117 |  | 
| Evan Cheng | f128bdc | 2010-06-16 07:35:02 +0000 | [diff] [blame] | 118 | ScheduleHazardRecognizer::HazardType | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 119 | ScoreboardHazardRecognizer::getHazardType(SUnit *SU, int Stalls) { | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 120 | if (!ItinData || ItinData->isEmpty()) | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 121 | return NoHazard; | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 122 |  | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 123 | // Note that stalls will be negative for bottom-up scheduling. | 
|  | 124 | int cycle = Stalls; | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 125 |  | 
|  | 126 | // Use the itinerary for the underlying instruction to check for | 
|  | 127 | // free FU's in the scoreboard at the appropriate future cycles. | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 128 |  | 
| Evan Cheng | 6cc775f | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 129 | const MCInstrDesc *MCID = DAG->getInstrDesc(SU); | 
| Craig Topper | c0196b1 | 2014-04-14 00:51:57 +0000 | [diff] [blame] | 130 | if (!MCID) { | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 131 | // Don't check hazards for non-machineinstr Nodes. | 
|  | 132 | return NoHazard; | 
|  | 133 | } | 
| Evan Cheng | 6cc775f | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 134 | unsigned idx = MCID->getSchedClass(); | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 135 | for (const InstrStage *IS = ItinData->beginStage(idx), | 
|  | 136 | *E = ItinData->endStage(idx); IS != E; ++IS) { | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 137 | // We must find one of the stage's units free for every cycle the | 
|  | 138 | // stage is occupied. FIXME it would be more accurate to find the | 
|  | 139 | // same unit free in all the cycles. | 
|  | 140 | for (unsigned int i = 0; i < IS->getCycles(); ++i) { | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 141 | int StageCycle = cycle + (int)i; | 
|  | 142 | if (StageCycle < 0) | 
|  | 143 | continue; | 
|  | 144 |  | 
|  | 145 | if (StageCycle >= (int)RequiredScoreboard.getDepth()) { | 
|  | 146 | assert((StageCycle - Stalls) < (int)RequiredScoreboard.getDepth() && | 
|  | 147 | "Scoreboard depth exceeded!"); | 
|  | 148 | // This stage was stalled beyond pipeline depth, so cannot conflict. | 
|  | 149 | break; | 
|  | 150 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 151 |  | 
| Hal Finkel | 8db5547 | 2012-06-22 20:27:13 +0000 | [diff] [blame] | 152 | unsigned freeUnits = IS->getUnits(); | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 153 | switch (IS->getReservationKind()) { | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 154 | case InstrStage::Required: | 
|  | 155 | // Required FUs conflict with both reserved and required ones | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 156 | freeUnits &= ~ReservedScoreboard[StageCycle]; | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 157 | // FALLTHROUGH | 
|  | 158 | case InstrStage::Reserved: | 
|  | 159 | // Reserved FUs can conflict only with required ones. | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 160 | freeUnits &= ~RequiredScoreboard[StageCycle]; | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 161 | break; | 
|  | 162 | } | 
|  | 163 |  | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 164 | if (!freeUnits) { | 
| Benjamin Kramer | 484f424 | 2012-05-26 11:37:37 +0000 | [diff] [blame] | 165 | DEBUG(dbgs() << "*** Hazard in cycle +" << StageCycle << ", "); | 
| David Greene | 964a982 | 2010-01-04 21:26:07 +0000 | [diff] [blame] | 166 | DEBUG(dbgs() << "SU(" << SU->NodeNum << "): "); | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 167 | DEBUG(DAG->dumpNode(SU)); | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 168 | return Hazard; | 
|  | 169 | } | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 170 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 171 |  | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 172 | // Advance the cycle to the next stage. | 
|  | 173 | cycle += IS->getNextCycles(); | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 174 | } | 
|  | 175 |  | 
|  | 176 | return NoHazard; | 
|  | 177 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 178 |  | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 179 | void ScoreboardHazardRecognizer::EmitInstruction(SUnit *SU) { | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 180 | if (!ItinData || ItinData->isEmpty()) | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 181 | return; | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 182 |  | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 183 | // Use the itinerary for the underlying instruction to reserve FU's | 
|  | 184 | // in the scoreboard at the appropriate future cycles. | 
| Evan Cheng | 6cc775f | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 185 | const MCInstrDesc *MCID = DAG->getInstrDesc(SU); | 
|  | 186 | assert(MCID && "The scheduler must filter non-machineinstrs"); | 
|  | 187 | if (DAG->TII->isZeroCost(MCID->Opcode)) | 
| Andrew Trick | 47ff14b | 2011-01-21 05:51:33 +0000 | [diff] [blame] | 188 | return; | 
|  | 189 |  | 
|  | 190 | ++IssueCount; | 
|  | 191 |  | 
|  | 192 | unsigned cycle = 0; | 
|  | 193 |  | 
| Evan Cheng | 6cc775f | 2011-06-28 19:10:37 +0000 | [diff] [blame] | 194 | unsigned idx = MCID->getSchedClass(); | 
| Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 195 | for (const InstrStage *IS = ItinData->beginStage(idx), | 
|  | 196 | *E = ItinData->endStage(idx); IS != E; ++IS) { | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 197 | // We must reserve one of the stage's units for every cycle the | 
|  | 198 | // stage is occupied. FIXME it would be more accurate to reserve | 
|  | 199 | // the same unit free in all the cycles. | 
|  | 200 | for (unsigned int i = 0; i < IS->getCycles(); ++i) { | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 201 | assert(((cycle + i) < RequiredScoreboard.getDepth()) && | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 202 | "Scoreboard depth exceeded!"); | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 203 |  | 
| Hal Finkel | 8db5547 | 2012-06-22 20:27:13 +0000 | [diff] [blame] | 204 | unsigned freeUnits = IS->getUnits(); | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 205 | switch (IS->getReservationKind()) { | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 206 | case InstrStage::Required: | 
|  | 207 | // Required FUs conflict with both reserved and required ones | 
|  | 208 | freeUnits &= ~ReservedScoreboard[cycle + i]; | 
|  | 209 | // FALLTHROUGH | 
|  | 210 | case InstrStage::Reserved: | 
|  | 211 | // Reserved FUs can conflict only with required ones. | 
|  | 212 | freeUnits &= ~RequiredScoreboard[cycle + i]; | 
|  | 213 | break; | 
|  | 214 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 215 |  | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 216 | // reduce to a single unit | 
| Hal Finkel | 8db5547 | 2012-06-22 20:27:13 +0000 | [diff] [blame] | 217 | unsigned freeUnit = 0; | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 218 | do { | 
|  | 219 | freeUnit = freeUnits; | 
|  | 220 | freeUnits = freeUnit & (freeUnit - 1); | 
|  | 221 | } while (freeUnits); | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 222 |  | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 223 | if (IS->getReservationKind() == InstrStage::Required) | 
|  | 224 | RequiredScoreboard[cycle + i] |= freeUnit; | 
|  | 225 | else | 
|  | 226 | ReservedScoreboard[cycle + i] |= freeUnit; | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 227 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 228 |  | 
| David Goodwin | 74b7956 | 2009-09-22 16:47:52 +0000 | [diff] [blame] | 229 | // Advance the cycle to the next stage. | 
|  | 230 | cycle += IS->getNextCycles(); | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 231 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 232 |  | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 233 | DEBUG(ReservedScoreboard.dump()); | 
|  | 234 | DEBUG(RequiredScoreboard.dump()); | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 235 | } | 
| Anton Korobeynikov | 9a348a9 | 2010-04-07 18:19:24 +0000 | [diff] [blame] | 236 |  | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 237 | void ScoreboardHazardRecognizer::AdvanceCycle() { | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 238 | IssueCount = 0; | 
| Anton Korobeynikov | 0bdc634 | 2010-04-07 18:19:32 +0000 | [diff] [blame] | 239 | ReservedScoreboard[0] = 0; ReservedScoreboard.advance(); | 
|  | 240 | RequiredScoreboard[0] = 0; RequiredScoreboard.advance(); | 
| David Goodwin | 6021b4d | 2009-08-10 15:55:25 +0000 | [diff] [blame] | 241 | } | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 242 |  | 
|  | 243 | void ScoreboardHazardRecognizer::RecedeCycle() { | 
| Andrew Trick | 10ffc2b | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 244 | IssueCount = 0; | 
| Andrew Trick | 00067fb | 2010-12-08 20:04:29 +0000 | [diff] [blame] | 245 | ReservedScoreboard[ReservedScoreboard.getDepth()-1] = 0; | 
|  | 246 | ReservedScoreboard.recede(); | 
|  | 247 | RequiredScoreboard[RequiredScoreboard.getDepth()-1] = 0; | 
|  | 248 | RequiredScoreboard.recede(); | 
|  | 249 | } |