[llvm-commits] CVS: llvm/include/llvm/CodeGen/ScheduleDAG.h
Evan Cheng
evan.cheng at apple.com
Fri Feb 3 22:49:11 PST 2006
Changes in directory llvm/include/llvm/CodeGen:
ScheduleDAG.h updated: 1.7 -> 1.8
---
Log message:
Get rid of some memory leaks identified by Valgrind
---
Diffs of the changes: (+19 -4)
ScheduleDAG.h | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
Index: llvm/include/llvm/CodeGen/ScheduleDAG.h
diff -u llvm/include/llvm/CodeGen/ScheduleDAG.h:1.7 llvm/include/llvm/CodeGen/ScheduleDAG.h:1.8
--- llvm/include/llvm/CodeGen/ScheduleDAG.h:1.7 Wed Jan 25 18:28:35 2006
+++ llvm/include/llvm/CodeGen/ScheduleDAG.h Sat Feb 4 00:49:00 2006
@@ -50,6 +50,8 @@
/// 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 @@
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 @@
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) {}
+ : Heuristic(hstc), DAG(dag), BB(bb), TM(tm), NodeCount(0),
+ HasGroups(false), Info(NULL), HeadNG(NULL), TailNG(NULL) {}
- virtual ~ScheduleDAG() {};
+ 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 @@
/// IdentifyGroups - Put flagged nodes into groups.
///
void IdentifyGroups();
+
+ void AddToGroup(NodeInfo *D, NodeInfo *U);
};
/// createSimpleDAGScheduler - This creates a simple two pass instruction
More information about the llvm-commits
mailing list