mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-14 17:28:53 +00:00
Get rid of some memory leaks identified by Valgrind
llvm-svn: 25960
This commit is contained in:
parent
43978e529e
commit
062ac6e46b
@ -50,6 +50,8 @@ namespace llvm {
|
|||||||
/// Node group - This struct is used to manage flagged node groups.
|
/// Node group - This struct is used to manage flagged node groups.
|
||||||
///
|
///
|
||||||
class NodeGroup {
|
class NodeGroup {
|
||||||
|
public:
|
||||||
|
NodeGroup *Next;
|
||||||
private:
|
private:
|
||||||
NIVector Members; // Group member nodes
|
NIVector Members; // Group member nodes
|
||||||
NodeInfo *Dominator; // Node with highest latency
|
NodeInfo *Dominator; // Node with highest latency
|
||||||
@ -59,7 +61,7 @@ namespace llvm {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Ctor.
|
// Ctor.
|
||||||
NodeGroup() : Dominator(NULL), Pending(0) {}
|
NodeGroup() : Next(NULL), Dominator(NULL), Pending(0) {}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline void setDominator(NodeInfo *D) { Dominator = D; }
|
inline void setDominator(NodeInfo *D) { Dominator = D; }
|
||||||
@ -256,13 +258,24 @@ namespace llvm {
|
|||||||
bool HasGroups; // True if there are any groups
|
bool HasGroups; // True if there are any groups
|
||||||
NodeInfo *Info; // Info for nodes being scheduled
|
NodeInfo *Info; // Info for nodes being scheduled
|
||||||
NIVector Ordering; // Emit ordering of nodes
|
NIVector Ordering; // Emit ordering of nodes
|
||||||
|
NodeGroup *HeadNG, *TailNG; // Keep track of allocated NodeGroups
|
||||||
|
|
||||||
ScheduleDAG(SchedHeuristics hstc, SelectionDAG &dag, MachineBasicBlock *bb,
|
ScheduleDAG(SchedHeuristics hstc, SelectionDAG &dag, MachineBasicBlock *bb,
|
||||||
const TargetMachine &tm)
|
const TargetMachine &tm)
|
||||||
: Heuristic(hstc), DAG(dag), BB(bb), TM(tm),
|
: Heuristic(hstc), DAG(dag), BB(bb), TM(tm), NodeCount(0),
|
||||||
NodeCount(0), HasGroups(false), Info(NULL) {}
|
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.
|
/// Run - perform scheduling.
|
||||||
///
|
///
|
||||||
@ -329,6 +342,8 @@ namespace llvm {
|
|||||||
/// IdentifyGroups - Put flagged nodes into groups.
|
/// IdentifyGroups - Put flagged nodes into groups.
|
||||||
///
|
///
|
||||||
void IdentifyGroups();
|
void IdentifyGroups();
|
||||||
|
|
||||||
|
void AddToGroup(NodeInfo *D, NodeInfo *U);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// createSimpleDAGScheduler - This creates a simple two pass instruction
|
/// createSimpleDAGScheduler - This creates a simple two pass instruction
|
||||||
|
@ -85,7 +85,7 @@ void ScheduleDAG::IdentifyGroups() {
|
|||||||
// No more flags to walk
|
// No more flags to walk
|
||||||
if (Op.getValueType() != MVT::Flag) break;
|
if (Op.getValueType() != MVT::Flag) break;
|
||||||
// Add to node group
|
// Add to node group
|
||||||
NodeGroup::Add(getNI(Op.Val), NI);
|
AddToGroup(getNI(Op.Val), NI);
|
||||||
// Let everyone else know
|
// Let everyone else know
|
||||||
HasGroups = true;
|
HasGroups = true;
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ static unsigned CountInternalUses(NodeInfo *D, NodeInfo *U) {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// Add - Adds a definer and user pair to a node group.
|
/// Add - Adds a definer and user pair to a node group.
|
||||||
///
|
///
|
||||||
void NodeGroup::Add(NodeInfo *D, NodeInfo *U) {
|
void ScheduleDAG::AddToGroup(NodeInfo *D, NodeInfo *U) {
|
||||||
// Get current groups
|
// Get current groups
|
||||||
NodeGroup *DGroup = D->Group;
|
NodeGroup *DGroup = D->Group;
|
||||||
NodeGroup *UGroup = U->Group;
|
NodeGroup *UGroup = U->Group;
|
||||||
@ -534,5 +534,11 @@ void NodeGroup::Add(NodeInfo *D, NodeInfo *U) {
|
|||||||
CountInternalUses(D, U));
|
CountInternalUses(D, U));
|
||||||
DGroup->group_push_back(D);
|
DGroup->group_push_back(D);
|
||||||
DGroup->group_push_back(U);
|
DGroup->group_push_back(U);
|
||||||
|
|
||||||
|
if (HeadNG == NULL)
|
||||||
|
HeadNG = DGroup;
|
||||||
|
if (TailNG != NULL)
|
||||||
|
TailNG->Next = DGroup;
|
||||||
|
TailNG = DGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1998,4 +1998,5 @@ void SelectionDAGISel::ScheduleAndEmitDAG(SelectionDAG &DAG) {
|
|||||||
SL = createBURRListDAGScheduler(DAG, BB);
|
SL = createBURRListDAGScheduler(DAG, BB);
|
||||||
}
|
}
|
||||||
BB = SL->Run();
|
BB = SL->Run();
|
||||||
|
delete SL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user