summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bedump.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2012-11-27 14:53:54 +0100
committerMatthias Braun <matze@braunis.de>2012-11-28 11:27:12 +0100
commit555593b0aebec433b871920acc2b0a869b072055 (patch)
tree1caa6fac4f8b6bfdbd14b7445965fc7f780fcea1 /ir/be/bedump.c
parentd1b0f2c0884f29cea4c5b260a6d1f8e865e3f7cf (diff)
rework liveness dumper
- some code cleanup - avoids the case where 2 dumpers are registered
Diffstat (limited to 'ir/be/bedump.c')
-rw-r--r--ir/be/bedump.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/ir/be/bedump.c b/ir/be/bedump.c
index 486ca8a..9c216ed 100644
--- a/ir/be/bedump.c
+++ b/ir/be/bedump.c
@@ -148,28 +148,25 @@ static const char *lv_flags_to_str(unsigned flags)
return states[flags & 7];
}
-void be_dump_liveness_block(void *context, FILE *F, const ir_node *bl)
+void be_dump_liveness_block(be_lv_t *lv, FILE *F, const ir_node *bl)
{
- if (is_Block(bl)) {
- be_lv_t *lv = (be_lv_t*)context;
- be_lv_info_t *info = ir_nodehashmap_get(be_lv_info_t, &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), n->node);
- }
+ be_lv_info_t *info = ir_nodehashmap_get(be_lv_info_t, &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), n->node);
}
}
}
typedef struct lv_walker_t {
be_lv_t *lv;
- void *data;
+ FILE *out;
} lv_walker_t;
static void lv_dump_block_walker(ir_node *irn, void *data)
@@ -177,14 +174,14 @@ 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);
+ be_dump_liveness_block(w->lv, w->out, 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;
+ w.lv = (be_lv_t *) lv;
+ w.out = F;
irg_block_walk_graph(lv->irg, lv_dump_block_walker, NULL, &w);
}