From: Götz Lindenmaier Date: Fri, 23 Apr 2004 14:05:10 +0000 (+0000) Subject: debug output, warning, X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=989c6997e30f0abffa09c42c3b2fdbd54dd58fd3;p=libfirm debug output, warning, assertion removed [r2738] --- diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index d6300d579..070168c46 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -103,8 +103,10 @@ new_rd_Phi (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in int i; bool has_unknown = false; - assert( get_Block_matured(block) ); - assert( get_irn_arity(block) == arity ); + /* Don't assert that block matured: the use of this constructor is strongly + restricted ... */ + if ( get_Block_matured(block) ) + assert( get_irn_arity(block) == arity ); res = new_ir_node (db, irg, block, op_Phi, mode, arity, in); diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index 14c920faf..f3ba9a7b0 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -418,8 +418,8 @@ void dump_pointer_values_to_info(bool b) { /* Routines to dump information about a single ir node. */ /*******************************************************************/ -static INLINE int -dump_node_opcode(ir_node *n) +INLINE int +dump_node_opcode(FILE *F, ir_node *n) { int bad = 0; @@ -743,7 +743,7 @@ static void dump_const_node_local(ir_node *n) { n and const. */ fprintf(F, "node: {title: "); PRINT_CONSTID(n, con); fprintf(F, " label: \""); - bad |= dump_node_opcode(con); + bad |= dump_node_opcode(F, con); dump_node_mode (con); bad |= dump_node_typeinfo(con); fprintf (F, " "); @@ -775,7 +775,7 @@ static void dump_node(ir_node *n) fprintf(F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \""); bad = ! irn_vrfy_irg_dump(n, current_ir_graph, &p); - bad |= dump_node_opcode(n); + bad |= dump_node_opcode(F, n); dump_node_mode (n); bad |= dump_node_typeinfo(n); fprintf(F, " "); @@ -981,7 +981,7 @@ dump_whole_block(ir_node *block) { fprintf(F, "graph: { title: \""); PRINT_NODEID(block); fprintf(F, "\" label: \""); - dump_node_opcode(block); + dump_node_opcode(F, block); fprintf (F, " %ld", get_irn_node_nr(block)); #ifdef HEAPANAL if (get_opt_dump_abstvals()) @@ -1231,7 +1231,7 @@ void dump_entity_node(entity *ent) fprintf(F, "\npeculiarity: %s", get_peculiarity_string(get_entity_peculiarity(ent))); fprintf(F, "\nname: %s\nld_name: %s", - get_ent_dump_name(ent), ent->ld_name ? get_entity_ld_name(ent) : "no yet set"); + get_entity_name(ent), ent->ld_name ? get_entity_ld_name(ent) : "no yet set"); fprintf(F, "\noffset: %d", get_entity_offset(ent)); if (is_method_type(get_entity_type(ent))) { if (get_entity_irg(ent)) /* can be null */ @@ -2007,7 +2007,7 @@ void dump_loops_standalone (ir_loop *loop) { else fprintf(F, "\n"); - dump_node_opcode(n); + dump_node_opcode(F, n); dump_node_mode (n); dump_node_typeinfo(n); fprintf (F, " "); @@ -2132,7 +2132,7 @@ void dump_loop (ir_loop *l, char *suffix) { fprintf(F, "graph: { title: \""); PRINT_NODEID(b); fprintf(F, "\" label: \""); - dump_node_opcode(b); + dump_node_opcode(F, b); fprintf (F, " %ld", get_irn_node_nr(b)); fprintf(F, "\" status:clustered color:yellow\n"); @@ -2157,7 +2157,7 @@ void dump_loop (ir_loop *l, char *suffix) { fprintf(F, "graph: { title: \""); PRINT_NODEID(b); fprintf(F, "\" label: \""); - dump_node_opcode(b); + dump_node_opcode(F, b); fprintf (F, " %ld", get_irn_node_nr(b)); fprintf(F, "\" status:clustered color:lightblue\n"); diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index 4511027ec..72dea16b0 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -599,7 +599,7 @@ void inline_method(ir_node *call, ir_graph *called_graph) { ir_node **cf_pred; ir_node *ret, *phi; int arity, n_ret, n_exc, n_res, i, j, rem_opt, irn_arity; - int exc_handling; ir_node *proj; + int exc_handling; type *called_frame; if ( !(get_irg_inline_property(called_graph) == irg_inline_forced) && (!get_opt_optimize() || !get_opt_inline() || diff --git a/ir/tr/entity.c b/ir/tr/entity.c index d1115d9da..10e2c37bf 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -920,3 +920,93 @@ entity *resolve_ent_polymorphy(type *dynamic_class, entity* static_ent) { assert(res); return res; } + + + +/*******************************************************************/ +/** Debug aides **/ +/*******************************************************************/ + + +#if 1 || DEBUG_libfirm +INLINE int dump_node_opcode(FILE *F, ir_node *n); /* from irdump.c */ + +#define X(a) case a: printf(#a); break +void dump_entity (entity *ent) { + int i, j; + type *owner = get_entity_owner(ent); + type *type = get_entity_type(ent); + printf("entity %s (%ld)\n", get_entity_name(ent), get_entity_nr(ent)); + printf(" type: %s (%ld)\n", get_type_name(type), get_type_nr(type)); + printf(" owner: %s (%ld)\n", get_type_name(owner), get_type_nr(owner)); + + printf (" allocation: "); + switch (get_entity_allocation(ent)) { + X(allocation_dynamic); + X(allocation_automatic); + X(allocation_static); + X(allocation_parameter); + } + + printf ("\n visibility: "); + switch (get_entity_visibility(ent)) { + X(visibility_local); + X(visibility_external_visible); + X(visibility_external_allocated); + } + + printf ("\n variability: "); + switch (get_entity_variability(ent)) { + X(variability_uninitialized); + X(variability_initialized); + X(variability_part_constant); + X(variability_constant); + } + + if (get_entity_variability(ent) != variability_uninitialized) { + if (is_atomic_entity(ent)) { + printf("\n atomic value: "); + dump_node_opcode(stdout, get_atomic_ent_value(ent)); + } else { + printf("\n compound values:"); + for (i = 0; i < get_compound_ent_n_values(ent); ++i) { + compound_graph_path *path = get_compound_ent_value_path(ent, i); + entity *ent0 = get_compound_graph_path_node(path, 0); + printf("\n %2d %s", get_entity_offset(ent0), get_entity_name(ent0)); + for (j = 1; j < get_compound_graph_path_length(path); ++j) + printf(".%s", get_entity_name(get_compound_graph_path_node(path, j))); + printf("\t = "); + dump_node_opcode(stdout, get_compound_ent_value(ent, i)); + } + } + } + + printf ("\n volatility: "); + switch (get_entity_volatility(ent)) { + X(volatility_non_volatile); + X(volatility_is_volatile); + } + + printf("\n peculiarity: %s", get_peculiarity_string(get_entity_peculiarity(ent))); + printf("\n ld_name: %s", ent->ld_name ? get_entity_ld_name(ent) : "no yet set"); + printf("\n offset: %d", get_entity_offset(ent)); + if (is_method_type(get_entity_type(ent))) { + if (get_entity_irg(ent)) /* can be null */ + { printf ("\n irg = %ld", get_irg_graph_nr(get_entity_irg(ent))); } + else + { printf ("\n irg = NULL"); } + } + + + printf("\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\n"); + + +} +#undef X +#else /* DEBUG_libfirm */ +void dump_entity (entity *ent) {} +#endif /* DEBUG_libfirm */ diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 6938e1187..c088e1ea7 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -455,4 +455,17 @@ bool entity_not_visited(entity *ent); * dynamic type are given. */ entity *resolve_ent_polymorphy(type *dynamic_class, entity* static_ent); + +/*******************************************************************/ +/** Debug aides **/ +/*******************************************************************/ + + +/** Write the entity and all its attributes to stdout. + * + * Writes the entity and all its attributes to stdout if DEBUG_libfirm + * is set. Else does nothing. */ +void dump_entity (entity *ent); + + # endif /* _ENTITY_H_ */