From ccad8439e05129f74bbb57c48718d94f410671bb Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Jan 2005 04:20:30 +0000 Subject: [PATCH] cycles_t -> CycleCount_t git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19604 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../SparcV9/InstrSched/InstrScheduling.cpp | 58 +++++++++---------- .../SparcV9/InstrSched/SchedPriorities.cpp | 12 ++-- .../SparcV9/InstrSched/SchedPriorities.h | 38 ++++++------ 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp index 84c8611683f..874dd61876c 100644 --- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp +++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp @@ -142,7 +142,7 @@ class InstrSchedule { const unsigned int nslots; unsigned int numInstr; std::vector groups; // indexed by cycle number - std::vector startTime; // indexed by node id + std::vector startTime; // indexed by node id InstrSchedule(InstrSchedule&); // DO NOT IMPLEMENT void operator=(InstrSchedule&); // DO NOT IMPLEMENT @@ -163,12 +163,12 @@ public: // constructors and destructor public: // accessor functions to query chosen schedule const SchedGraphNode* getInstr (unsigned int slotNum, - cycles_t c) const { + CycleCount_t c) const { const InstrGroup* igroup = this->getIGroup(c); return (igroup == NULL)? NULL : (*igroup)[slotNum]; } - inline InstrGroup* getIGroup (cycles_t c) { + inline InstrGroup* getIGroup (CycleCount_t c) { if ((unsigned)c >= groups.size()) groups.resize(c+1); if (groups[c] == NULL) @@ -176,12 +176,12 @@ public: // accessor functions to query chosen schedule return groups[c]; } - inline const InstrGroup* getIGroup (cycles_t c) const { + inline const InstrGroup* getIGroup (CycleCount_t c) const { assert((unsigned)c < groups.size()); return groups[c]; } - inline cycles_t getStartTime (unsigned int nodeId) const { + inline CycleCount_t getStartTime (unsigned int nodeId) const { assert(nodeId < startTime.size()); return startTime[nodeId]; } @@ -192,7 +192,7 @@ public: // accessor functions to query chosen schedule inline void scheduleInstr (const SchedGraphNode* node, unsigned int slotNum, - cycles_t cycle) { + CycleCount_t cycle) { InstrGroup* igroup = this->getIGroup(cycle); if (!((*igroup)[slotNum] == NULL)) { std::cerr << "Slot already filled?\n"; @@ -222,7 +222,7 @@ InstrSchedule::InstrSchedule(unsigned int _nslots, unsigned int _numNodes) : nslots(_nslots), numInstr(0), groups(2 * _numNodes / _nslots), // 2 x lower-bound for #cycles - startTime(_numNodes, (cycles_t) -1) // set all to -1 + startTime(_numNodes, (CycleCount_t) -1) // set all to -1 { } @@ -297,7 +297,7 @@ class DelaySlotInfo { const SchedGraphNode* brNode; unsigned ndelays; std::vector delayNodeVec; - cycles_t delayedNodeCycle; + CycleCount_t delayedNodeCycle; unsigned delayedNodeSlotNum; DelaySlotInfo(const DelaySlotInfo &); // DO NOT IMPLEMENT @@ -321,7 +321,7 @@ public: assert(delayNodeVec.size() <= ndelays && "Too many delay slot instrs!"); } - inline void recordChosenSlot (cycles_t cycle, unsigned slotNum) { + inline void recordChosenSlot (CycleCount_t cycle, unsigned slotNum) { delayedNodeCycle = cycle; delayedNodeSlotNum = slotNum; } @@ -347,13 +347,13 @@ public: // publicly accessible data members private: unsigned totalInstrCount; - cycles_t curTime; - cycles_t nextEarliestIssueTime; // next cycle we can issue + CycleCount_t curTime; + CycleCount_t nextEarliestIssueTime; // next cycle we can issue // indexed by slot# std::vector > choicesForSlot; std::vector choiceVec; // indexed by node ptr std::vector numInClass; // indexed by sched class - std::vector nextEarliestStartTime; // indexed by opCode + std::vector nextEarliestStartTime; // indexed by opCode hash_map delaySlotInfoForBranches; // indexed by branch node ptr @@ -379,21 +379,21 @@ public: // Interface for checking and updating the current time //---------------------------------------------------------------------- - inline cycles_t getTime () const { + inline CycleCount_t getTime () const { return curTime; } - inline cycles_t getEarliestIssueTime() const { + inline CycleCount_t getEarliestIssueTime() const { return nextEarliestIssueTime; } - inline cycles_t getEarliestStartTimeForOp(MachineOpCode opCode) const { + inline CycleCount_t getEarliestStartTimeForOp(MachineOpCode opCode) const { assert(opCode < (int) nextEarliestStartTime.size()); return nextEarliestStartTime[opCode]; } // Update current time to specified cycle - inline void updateTime (cycles_t c) { + inline void updateTime (CycleCount_t c) { curTime = c; schedPrio.updateTime(c); } @@ -467,7 +467,7 @@ public: inline void scheduleInstr (const SchedGraphNode* node, unsigned int slotNum, - cycles_t cycle) + CycleCount_t cycle) { assert(! isScheduled(node) && "Instruction already scheduled?"); @@ -509,7 +509,7 @@ public: private: SchedulingManager(); // DISABLED: DO NOT IMPLEMENT - void updateEarliestStartTimes(const SchedGraphNode* node, cycles_t schedTime); + void updateEarliestStartTimes(const SchedGraphNode* node, CycleCount_t schedTime); }; @@ -526,7 +526,7 @@ SchedulingManager::SchedulingManager(const TargetMachine& target, choicesForSlot(nslots), numInClass(target.getSchedInfo()->getNumSchedClasses(), 0), // set all to 0 nextEarliestStartTime(target.getInstrInfo()->getNumOpcodes(), - (cycles_t) 0) // set all to 0 + (CycleCount_t) 0) // set all to 0 { updateTime(0); @@ -540,7 +540,7 @@ SchedulingManager::SchedulingManager(const TargetMachine& target, void SchedulingManager::updateEarliestStartTimes(const SchedGraphNode* node, - cycles_t schedTime) + CycleCount_t schedTime) { if (schedInfo.numBubblesAfter(node->getOpcode()) > 0) { // Update next earliest time before which *nothing* can issue. @@ -554,7 +554,7 @@ SchedulingManager::updateEarliestStartTimes(const SchedGraphNode* node, for (unsigned i=0; i < conflictVec.size(); i++) { MachineOpCode toOp = conflictVec[i]; - cycles_t est=schedTime + schedInfo.getMinIssueGap(node->getOpcode(),toOp); + CycleCount_t est=schedTime + schedInfo.getMinIssueGap(node->getOpcode(),toOp); assert(toOp < (int) nextEarliestStartTime.size()); if (nextEarliestStartTime[toOp] < est) nextEarliestStartTime[toOp] = est; @@ -569,7 +569,7 @@ AssignInstructionsToSlots(class SchedulingManager& S, unsigned maxIssue) { // find the slot to start from, in the current cycle unsigned int startSlot = 0; - cycles_t curTime = S.getTime(); + CycleCount_t curTime = S.getTime(); assert(maxIssue > 0 && maxIssue <= S.nslots - startSlot); @@ -850,7 +850,7 @@ FindSlotChoices(SchedulingManager& S, // highest slot used. But we just mark that for now, and // schedule it separately because we want to schedule the delay // slots for the node at the same time. - cycles_t dcycle = S.getTime(); + CycleCount_t dcycle = S.getTime(); unsigned int dslot = highestSlotUsed + 1; if (dslot == S.nslots) { dslot = 0; @@ -934,7 +934,7 @@ ChooseOneGroup(SchedulingManager& S) assert(S.schedPrio.getNumReady() > 0 && "Don't get here without ready instructions."); - cycles_t firstCycle = S.getTime(); + CycleCount_t firstCycle = S.getTime(); DelaySlotInfo* getDelaySlotInfo = NULL; // Choose up to `nslots' feasible instructions and their possible slots. @@ -952,7 +952,7 @@ ChooseOneGroup(SchedulingManager& S) // Print trace of scheduled instructions before newly ready ones if (SchedDebugLevel >= Sched_PrintSchedTrace) { - for (cycles_t c = firstCycle; c <= S.getTime(); c++) { + for (CycleCount_t c = firstCycle; c <= S.getTime(); c++) { std::cerr << " Cycle " << (long)c <<" : Scheduled instructions:\n"; const InstrGroup* igroup = S.isched.getIGroup(c); for (unsigned int s=0; s < S.nslots; s++) { @@ -978,7 +978,7 @@ ForwardListSchedule(SchedulingManager& S) S.schedPrio.initialize(); while ((N = S.schedPrio.getNumReady()) > 0) { - cycles_t nextCycle = S.getTime(); + CycleCount_t nextCycle = S.getTime(); // Choose one group of instructions for a cycle, plus any delay slot // instructions (which may overflow into successive cycles). @@ -991,7 +991,7 @@ ForwardListSchedule(SchedulingManager& S) // Notify the priority manager of scheduled instructions and mark // any successors that may now be ready // - for (cycles_t c = nextCycle; c <= S.getTime(); c++) { + for (CycleCount_t c = nextCycle; c <= S.getTime(); c++) { const InstrGroup* igroup = S.isched.getIGroup(c); for (unsigned int s=0; s < S.nslots; s++) if ((node = (*igroup)[s]) != NULL) { @@ -1304,7 +1304,7 @@ DelaySlotInfo::scheduleDelayedNode(SchedulingManager& S) && "Slot for branch should be empty"); unsigned int nextSlot = delayedNodeSlotNum; - cycles_t nextTime = delayedNodeCycle; + CycleCount_t nextTime = delayedNodeCycle; S.scheduleInstr(brNode, nextSlot, nextTime); @@ -1395,7 +1395,7 @@ ConflictsWithChoices(const SchedulingManager& S, static inline bool ViolatesMinimumGap(const SchedulingManager& S, MachineOpCode opCode, - const cycles_t inCycle) + const CycleCount_t inCycle) { return (inCycle < S.getEarliestStartTimeForOp(opCode)); } diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp index 33788b11183..3e276b82ad0 100644 --- a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp @@ -55,7 +55,7 @@ SchedPriorities::computeDelays(const SchedGraph* graph) { po_iterator poIter = po_begin(graph), poEnd =po_end(graph); for ( ; poIter != poEnd; ++poIter) { const SchedGraphNode* node = *poIter; - cycles_t nodeDelay; + CycleCount_t nodeDelay; if (node->beginOutEdges() == node->endOutEdges()) nodeDelay = node->getLatency(); else { @@ -63,7 +63,7 @@ SchedPriorities::computeDelays(const SchedGraph* graph) { nodeDelay = 0; for (SchedGraphNode::const_iterator E=node->beginOutEdges(); E != node->endOutEdges(); ++E) { - cycles_t sinkDelay = getNodeDelay((SchedGraphNode*)(*E)->getSink()); + CycleCount_t sinkDelay = getNodeDelay((SchedGraphNode*)(*E)->getSink()); nodeDelay = std::max(nodeDelay, sinkDelay + (*E)->getMinDelay()); } } @@ -117,7 +117,7 @@ SchedPriorities::insertReady(const SchedGraphNode* node) { } void -SchedPriorities::issuedReadyNodeAt(cycles_t curTime, +SchedPriorities::issuedReadyNodeAt(CycleCount_t curTime, const SchedGraphNode* node) { candsAsHeap.removeNode(node); candsAsSet.erase(node); @@ -138,7 +138,7 @@ SchedPriorities::issuedReadyNodeAt(cycles_t curTime, // Now update ready times for successors for (SchedGraphNode::const_iterator E=node->beginOutEdges(); E != node->endOutEdges(); ++E) { - cycles_t& etime = + CycleCount_t& etime = getEarliestReadyTimeForNodeRef((SchedGraphNode*)(*E)->getSink()); etime = std::max(etime, curTime + (*E)->getMinDelay()); } @@ -187,7 +187,7 @@ SchedPriorities::chooseByRule3(std::vector& mcands) { const SchedGraphNode* SchedPriorities::getNextHighest(const SchedulingManager& S, - cycles_t curTime) { + CycleCount_t curTime) { int nextIdx = -1; const SchedGraphNode* nextChoice = NULL; @@ -237,7 +237,7 @@ SchedPriorities::findSetWithMaxDelay(std::vector& mcands, { // out of choices at current maximum delay; // put nodes with next highest delay in mcands candIndex next = nextToTry; - cycles_t maxDelay = candsAsHeap.getDelay(next); + CycleCount_t maxDelay = candsAsHeap.getDelay(next); for (; next != candsAsHeap.end() && candsAsHeap.getDelay(next) == maxDelay; ++next) mcands.push_back(next); diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.h b/lib/Target/SparcV9/InstrSched/SchedPriorities.h index dd807f788e3..014fab21fa6 100644 --- a/lib/Target/SparcV9/InstrSched/SchedPriorities.h +++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.h @@ -61,8 +61,8 @@ bool instrIsFeasible(const SchedulingManager &S, MachineOpCode opCode); struct NodeDelayPair { const SchedGraphNode* node; - cycles_t delay; - NodeDelayPair(const SchedGraphNode* n, cycles_t d) : node(n), delay(d) {} + CycleCount_t delay; + NodeDelayPair(const SchedGraphNode* n, CycleCount_t d) : node(n), delay(d) {} inline bool operator<(const NodeDelayPair& np) { return delay < np.delay; } }; @@ -85,7 +85,7 @@ public: inline unsigned size() const { return _size; } const SchedGraphNode* getNode (const_iterator i) const { return (*i)->node; } - cycles_t getDelay(const_iterator i) const { return (*i)->delay;} + CycleCount_t getDelay(const_iterator i) const { return (*i)->delay;} inline void makeHeap() { // make_heap(begin(), end(), NDPLessThan); @@ -108,7 +108,7 @@ public: } }; - void insert(const SchedGraphNode* node, cycles_t delay) { + void insert(const SchedGraphNode* node, CycleCount_t delay) { NodeDelayPair* ndp = new NodeDelayPair(node, delay); if (_size == 0 || front()->delay < delay) push_front(ndp); @@ -137,36 +137,36 @@ public: // This must be called before scheduling begins. void initialize (); - cycles_t getTime () const { return curTime; } - cycles_t getEarliestReadyTime () const { return earliestReadyTime; } + CycleCount_t getTime () const { return curTime; } + CycleCount_t getEarliestReadyTime () const { return earliestReadyTime; } unsigned getNumReady () const { return candsAsHeap.size(); } bool nodeIsReady (const SchedGraphNode* node) const { return (candsAsSet.find(node) != candsAsSet.end()); } - void issuedReadyNodeAt (cycles_t curTime, + void issuedReadyNodeAt (CycleCount_t curTime, const SchedGraphNode* node); void insertReady (const SchedGraphNode* node); - void updateTime (cycles_t /*unused*/); + void updateTime (CycleCount_t /*unused*/); const SchedGraphNode* getNextHighest (const SchedulingManager& S, - cycles_t curTime); + CycleCount_t curTime); // choose next highest priority instr private: typedef NodeHeap::iterator candIndex; private: - cycles_t curTime; + CycleCount_t curTime; const SchedGraph* graph; FunctionLiveVarInfo &methodLiveVarInfo; hash_map lastUseMap; - std::vector nodeDelayVec; - std::vector nodeEarliestUseVec; - std::vector earliestReadyTimeForNode; - cycles_t earliestReadyTime; + std::vector nodeDelayVec; + std::vector nodeEarliestUseVec; + std::vector earliestReadyTimeForNode; + CycleCount_t earliestReadyTime; NodeHeap candsAsHeap; // candidate nodes, ready to go hash_set candsAsSet; //same entries as candsAsHeap, // but as set for fast lookup @@ -190,25 +190,25 @@ private: // NOTE: The next two return references to the actual vector entries. // Use the following two if you don't need to modify the value. - cycles_t& getNodeDelayRef (const SchedGraphNode* node) { + CycleCount_t& getNodeDelayRef (const SchedGraphNode* node) { assert(node->getNodeId() < nodeDelayVec.size()); return nodeDelayVec[node->getNodeId()]; } - cycles_t& getEarliestReadyTimeForNodeRef (const SchedGraphNode* node) { + CycleCount_t& getEarliestReadyTimeForNodeRef (const SchedGraphNode* node) { assert(node->getNodeId() < earliestReadyTimeForNode.size()); return earliestReadyTimeForNode[node->getNodeId()]; } - cycles_t getNodeDelay (const SchedGraphNode* node) const { + CycleCount_t getNodeDelay (const SchedGraphNode* node) const { return ((SchedPriorities*) this)->getNodeDelayRef(node); } - cycles_t getEarliestReadyTimeForNode(const SchedGraphNode* node) const { + CycleCount_t getEarliestReadyTimeForNode(const SchedGraphNode* node) const { return ((SchedPriorities*) this)->getEarliestReadyTimeForNodeRef(node); } }; -inline void SchedPriorities::updateTime(cycles_t c) { +inline void SchedPriorities::updateTime(CycleCount_t c) { curTime = c; nextToTry = candsAsHeap.begin(); mcands.clear(); -- 2.34.1