mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 13:36:28 +00:00
Updating my versions of ModuloScheduling in cvs. Still not complete.
llvm-svn: 13424
This commit is contained in:
parent
7cc5d0f106
commit
57339f67d6
@ -29,7 +29,7 @@ MSchedGraphNode::MSchedGraphNode(const MachineInstr* inst,
|
||||
}
|
||||
|
||||
void MSchedGraphNode::print(std::ostream &os) const {
|
||||
os << "MSehedGraphNode: Inst=" << *Inst << ", latency= " << latency << "\n";
|
||||
os << "MSchedGraphNode: Inst=" << *Inst << ", latency= " << latency << "\n";
|
||||
}
|
||||
|
||||
MSchedGraphEdge MSchedGraphNode::getInEdge(MSchedGraphNode *pred) {
|
||||
@ -41,9 +41,38 @@ MSchedGraphEdge MSchedGraphNode::getInEdge(MSchedGraphNode *pred) {
|
||||
return I.getEdge();
|
||||
}
|
||||
assert(0 && "Should have found edge between this node and its predecessor!");
|
||||
|
||||
|
||||
}
|
||||
|
||||
unsigned MSchedGraphNode::getInEdgeNum(MSchedGraphNode *pred) {
|
||||
//Loop over all the successors of our predecessor
|
||||
//return the edge the corresponds to this in edge
|
||||
int count = 0;
|
||||
for(MSchedGraphNode::succ_iterator I = pred->succ_begin(), E = pred->succ_end();
|
||||
I != E; ++I) {
|
||||
if(*I == this)
|
||||
return count;
|
||||
count++;
|
||||
}
|
||||
assert(0 && "Should have found edge between this node and its predecessor!");
|
||||
abort();
|
||||
}
|
||||
bool MSchedGraphNode::isSuccessor(MSchedGraphNode *succ) {
|
||||
for(succ_iterator I = succ_begin(), E = succ_end(); I != E; ++I)
|
||||
if(*I == succ)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool MSchedGraphNode::isPredecessor(MSchedGraphNode *pred) {
|
||||
if(find( Predecessors.begin(), Predecessors.end(), pred) != Predecessors.end())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void MSchedGraph::addNode(const MachineInstr *MI,
|
||||
MSchedGraphNode *node) {
|
||||
|
||||
@ -92,12 +121,15 @@ void MSchedGraph::buildNodesAndEdges() {
|
||||
MachineOpCode MIopCode = MI->getOpcode();
|
||||
int delay;
|
||||
|
||||
#if 0 // FIXME: LOOK INTO THIS
|
||||
//Check if subsequent instructions can be issued before
|
||||
//the result is ready, if so use min delay.
|
||||
if(MTI.hasResultInterlock(MIopCode))
|
||||
delay = MTI.minLatency(MIopCode);
|
||||
else
|
||||
delay = MTI.maxLatency(MIopCode);
|
||||
#endif
|
||||
/// FIxME: get this from the sched class.
|
||||
delay = 7; //MTI.maxLatency(MIopCode);
|
||||
|
||||
//Create new node for this machine instruction and add to the graph.
|
||||
//Create only if not a nop
|
||||
|
@ -99,6 +99,10 @@ namespace llvm {
|
||||
bool hasSuccessors() { return (Successors.size() > 0); }
|
||||
int getLatency() { return latency; }
|
||||
MSchedGraphEdge getInEdge(MSchedGraphNode *pred);
|
||||
unsigned getInEdgeNum(MSchedGraphNode *pred);
|
||||
|
||||
bool isSuccessor(MSchedGraphNode *);
|
||||
bool isPredecessor(MSchedGraphNode *);
|
||||
|
||||
//Debug support
|
||||
void print(std::ostream &os) const;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,22 +41,53 @@ namespace llvm {
|
||||
//Map that holds node to node attribute information
|
||||
std::map<MSchedGraphNode*, MSNodeAttributes> nodeToAttributesMap;
|
||||
|
||||
//Map to hold all reccurrences
|
||||
std::set<std::pair<int, std::vector<MSchedGraphNode*> > > recurrenceList;
|
||||
|
||||
//Set of edges to ignore, stored as src node and index into vector of successors
|
||||
std::set<std::pair<MSchedGraphNode*, unsigned> > edgesToIgnore;
|
||||
|
||||
//Vector containing the partial order
|
||||
std::vector<std::vector<MSchedGraphNode*> > partialOrder;
|
||||
|
||||
//Vector containing the final node order
|
||||
std::vector<MSchedGraphNode*> FinalNodeOrder;
|
||||
|
||||
//Schedule table, key is the cycle number and the vector is resource, node pairs
|
||||
std::map<unsigned, std::vector<std::pair<unsigned, std::vector<MSchedGraphNode*> > > > schedule;
|
||||
|
||||
//Current initiation interval
|
||||
int II;
|
||||
|
||||
//Internal functions
|
||||
bool MachineBBisValid(const MachineBasicBlock *BI);
|
||||
int calculateResMII(const MachineBasicBlock *BI);
|
||||
int calculateRecMII(MSchedGraph *graph, int MII);
|
||||
void calculateNodeAttributes(MSchedGraph *graph, int MII);
|
||||
void calculateASAP(MSchedGraphNode *node, MSNodeAttributes &attributes,
|
||||
int MII,std::set<MSchedGraphNode*> &visitedNodes);
|
||||
void calculateALAP(MSchedGraphNode *node, MSNodeAttributes &attributes, int MII,
|
||||
int maxASAP, std::set<MSchedGraphNode*> &visitedNodes);
|
||||
void calculateHeight(MSchedGraphNode *node,
|
||||
MSNodeAttributes &attributes, std::set<MSchedGraphNode*> &visitedNodes);
|
||||
void calculateDepth(MSchedGraphNode *node, MSNodeAttributes &attributes,
|
||||
std::set<MSchedGraphNode*> &visitedNodes);
|
||||
|
||||
bool ignoreEdge(MSchedGraphNode *srcNode, MSchedGraphNode *destNode);
|
||||
|
||||
|
||||
int calculateASAP(MSchedGraphNode *node, int MII,MSchedGraphNode *destNode);
|
||||
int calculateALAP(MSchedGraphNode *node, int MII, int maxASAP, MSchedGraphNode *srcNode);
|
||||
|
||||
int calculateHeight(MSchedGraphNode *node,MSchedGraphNode *srcNode);
|
||||
int calculateDepth(MSchedGraphNode *node, MSchedGraphNode *destNode);
|
||||
|
||||
int findMaxASAP();
|
||||
void ModuloSchedulingPass::orderNodes();
|
||||
void findAllReccurrences(MSchedGraphNode *node, std::vector<MSchedGraphNode*> &visitedNodes);
|
||||
void orderNodes();
|
||||
void findAllReccurrences(MSchedGraphNode *node,
|
||||
std::vector<MSchedGraphNode*> &visitedNodes, int II);
|
||||
void addReccurrence(std::vector<MSchedGraphNode*> &recurrence, int II, MSchedGraphNode*, MSchedGraphNode*);
|
||||
|
||||
void computePartialOrder();
|
||||
void computeSchedule();
|
||||
bool scheduleNode(MSchedGraphNode *node,
|
||||
int start, int end);
|
||||
|
||||
void predIntersect(std::vector<MSchedGraphNode*> &CurrentSet, std::vector<MSchedGraphNode*> &IntersectResult);
|
||||
void succIntersect(std::vector<MSchedGraphNode*> &CurrentSet, std::vector<MSchedGraphNode*> &IntersectResult);
|
||||
|
||||
public:
|
||||
ModuloSchedulingPass(TargetMachine &targ) : target(targ) {}
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
Loading…
Reference in New Issue
Block a user