Commit ea9c033e authored by Matthias Braun's avatar Matthias Braun
Browse files

fix ir_finish, freeing of irps/irgs

parent 8a5f1532
......@@ -123,20 +123,6 @@ void ir_init(void)
void ir_finish(void)
{
size_t i;
/* must iterate backwards here */
for (i = get_irp_n_irgs(); i > 0;)
free_ir_graph(get_irp_irg(--i));
free_type_entities(get_glob_type());
/* must iterate backwards here */
for (i = get_irp_n_types(); i > 0;)
free_type_entities(get_irp_type(--i));
for (i = get_irp_n_types(); i > 0;)
free_type(get_irp_type(--i));
free_ir_prog();
ir_finish_entity();
......
......@@ -435,15 +435,13 @@ void free_ir_graph(ir_graph *irg)
hook_free_graph(irg);
free_irg_outs(irg);
if (irg->frame_type)
free_type(irg->frame_type);
del_identities(irg);
if (irg->ent) {
set_entity_irg(irg->ent, NULL); /* not set in const code irg */
}
free_End(get_irg_end(irg));
obstack_free(irg->obst,NULL);
obstack_free(irg->obst, NULL);
free(irg->obst);
if (irg->loc_descriptions)
free(irg->loc_descriptions);
......
......@@ -135,10 +135,18 @@ ir_prog *new_ir_prog(const char *name)
list and entities in global type must be freed by hand before. */
void free_ir_prog(void)
{
ir_segment_t s;
for (s = IR_SEGMENT_FIRST; s <= IR_SEGMENT_LAST; ++s) {
free_type(irp->segment_types[s]);
}
size_t i;
/* must iterate backwards here */
for (i = get_irp_n_irgs(); i > 0;)
free_ir_graph(get_irp_irg(--i));
free_type_entities(get_glob_type());
/* must iterate backwards here */
for (i = get_irp_n_types(); i > 0;)
free_type_entities(get_irp_type(--i));
for (i = get_irp_n_types(); i > 0;)
free_type(get_irp_type(--i));
free_ir_graph(irp->const_code_irg);
DEL_ARR_F(irp->graphs);
......
Supports Markdown
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