diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-02-04 06:49:00 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-02-04 06:49:00 +0000 |
commit | cccf1232a69e2d78516c61a97e7bfa26acefb714 (patch) | |
tree | 7a5a6167ca448c9801e173b989ed409d2568ebcb /include | |
parent | 8f9f0d3a34ebbcd6d075fbb1250dc74f36579d50 (diff) | |
download | llvm-cccf1232a69e2d78516c61a97e7bfa26acefb714.tar.gz llvm-cccf1232a69e2d78516c61a97e7bfa26acefb714.tar.bz2 llvm-cccf1232a69e2d78516c61a97e7bfa26acefb714.tar.xz |
Get rid of some memory leaks identified by Valgrind
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/ScheduleDAG.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index 746f7b2330..c3513960ba 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -50,6 +50,8 @@ namespace llvm { /// Node group - This struct is used to manage flagged node groups. /// class NodeGroup { + public: + NodeGroup *Next; private: NIVector Members; // Group member nodes NodeInfo *Dominator; // Node with highest latency @@ -59,7 +61,7 @@ namespace llvm { public: // Ctor. - NodeGroup() : Dominator(NULL), Pending(0) {} + NodeGroup() : Next(NULL), Dominator(NULL), Pending(0) {} // Accessors inline void setDominator(NodeInfo *D) { Dominator = D; } @@ -256,13 +258,24 @@ namespace llvm { bool HasGroups; // True if there are any groups NodeInfo *Info; // Info for nodes being scheduled NIVector Ordering; // Emit ordering of nodes + NodeGroup *HeadNG, *TailNG; // Keep track of allocated NodeGroups ScheduleDAG(SchedHeuristics hstc, SelectionDAG &dag, MachineBasicBlock *bb, const TargetMachine &tm) - : Heuristic(hstc), DAG(dag), BB(bb), TM(tm), - NodeCount(0), HasGroups(false), Info(NULL) {} - - virtual ~ScheduleDAG() {}; + : Heuristic(hstc), DAG(dag), BB(bb), TM(tm), NodeCount(0), + HasGroups(false), Info(NULL), HeadNG(NULL), TailNG(NULL) {} + + virtual ~ScheduleDAG() { + if (Info) + delete[] Info; + + NodeGroup *NG = HeadNG; + while (NG) { + NodeGroup *NextSU = NG->Next; + delete NG; + NG = NextSU; + } + }; /// Run - perform scheduling. /// @@ -329,6 +342,8 @@ namespace llvm { /// IdentifyGroups - Put flagged nodes into groups. /// void IdentifyGroups(); + + void AddToGroup(NodeInfo *D, NodeInfo *U); }; /// createSimpleDAGScheduler - This creates a simple two pass instruction |