X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbedump.c;h=fe973708866bc34ffd7124db84b695313a2e628a;hb=5474a1c188c9d59eea2c915515980cd9cbab58d8;hp=5e478c5690b30dc5a80001e3ba0ff0b476df48dd;hpb=979e11a67115604f5ca3050ad2fab08d190a13e8;p=libfirm diff --git a/ir/be/bedump.c b/ir/be/bedump.c index 5e478c569..fe9737088 100644 --- a/ir/be/bedump.c +++ b/ir/be/bedump.c @@ -27,8 +27,10 @@ #include "bedump.h" #include "irdump_t.h" +#include "irgwalk.h" #include "beifg.h" #include "becopyopt_t.h" +#include "belive_t.h" static void dump_ifg_nodes(FILE *F, const be_ifg_t *ifg) { @@ -54,11 +56,11 @@ static void dump_ifg_edges(FILE *F, const be_ifg_t *ifg) if (get_irn_node_nr(node) >= get_irn_node_nr(neighbour)) continue; - fprintf(F, "edge: {sourcename: \""); - PRINT_NODEID(node); - fprintf(F, "\" targetname: \""); - PRINT_NODEID(neighbour); - fprintf(F, "\" arrowstyle:none class:1}\n"); + fprintf(F, "edge: {sourcename: "); + print_nodeid(F, node); + fprintf(F, " targetname: "); + print_nodeid(F, neighbour); + fprintf(F, " arrowstyle:none class:1}\n"); } } } @@ -91,11 +93,11 @@ static void dump_affinity_edges(FILE *F, const copy_opt_t *co, if (get_irn_node_nr(a->irn) >= get_irn_node_nr(n->irn)) continue; - fprintf(F, "edge: {sourcename: \""); - PRINT_NODEID(a->irn); - fprintf(F, "\" targetname: \""); - PRINT_NODEID(n->irn); - fprintf(F, "\" arrowstyle:none"); + fprintf(F, "edge: {sourcename: "); + print_nodeid(F, a->irn); + fprintf(F, " targetname: "); + print_nodeid(F, n->irn); + fprintf(F, " arrowstyle:none"); if (dump_costs) fprintf(F, " label:\"%d\"", n->costs); @@ -132,3 +134,60 @@ void be_dump_ifg_co(FILE *F, const copy_opt_t *co, bool dump_costs, fprintf(F, "}\n"); } + +static const char *lv_flags_to_str(unsigned flags) +{ + static const char *states[] = { + "---", + "i--", + "-e-", + "ie-", + "--o", + "i-o", + "-eo", + "ieo" + }; + + return states[flags & 7]; +} + +void be_dump_liveness_block(void *context, FILE *F, const ir_node *bl) +{ + if (is_Block(bl)) { + be_lv_t *lv = (be_lv_t*)context; + be_lv_info_t *info = (be_lv_info_t*)ir_nodehashmap_get(&lv->map, bl); + + fprintf(F, "liveness:\n"); + if (info != NULL) { + unsigned n = info[0].head.n_members; + unsigned i; + + for (i = 0; i < n; ++i) { + be_lv_info_node_t *n = &info[i+1].node; + ir_fprintf(F, "%s %+F\n", lv_flags_to_str(n->flags), get_idx_irn(lv->irg, n->idx)); + } + } + } +} + +typedef struct lv_walker_t { + be_lv_t *lv; + void *data; +} lv_walker_t; + +static void lv_dump_block_walker(ir_node *irn, void *data) +{ + lv_walker_t *w = (lv_walker_t*)data; + if (!is_Block(irn)) + return; + be_dump_liveness_block(w->lv, (FILE*)w->data, irn); +} + +void be_liveness_dump(FILE *F, const be_lv_t *lv) +{ + lv_walker_t w; + + w.lv = (be_lv_t *) lv; + w.data = F; + irg_block_walk_graph(lv->irg, lv_dump_block_walker, NULL, &w); +}