X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgraph.c;h=81d2de5886cd6e47d43023336b4be43e5c090f14;hb=b597c7fd473086ca6374b2abbdf129f595c156d0;hp=9f93e14fbb6e42fabe9f1a41cce083bb34f8c775;hpb=afc76013cf2d86ece32611ba055c4c5149be9dbc;p=libfirm diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index 9f93e14fb..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,62 +1047,21 @@ 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 clear_using_irn_visited(ir_graph *irg) { - assert(irg->using_irn_visited == 1); - irg->using_irn_visited = 0; -} - -int using_irn_visited(const ir_graph *irg) { - return irg->using_irn_visited; -} - - -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; -} - -void set_using_block_mark(ir_graph *irg) { - assert(irg->using_block_mark == 0); - irg->using_block_mark = 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_block_mark(ir_graph *irg) { - assert(irg->using_block_mark == 1); - irg->using_block_mark = 0; +void ir_free_resources(ir_graph *irg, ir_resources_t resources) +{ + assert((irg->reserved_resources & resources) == resources); + irg->reserved_resources &= ~resources; } -int using_block_mark(const ir_graph *irg) { - return irg->using_block_mark; +ir_resources_t ir_resources_reserved(const ir_graph *irg) +{ + return irg->reserved_resources; } #endif /* NDEBUG */