X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firargs.c;h=77617ae21f779273038aaebe2c763e9b249f6e77;hb=6b124543aff56817fcfe6d5b5ff181ac5c790e73;hp=bdc546d0d8d5b0da378d015c4ab73f25034be0d3;hpb=05ea88e192e74d381d74c6336e36fd972d7d728e;p=libfirm diff --git a/ir/ir/irargs.c b/ir/ir/irargs.c index bdc546d0d..77617ae21 100644 --- a/ir/ir/irargs.c +++ b/ir/ir/irargs.c @@ -23,9 +23,7 @@ * @author Sebastian Hack * @version $Id$ */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "bitset.h" @@ -92,11 +90,7 @@ static int firm_emit_dbg(lc_appendable_t *app, ir_node *irn = arg->v_ptr; dbg_info *dbg = get_irn_dbg_info(irn); - buf[0] = '\0'; - if (dbg && __dbg_info_snprint) { - if (__dbg_info_snprint(buf, sizeof(buf), dbg) <= 0) - buf[0] = '\0'; - } + ir_dbg_info_snprint(buf, sizeof(buf), dbg); return lc_arg_append(app, occ, buf, strlen(buf)); } @@ -142,10 +136,14 @@ static int firm_emit(lc_appendable_t *app, isupper(occ->conversion) ? get_entity_ld_name_ex(X): get_entity_name(X)); snprintf(add, sizeof(add), "[%ld]", get_entity_nr(X)); break; - case k_type: - snprintf(buf, sizeof(buf), "%s%s:%s", A("type"), get_type_tpop_name(X), get_type_name(X)); + case k_type: { + char type_name[256]; + ir_print_type(type_name, sizeof(type_name), X); + snprintf(buf, sizeof(buf), "%s%s:%s", A("type"), get_type_tpop_name(X), + type_name); snprintf(add, sizeof(add), "[%ld]", get_type_nr(X)); break; + } case k_ir_graph: if (X == get_const_code_irg()) snprintf(buf, sizeof(buf), "%s", A("irg")); @@ -157,8 +155,8 @@ static int firm_emit(lc_appendable_t *app, switch (occ->conversion) { case 'B': block = is_no_Block(X) ? get_nodes_block(X) : X; - snprintf(buf, sizeof(buf), "%s%s%s", A("irn"), get_irn_opname(block), - get_mode_name(get_irn_mode(block))); + snprintf(buf, sizeof(buf), "%s%s %s", A("irn"), + get_irn_opname(block), get_mode_name(get_irn_mode(block))); snprintf(add, sizeof(add), "[%ld]", get_irn_node_nr(block)); break; case 'N': @@ -171,15 +169,21 @@ static int firm_emit(lc_appendable_t *app, tarval_snprintf(tv_buf, sizeof(tv_buf), tv); else strncpy(tv_buf, "(NULL)", sizeof(tv_buf)); - snprintf(buf, sizeof(buf), "%s%s%s<%s>", A("irn"), get_irn_opname(X), + snprintf(buf, sizeof(buf), "%s%s %s<%s>", A("irn"), get_irn_opname(X), get_mode_name(get_irn_mode(X)), tv_buf); - } - else - snprintf(buf, sizeof(buf), "%s%s%s", A("irn"), get_irn_opname(X), + } else if (is_SymConst_addr_ent(X)) { + snprintf(buf, sizeof(buf), "%s%s %s[%s]", A("irn"), get_irn_opname(X), + get_mode_name(get_irn_mode(X)), get_entity_name(get_SymConst_entity(X))); + } else if (is_Sel(X)) { + snprintf(buf, sizeof(buf), "%s%s %s[%s]", A("irn"), get_irn_opname(X), + get_mode_name(get_irn_mode(X)), get_entity_name(get_Sel_entity(X))); + } else { + snprintf(buf, sizeof(buf), "%s%s %s", A("irn"), get_irn_opname(X), get_mode_name(get_irn_mode(X))); - snprintf(add, sizeof(add), "[%ld:%d]", get_irn_node_nr(X), get_irn_idx(X)); } - break; + snprintf(add, sizeof(add), "[%ld:%d]", get_irn_node_nr(X), get_irn_idx(X)); + } + break; case k_ir_mode: snprintf(buf, sizeof(buf), "%s%s", A("mode"), get_mode_name(X)); break; @@ -199,12 +203,12 @@ static int firm_emit(lc_appendable_t *app, for (i = 0; i < n; ++i) { ent = get_compound_graph_path_node(X, i); - strncat(buf, ".", sizeof(buf)); - strncat(buf, get_entity_name(ent), sizeof(buf)); + strncat(buf, ".", sizeof(buf)-1); + strncat(buf, get_entity_name(ent), sizeof(buf)-1); if (is_Array_type(get_entity_owner(ent))) { snprintf(add, sizeof(add), "[%d]", get_compound_graph_path_array_index(X, i)); - strncat(buf, add, sizeof(buf)); + strncat(buf, add, sizeof(buf)-1); } } add[0] = '\0'; @@ -221,7 +225,7 @@ static int firm_emit(lc_appendable_t *app, } if (occ->flag_plus) - strncat(buf, add, sizeof(buf)); + strncat(buf, add, sizeof(buf)-1); return lc_arg_append(app, occ, buf, strlen(buf));