Commit 798d009e authored by yb9976's avatar yb9976
Browse files

Fixed more memory leaks.

[r20868]
parent 70a76105
...@@ -163,6 +163,12 @@ static INLINE void init_stack(void) { ...@@ -163,6 +163,12 @@ static INLINE void init_stack(void) {
tos = 0; tos = 0;
} }
static void finish_stack(void)
{
DEL_ARR_F(stack);
stack = NULL;
}
/** /**
* Push a node n onto the IR-node stack. * Push a node n onto the IR-node stack.
*/ */
...@@ -296,6 +302,11 @@ static INLINE void init_scc(ir_graph *irg, struct obstack *obst) { ...@@ -296,6 +302,11 @@ static INLINE void init_scc(ir_graph *irg, struct obstack *obst) {
irg_walk_graph(irg, init_node, NULL, obst); irg_walk_graph(irg, init_node, NULL, obst);
} }
static INLINE void finish_scc(void)
{
finish_stack();
}
#ifdef INTERPROCEDURAL_VIEW #ifdef INTERPROCEDURAL_VIEW
/** /**
* Initializes the scc algorithm for the interprocedural case. * Initializes the scc algorithm for the interprocedural case.
...@@ -655,6 +666,7 @@ int construct_cf_backedges(ir_graph *irg) { ...@@ -655,6 +666,7 @@ int construct_cf_backedges(ir_graph *irg) {
if (is_Block(el)) if (is_Block(el))
cfscc(el); cfscc(el);
} }
finish_scc();
obstack_free(&temp, NULL); obstack_free(&temp, NULL);
assert(head_rem == current_loop); assert(head_rem == current_loop);
......
...@@ -209,6 +209,12 @@ static INLINE void init_stack(void) { ...@@ -209,6 +209,12 @@ static INLINE void init_stack(void) {
tos = 0; tos = 0;
} }
static void finish_stack(void)
{
DEL_ARR_F(stack);
stack = NULL;
}
#if 0 #if 0
/** /**
* Frees the stack. * Frees the stack.
...@@ -350,6 +356,11 @@ static INLINE void init_scc(ir_graph *irg, struct obstack *obst) { ...@@ -350,6 +356,11 @@ static INLINE void init_scc(ir_graph *irg, struct obstack *obst) {
*/ */
} }
static INLINE void finish_scc(void)
{
finish_stack();
}
#ifdef INTERPROCEDURAL_VIEW #ifdef INTERPROCEDURAL_VIEW
static INLINE void init_ip_scc(struct obstack *obst) { static INLINE void init_ip_scc(struct obstack *obst) {
init_scc_common(); init_scc_common();
...@@ -931,6 +942,8 @@ int construct_backedges(ir_graph *irg) { ...@@ -931,6 +942,8 @@ int construct_backedges(ir_graph *irg) {
inc_irg_visited(irg); inc_irg_visited(irg);
scc(get_irg_end(irg)); scc(get_irg_end(irg));
finish_scc();
obstack_free(&temp, NULL); obstack_free(&temp, NULL);
assert(head_rem == current_loop); assert(head_rem == current_loop);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment