aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/SparcV9
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-09 05:15:33 +0000
committerChris Lattner <sabre@nondot.org>2002-04-09 05:15:33 +0000
commitf3dd05ca03c9c649bf5b8891b73cda1e11ab914e (patch)
tree8a27ca9b082614612abb853f65d6539ff987b2de /lib/Target/SparcV9
parentfb005fe5c2b3cca4e982c8cc055964322c187ca2 (diff)
downloadexternal_llvm-f3dd05ca03c9c649bf5b8891b73cda1e11ab914e.zip
external_llvm-f3dd05ca03c9c649bf5b8891b73cda1e11ab914e.tar.gz
external_llvm-f3dd05ca03c9c649bf5b8891b73cda1e11ab914e.tar.bz2
Clean up the ownership model a bit so that nodes actually get deleted more
frequently. This still leaks edges quite a bit, but it leaks no nodes (I think). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9')
-rw-r--r--lib/Target/SparcV9/InstrSched/SchedGraph.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp
index daf4a49..28679bf 100644
--- a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp
+++ b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp
@@ -168,6 +168,9 @@ SchedGraphNode::SchedGraphNode(unsigned int _nodeId,
/*dtor*/
SchedGraphNode::~SchedGraphNode()
{
+ // for each node, delete its out-edges
+ std::for_each(beginOutEdges(), endOutEdges(),
+ deleter<SchedGraphEdge>);
}
void SchedGraphNode::dump(int indent=0) const {
@@ -233,16 +236,9 @@ SchedGraph::SchedGraph(const BasicBlock* bb,
SchedGraph::~SchedGraph()
{
for (const_iterator I = begin(); I != end(); ++I)
- {
- SchedGraphNode *node = I->second;
-
- // for each node, delete its out-edges
- std::for_each(node->beginOutEdges(), node->endOutEdges(),
- deleter<SchedGraphEdge>);
-
- // then delete the node itself.
- delete node;
- }
+ delete I->second;
+ delete graphRoot;
+ delete graphLeaf;
}
@@ -967,8 +963,8 @@ SchedGraphSet::SchedGraphSet(const Function* _function,
SchedGraphSet::~SchedGraphSet()
{
// delete all the graphs
- for (const_iterator I = begin(); I != end(); ++I)
- delete *I;
+ for(iterator I = begin(), E = end(); I != E; ++I)
+ delete *I; // destructor is a friend
}