X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgraph.c;h=d469694365f8e256e23b65e9b50d20a665c99904;hb=357886575cb0becb5bd9be376fde49b57edd5385;hp=ade886f4bcd4ff4060dd31020160198418012cd3;hpb=b58fa7bff3669430bb2422735b193a043709d9d1;p=libfirm diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index ade886f4b..d46969436 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -111,10 +111,10 @@ static ir_graph *alloc_graph(void) */ static void free_graph(ir_graph *irg) { - char *ptr = (char *)irg; - int i; + char *ptr = (char *)irg; + ir_edge_kind_t i; - for (i = 0; i < EDGE_KIND_LAST; ++i) + for (i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i) edges_deactivate_kind(irg, i); DEL_ARR_F(irg->idx_irn_map); free(ptr - additional_graph_data_size); @@ -142,7 +142,7 @@ void irg_set_nloc(ir_graph *res, int n_loc) } /* Allocates a list of nodes: - - The start block containing a start node and Proj nodes for it's four + - The start block containing a start node and Proj nodes for its four results (X, M, P, Tuple). - The end block containing an end node. This block is not matured after new_ir_graph as predecessors need to be added to it. @@ -154,7 +154,7 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) { ir_graph *res; ir_node *first_block; - ir_node *end, *start, *start_block, *initial_mem, *projX, *bad; + ir_node *start, *start_block, *initial_mem, *projX; res = alloc_graph(); @@ -212,15 +212,11 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) /*-- Nodes needed in every graph --*/ set_irg_end_block (res, new_r_immBlock(res)); - end = new_r_End(res); - set_irg_end(res, end); + set_irg_end(res, new_r_End(res, 0, NULL)); - start_block = new_r_Block(res, 0, NULL); + start_block = new_r_Block_noopt(res, 0, NULL); set_irg_start_block(res, start_block); - bad = new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL); - bad->attr.irg.irg = res; - set_irg_bad (res, bad); - set_irg_no_mem (res, new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL)); + set_irg_no_mem (res, new_r_NoMem(res)); start = new_r_Start(res); set_irg_start (res, start); @@ -228,7 +224,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec); set_irg_initial_exec (res, projX); set_irg_frame (res, new_r_Proj(start, mode_P_data, pn_Start_P_frame_base)); - set_irg_tls (res, new_r_Proj(start, mode_P_data, pn_Start_P_tls)); set_irg_args (res, new_r_Proj(start, mode_T, pn_Start_T_args)); initial_mem = new_r_Proj(start, mode_M, pn_Start_M); set_irg_initial_mem(res, initial_mem); @@ -264,7 +259,6 @@ ir_graph *new_ir_graph(ir_entity *ent, int n_loc) ir_graph *new_const_code_irg(void) { ir_graph *res = alloc_graph(); - ir_node *bad; ir_node *body_block; ir_node *end; ir_node *end_block; @@ -299,18 +293,15 @@ ir_graph *new_const_code_irg(void) res->anchor = new_r_Anchor(res); /* -- The end block -- */ - end_block = new_r_Block(res, 0, NULL); + end_block = new_r_Block_noopt(res, 0, NULL); set_irg_end_block(res, end_block); - end = new_r_End(res); + end = new_r_End(res, 0, NULL); set_irg_end(res, end); /* -- The start block -- */ - start_block = new_r_Block(res, 0, NULL); + start_block = new_r_Block_noopt(res, 0, NULL); set_irg_start_block(res, start_block); - bad = new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL); - bad->attr.irg.irg = res; - set_irg_bad(res, bad); - no_mem = new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL); + no_mem = new_r_NoMem(res); set_irg_no_mem(res, no_mem); start = new_r_Start(res); set_irg_start(res, start); @@ -328,7 +319,6 @@ ir_graph *new_const_code_irg(void) set_Block_block_visited(body_block, -1); set_Block_block_visited(start_block, -1); set_irn_visited(start_block, -1); - set_irn_visited(bad, -1); set_irn_visited(no_mem, -1); return res; @@ -343,7 +333,7 @@ ir_graph *new_const_code_irg(void) */ static void copy_all_nodes(ir_node *node, void *env) { - ir_graph *irg = env; + ir_graph *irg = (ir_graph*)env; ir_node *new_node = irn_copy_into_irg(node, irg); set_irn_link(node, new_node); @@ -355,7 +345,7 @@ static void copy_all_nodes(ir_node *node, void *env) if (is_frame_type(tp)) { /* replace by the copied entity */ - ent = get_entity_link(ent); + ent = (ir_entity*)get_entity_link(ent); assert(is_entity(ent)); assert(get_entity_owner(ent) == get_irg_frame_type(irg)); @@ -425,7 +415,6 @@ ir_graph *create_irg_copy(ir_graph *irg) /* -- The start block -- */ set_irg_start_block(res, get_new_node(get_irg_start_block(irg))); - set_irg_bad (res, get_new_node(get_irg_bad(irg))); set_irg_no_mem (res, get_new_node(get_irg_no_mem(irg))); set_irg_start (res, get_new_node(get_irg_start(irg))); @@ -497,7 +486,7 @@ long get_irg_graph_nr(const ir_graph *irg) } #endif -int get_irg_idx(const ir_graph *irg) +size_t get_irg_idx(const ir_graph *irg) { return irg->index; } @@ -567,16 +556,6 @@ void (set_irg_frame)(ir_graph *irg, ir_node *node) _set_irg_frame(irg, node); } -ir_node *(get_irg_tls)(const ir_graph *irg) -{ - return _get_irg_tls(irg); -} - -void (set_irg_tls)(ir_graph *irg, ir_node *node) -{ - _set_irg_tls(irg, node); -} - ir_node *(get_irg_initial_mem)(const ir_graph *irg) { return _get_irg_initial_mem(irg); @@ -597,16 +576,6 @@ void (set_irg_args)(ir_graph *irg, ir_node *node) _set_irg_args(irg, node); } -ir_node *(get_irg_bad)(const ir_graph *irg) -{ - return _get_irg_bad(irg); -} - -void (set_irg_bad)(ir_graph *irg, ir_node *node) -{ - _set_irg_bad(irg, node); -} - ir_node *(get_irg_no_mem)(const ir_graph *irg) { return _get_irg_no_mem(irg); @@ -744,8 +713,8 @@ void (set_irg_loopinfo_inconsistent)(ir_graph *irg) void set_irp_loopinfo_inconsistent(void) { - int i; - for (i = get_irp_n_irgs() - 1; i >= 0; --i) { + size_t i, n; + for (i = 0, n = get_irp_n_irgs(); i < n; ++i) { set_irg_loopinfo_inconsistent(get_irp_irg(i)); } } @@ -777,19 +746,19 @@ void (set_irg_inline_property)(ir_graph *irg, irg_inline_property s) _set_irg_inline_property(irg, s); } -unsigned (get_irg_additional_properties)(const ir_graph *irg) +mtp_additional_properties (get_irg_additional_properties)(const ir_graph *irg) { return _get_irg_additional_properties(irg); } -void (set_irg_additional_properties)(ir_graph *irg, unsigned property_mask) +void (set_irg_additional_properties)(ir_graph *irg, mtp_additional_properties property_mask) { _set_irg_additional_properties(irg, property_mask); } -void (set_irg_additional_property)(ir_graph *irg, mtp_additional_property flag) +void (add_irg_additional_properties)(ir_graph *irg, mtp_additional_properties flag) { - _set_irg_additional_property(irg, flag); + _add_irg_additional_properties(irg, flag); } void (set_irg_link)(ir_graph *irg, void *thing) @@ -839,7 +808,7 @@ void set_max_irg_visited(int val) ir_visited_t inc_max_irg_visited(void) { #ifndef NDEBUG - int i; + size_t i; for (i = 0; i < get_irp_n_irgs(); i++) assert(max_irg_visited >= get_irg_visited(get_irp_irg(i))); #endif