From: Matthias Braun Date: Sun, 18 Sep 2011 15:40:41 +0000 (+0200) Subject: eliminate ip_outs_state and trouts_state X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=550ae1cfb30f5f8ea46c7bef0816acbac6f944c5;p=libfirm eliminate ip_outs_state and trouts_state Noone is really using these informations at the moment and they weren't correctly invalidated anyway. --- diff --git a/include/libfirm/irgraph.h b/include/libfirm/irgraph.h index 117d80f36..dbc2e7fb9 100644 --- a/include/libfirm/irgraph.h +++ b/include/libfirm/irgraph.h @@ -307,16 +307,6 @@ FIRM_API void set_irg_phase_state(ir_graph *irg, irg_phase_state state); The enum op_pin_state is defined in irop.h. */ FIRM_API op_pin_state get_irg_pinned(const ir_graph *irg); -/** state: outs_state - * Outs are the back edges or def-use edges of ir nodes. - * Values: outs_none, outs_consistent, outs_inconsistent */ -typedef enum { - outs_none, /**< Outs are not computed, no memory is allocated. */ - outs_consistent, /**< Outs are computed and correct. */ - outs_inconsistent /**< Outs have been computed, memory is still allocated, - but the graph has been changed since. */ -} irg_outs_state; - /** state: callee_information_state * Call nodes contain a list of possible callees. This list must be * computed by an analysis. diff --git a/include/libfirm/irprog.h b/include/libfirm/irprog.h index 49517eb3a..c10d236ef 100644 --- a/include/libfirm/irprog.h +++ b/include/libfirm/irprog.h @@ -259,9 +259,6 @@ FIRM_API ir_graph *get_const_code_irg(void); FIRM_API irg_phase_state get_irp_phase_state(void); FIRM_API void set_irp_phase_state(irg_phase_state s); -FIRM_API irg_outs_state get_irp_ip_outs_state(void); -FIRM_API void set_irp_ip_outs_inconsistent(void); - /** * Creates an ir_prog pass for set_irp_phase_state(). * diff --git a/include/libfirm/trouts.h b/include/libfirm/trouts.h index b3f555520..59ffdf72c 100644 --- a/include/libfirm/trouts.h +++ b/include/libfirm/trouts.h @@ -95,14 +95,6 @@ FIRM_API void add_type_arraytype_of(const ir_type *tp, ir_type *atp); /* Building and Removing the trout datastructure */ /*------------------------------------------------------------------*/ -/** The state of the tr_out datastructure. - * - * We reuse the enum of irouts. - * @see irouts.h. */ -FIRM_API irg_outs_state get_trouts_state(void); -/** Set the tr out state to inconsistent if it is consistent. */ -FIRM_API void set_trouts_inconsistent(void); - /** Compute the outs of types and entities. * * Collects all reference from irnodes to types or entities in the diff --git a/ir/ana/trouts.c b/ir/ana/trouts.c index 8d17939e5..c2596420a 100644 --- a/ir/ana/trouts.c +++ b/ir/ana/trouts.c @@ -636,17 +636,6 @@ static void chain_types(ir_type *tp) } } -irg_outs_state get_trouts_state(void) -{ - return irp->trouts_state; -} - -void set_trouts_inconsistent(void) -{ - if (irp->trouts_state == outs_consistent) - irp->trouts_state = outs_inconsistent; -} - /* compute the trouts data structures. */ void compute_trouts(void) { @@ -667,8 +656,6 @@ void compute_trouts(void) ir_type *type = get_irp_type(--i); chain_types(type); } - - irp->trouts_state = outs_consistent; } void free_trouts(void) @@ -738,6 +725,4 @@ void free_trouts(void) pmap_destroy(type_arraytype_map); type_arraytype_map = NULL; } - - irp->trouts_state = outs_none; } diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 352767753..444372527 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -324,59 +324,6 @@ void dump_graph_as_text(FILE *out, ir_graph *irg) fprintf(out, "graph %s\n", get_irg_dump_name(irg)); } -/** dumps something like: - * - * "prefix" "Name" (x): node1, ... node7,\n - * "prefix" node8, ... node15,\n - * "prefix" node16, node17\n - */ -static void dump_node_list(FILE *F, firm_kind *k, const char *prefix, - size_t (*get_entity_n_nodes)(firm_kind *ent), - ir_node *(*get_entity_node)(firm_kind *ent, size_t pos), - const char *name) -{ - size_t i, n_nodes = get_entity_n_nodes(k); - const char *comma = ""; - - ir_fprintf(F, "%s %s (%zu):", prefix, name, n_nodes); - for (i = 0; i < n_nodes; ++i) { - if (i > 7 && !(i & 7)) { /* line break every eight node. */ - fprintf(F, ",\n%s ", prefix); - comma = ""; - } - fprintf(F, "%s ", comma); - dump_node_label(F, get_entity_node(k, i)); - comma = ","; - } - fprintf(F, "\n"); -} - -/** dumps something like: - * - * "prefix" "Name" (x): node1, ... node7,\n - * "prefix" node8, ... node15,\n - * "prefix" node16, node17\n - */ -static void dump_type_list(FILE *F, ir_type *tp, const char *prefix, - size_t (*get_n_types)(const ir_type *tp), - ir_type *(*get_type)(const ir_type *tp, size_t pos), - const char *name) -{ - size_t i, n_nodes = get_n_types(tp); - const char *comma = ""; - - ir_fprintf(F, "%s %s (%zu):", prefix, name, n_nodes); - for (i = 0; i < n_nodes; ++i) { - if (i > 7 && !(i & 7)) { /* line break every eight node. */ - fprintf(F, ",\n%s ", prefix); - comma = ""; - } - ir_fprintf(F, "%s %+F", comma, get_type(tp, i)); - comma = ","; - } - fprintf(F, "\n"); -} - static int need_nl = 1; /** @@ -632,14 +579,6 @@ static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, const char *pref } fputc('\n', F); } - - if (get_trouts_state()) { - fprintf(F, "%s Entity outs:\n", prefix); - dump_node_list(F, (firm_kind *)ent, prefix, (size_t(*)(firm_kind *))get_entity_n_accesses, - (ir_node *(*)(firm_kind *, size_t))get_entity_access, "Accesses"); - dump_node_list(F, (firm_kind *)ent, prefix, (size_t(*)(firm_kind *))get_entity_n_references, - (ir_node *(*)(firm_kind *, size_t))get_entity_reference, "References"); - } } void dump_entity_to_file(FILE *out, ir_entity *ent) @@ -872,15 +811,6 @@ void dump_type_to_file(FILE *F, ir_type *tp) if (is_atomic_type(tp) || is_Method_type(tp)) fprintf(F, " mode: %s,\n", get_mode_name(get_type_mode(tp))); - if (get_trouts_state()) { - fprintf(F, "\n Type outs:\n"); - dump_node_list(F, (firm_kind *)tp, " ", (size_t(*)(firm_kind *))get_type_n_allocs, - (ir_node *(*)(firm_kind *, size_t))get_type_alloc, "Allocations"); - dump_node_list(F, (firm_kind *)tp, " ", (size_t(*)(firm_kind *))get_type_n_casts, - (ir_node *(*)(firm_kind *, size_t))get_type_cast, "Casts"); - dump_type_list(F, tp, " ", get_type_n_pointertypes_to, get_type_pointertype_to, "PointerTpsTo"); - } - fprintf(F, "\n\n"); } diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index f4ce08b86..e248d958f 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -111,9 +111,6 @@ static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name) irp->const_code_irg = new_const_code_irg(); irp->phase_state = phase_building; - irp->outs_state = outs_none; - irp->ip_outedges = NULL; - irp->trouts_state = outs_none; irp->class_cast_state = ir_class_casts_transitive; irp->globals_entity_usage_state = ir_entity_usage_not_computed; @@ -445,16 +442,6 @@ ir_prog_pass_t *set_irp_phase_state_pass(const char *name, irg_phase_state state return &pass->pass; } -irg_outs_state get_irp_ip_outs_state(void) -{ - return irp->outs_state; -} - -void set_irp_ip_outs_inconsistent(void) -{ - irp->outs_state = outs_inconsistent; -} - void set_irp_ip_outedges(ir_node ** ip_outedges) { irp->ip_outedges = ip_outedges; diff --git a/ir/ir/irtypes.h b/ir/ir/irtypes.h index 1f289c748..bf9f238f9 100644 --- a/ir/ir/irtypes.h +++ b/ir/ir/irtypes.h @@ -574,10 +574,8 @@ struct ir_prog { /* -- states of and access to generated information -- */ irg_phase_state phase_state; /**< The state of construction. */ - irg_outs_state outs_state; /**< The state of out edges of type information. */ ir_node **ip_outedges; /**< A huge Array that contains all out edges in interprocedural view. */ - irg_outs_state trouts_state; /**< The state of out edges of type information. */ irg_callee_info_state callee_info_state; /**< Validity of callee information. Contains the lowest value or all irgs. */ diff --git a/ir/lower/lower_intrinsics.c b/ir/lower/lower_intrinsics.c index ece4c94e8..a185916e5 100644 --- a/ir/lower/lower_intrinsics.c +++ b/ir/lower/lower_intrinsics.c @@ -145,9 +145,6 @@ size_t lower_intrinsics(i_record *list, size_t length, int part_block_used) clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS); - /* Calls might be removed/added. */ - set_trouts_inconsistent(); - /* verify here */ irg_verify(irg, VERIFY_NORMAL); diff --git a/ir/opt/opt_blocks.c b/ir/opt/opt_blocks.c index eddaad7bb..dcec959c6 100644 --- a/ir/opt/opt_blocks.c +++ b/ir/opt/opt_blocks.c @@ -1263,9 +1263,6 @@ int shape_blocks(ir_graph *irg) /* control flow changed */ clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS); - - /* Calls might be removed. */ - set_trouts_inconsistent(); } for (bl = env.all_blocks; bl != NULL; bl = bl->all_next) { diff --git a/ir/opt/tailrec.c b/ir/opt/tailrec.c index 342a05c5b..76a765add 100644 --- a/ir/opt/tailrec.c +++ b/ir/opt/tailrec.c @@ -155,9 +155,6 @@ static void do_opt_tail_rec(ir_graph *irg, tr_env *env) clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS); - /* calls are removed */ - set_trouts_inconsistent(); - /* we must build some new nodes WITHOUT CSE */ set_optimize(0); @@ -268,7 +265,6 @@ static void do_opt_tail_rec(ir_graph *irg, tr_env *env) clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE | IR_GRAPH_STATE_CONSISTENT_LOOPINFO | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS); - set_trouts_inconsistent(); set_irg_callee_info_state(irg, irg_callee_info_inconsistent); set_optimize(rem); diff --git a/ir/opt/tropt.c b/ir/opt/tropt.c index 7e2ac66d2..bb5525596 100644 --- a/ir/opt/tropt.c +++ b/ir/opt/tropt.c @@ -62,20 +62,9 @@ static gen_pointer_type_to_func gen_pointer_type_to = default_gen_pointer_type_t */ static ir_type *default_gen_pointer_type_to(ir_type *tp) { - ir_type *res = NULL; - if (get_trouts_state() == outs_consistent) { - if (get_type_n_pointertypes_to(tp) > 0) { - res = get_type_pointertype_to(tp, 0); - } else { - res = new_type_pointer(tp); - /* Update trout for pointer types, so we can use it in next call. */ - add_type_pointertype_to(tp, res); - } - } else { - res = find_pointer_type_to_type(tp); - if (res == firm_unknown_type) - res = new_type_pointer(tp); - } + ir_type *res = find_pointer_type_to_type(tp); + if (res == firm_unknown_type) + res = new_type_pointer(tp); return res; } @@ -136,7 +125,6 @@ static ir_node *normalize_values_type(ir_type *totype, ir_node *pred) pred = new_cast; ++n_casts_normalized; set_irn_typeinfo_type(new_cast, new_type); /* keep type information up to date. */ - if (get_trouts_state() != outs_none) add_type_cast(new_type, new_cast); } } else { assert(is_SuperClass_of(totype, fromtype)); @@ -157,7 +145,6 @@ static ir_node *normalize_values_type(ir_type *totype, ir_node *pred) pred = new_cast; ++n_casts_normalized; set_irn_typeinfo_type(new_cast, new_type); /* keep type information up to date. */ - if (get_trouts_state() != outs_none) add_type_cast(new_type, new_cast); } } return new_cast; @@ -488,10 +475,6 @@ void optimize_class_casts(void) changed = 0; all_irg_walk(NULL, irn_optimize_class_cast, &changed); - if (changed) { - set_trouts_inconsistent(); - } - DB((dbg, SET_LEVEL_1, " Cast optimization: %zu Casts removed, %zu Sels concretized.\n", n_casts_removed, n_sels_concretized)); }