diff options
Diffstat (limited to 'lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp')
-rw-r--r-- | lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp b/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp index 9cae7c616c..cabbf942a4 100644 --- a/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp @@ -1,10 +1,10 @@ //===- SchedGraphCommon.cpp - Scheduling Graphs Base Class- ---------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // Scheduling graph base class that contains common information for SchedGraph @@ -23,7 +23,7 @@ class SchedGraphCommon; // // class SchedGraphEdge -// +// SchedGraphEdge::SchedGraphEdge(SchedGraphNodeCommon* _src, SchedGraphNodeCommon* _sink, SchedGraphEdgeDepType _depType, @@ -31,7 +31,7 @@ SchedGraphEdge::SchedGraphEdge(SchedGraphNodeCommon* _src, int _minDelay) : src(_src), sink(_sink), depType(_depType), depOrderType(_depOrderType), minDelay((_minDelay >= 0)? _minDelay : _src->getLatency()), val(NULL) { - + iteDiff=0; assert(src != sink && "Self-loop in scheduling graph!"); src->addOutEdge(this); @@ -81,7 +81,7 @@ SchedGraphEdge::SchedGraphEdge(SchedGraphNodeCommon* _src, void SchedGraphEdge::dump(int indent) const { - std::cerr << std::string(indent*2, ' ') << *this; + std::cerr << std::string(indent*2, ' ') << *this; } /*dtor*/ @@ -94,7 +94,7 @@ SchedGraphNodeCommon::~SchedGraphNodeCommon() void SchedGraphNodeCommon::removeInEdge(const SchedGraphEdge* edge) { assert(edge->getSink() == this); - + for (iterator I = beginInEdges(); I != endInEdges(); ++I) if ((*I) == edge) { inEdges.erase(I); @@ -104,7 +104,7 @@ void SchedGraphNodeCommon::removeInEdge(const SchedGraphEdge* edge) { void SchedGraphNodeCommon::removeOutEdge(const SchedGraphEdge* edge) { assert(edge->getSrc() == this); - + for (iterator I = beginOutEdges(); I != endOutEdges(); ++I) if ((*I) == edge) { outEdges.erase(I); @@ -113,7 +113,7 @@ void SchedGraphNodeCommon::removeOutEdge(const SchedGraphEdge* edge) { } void SchedGraphNodeCommon::dump(int indent) const { - std::cerr << std::string(indent*2, ' ') << *this; + std::cerr << std::string(indent*2, ' ') << *this; } //class SchedGraphCommon @@ -124,7 +124,7 @@ SchedGraphCommon::~SchedGraphCommon() { } -void SchedGraphCommon::eraseIncomingEdges(SchedGraphNodeCommon* node, +void SchedGraphCommon::eraseIncomingEdges(SchedGraphNodeCommon* node, bool addDummyEdges) { // Delete and disconnect all in-edges for the node for (SchedGraphNodeCommon::iterator I = node->beginInEdges(); @@ -132,22 +132,22 @@ void SchedGraphCommon::eraseIncomingEdges(SchedGraphNodeCommon* node, SchedGraphNodeCommon* srcNode = (*I)->getSrc(); srcNode->removeOutEdge(*I); delete *I; - + if (addDummyEdges && srcNode != getRoot() && - srcNode->beginOutEdges() == srcNode->endOutEdges()) { - + srcNode->beginOutEdges() == srcNode->endOutEdges()) { + // srcNode has no more out edges, so add an edge to dummy EXIT node assert(node != getLeaf() && "Adding edge that was just removed?"); (void) new SchedGraphEdge(srcNode, getLeaf(), - SchedGraphEdge::CtrlDep, + SchedGraphEdge::CtrlDep, SchedGraphEdge::NonDataDep, 0); } } - + node->inEdges.clear(); } -void SchedGraphCommon::eraseOutgoingEdges(SchedGraphNodeCommon* node, +void SchedGraphCommon::eraseOutgoingEdges(SchedGraphNodeCommon* node, bool addDummyEdges) { // Delete and disconnect all out-edges for the node for (SchedGraphNodeCommon::iterator I = node->beginOutEdges(); @@ -155,23 +155,23 @@ void SchedGraphCommon::eraseOutgoingEdges(SchedGraphNodeCommon* node, SchedGraphNodeCommon* sinkNode = (*I)->getSink(); sinkNode->removeInEdge(*I); delete *I; - + if (addDummyEdges && sinkNode != getLeaf() && sinkNode->beginInEdges() == sinkNode->endInEdges()) { - + //sinkNode has no more in edges, so add an edge from dummy ENTRY node assert(node != getRoot() && "Adding edge that was just removed?"); (void) new SchedGraphEdge(getRoot(), sinkNode, - SchedGraphEdge::CtrlDep, + SchedGraphEdge::CtrlDep, SchedGraphEdge::NonDataDep, 0); } } - + node->outEdges.clear(); } -void SchedGraphCommon::eraseIncidentEdges(SchedGraphNodeCommon* node, +void SchedGraphCommon::eraseIncidentEdges(SchedGraphNodeCommon* node, bool addDummyEdges) { this->eraseIncomingEdges(node, addDummyEdges); this->eraseOutgoingEdges(node, addDummyEdges); |