X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgraph.c;h=81d2de5886cd6e47d43023336b4be43e5c090f14;hb=b597c7fd473086ca6374b2abbdf129f595c156d0;hp=b645db84a795d52600d11781246fb1a89fe72843;hpb=9c6ef39a9a1f9401eb46b5b577f109f704fa92b9;p=libfirm diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index b645db84a..81d2de588 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -166,6 +166,10 @@ void irg_set_nloc(ir_graph *res, int n_loc) { the store. This is not the number of parameters to the procedure! */ } + if (res->loc_descriptions) { + xfree(res->loc_descriptions); + res->loc_descriptions = NULL; + } } /* Allocates a list of nodes: @@ -485,7 +489,7 @@ ir_graph *create_irg_copy(ir_graph *irg) { res->phase_state = irg->phase_state; - set_using_irn_link(irg); + ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK); /* copy all nodes from the graph irg to the new graph res */ irg_walk_anchors(irg, copy_all_nodes, set_all_preds, res); @@ -512,7 +516,7 @@ ir_graph *create_irg_copy(ir_graph *irg) { is different from the original one. */ res->estimated_node_count = irg->estimated_node_count; - clear_using_irn_link(irg); + ir_free_resources(irg, IR_RESOURCE_IRN_LINK); return res; } @@ -529,6 +533,8 @@ ir_graph *create_irg_copy(ir_graph *irg) { void free_ir_graph(ir_graph *irg) { assert(is_ir_graph(irg)); + edges_deactivate(irg); + hook_free_graph(irg); if (irg->outs_state != outs_none) free_irg_outs(irg); @@ -1041,50 +1047,23 @@ void *get_irg_loc_description(ir_graph *irg, int n) { } #ifndef NDEBUG -void set_using_block_visited(ir_graph *irg) { - assert(irg->using_block_visited == 0); - irg->using_block_visited = 1; -} - -void clear_using_block_visited(ir_graph *irg) { - assert(irg->using_block_visited == 1); - irg->using_block_visited = 0; -} - -int using_block_visited(const ir_graph *irg) { - return irg->using_block_visited; -} - - -void set_using_irn_visited(ir_graph *irg) { - assert(irg->using_irn_visited == 0); - irg->using_irn_visited = 1; +void ir_reserve_resources(ir_graph *irg, ir_resources_t resources) +{ + assert((irg->reserved_resources & resources) == 0); + irg->reserved_resources |= resources; } -void clear_using_irn_visited(ir_graph *irg) { - assert(irg->using_irn_visited == 1); - irg->using_irn_visited = 0; +void ir_free_resources(ir_graph *irg, ir_resources_t resources) +{ + assert((irg->reserved_resources & resources) == resources); + irg->reserved_resources &= ~resources; } -int using_irn_visited(const ir_graph *irg) { - return irg->using_irn_visited; +ir_resources_t ir_resources_reserved(const ir_graph *irg) +{ + return irg->reserved_resources; } - - -void set_using_irn_link(ir_graph *irg) { - assert(irg->using_irn_link == 0); - irg->using_irn_link = 1; -} - -void clear_using_irn_link(ir_graph *irg) { - assert(irg->using_irn_link == 1); - irg->using_irn_link = 0; -} - -int using_irn_link(const ir_graph *irg) { - return irg->using_irn_link; -} -#endif +#endif /* NDEBUG */ /* Returns a estimated node count of the irg. */ unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {