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