/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
- *
* This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
*/
/**
static void dump_ifg_nodes(FILE *F, const be_ifg_t *ifg)
{
- nodes_iter_t ifg_iter;
- ir_node *node;
- be_ifg_foreach_node(ifg, &ifg_iter, node) {
+ be_ifg_foreach_node(ifg, node) {
dump_node(F, node);
}
}
static void dump_ifg_edges(FILE *F, const be_ifg_t *ifg)
{
- nodes_iter_t ifg_iter;
- ir_node *node;
-
- be_ifg_foreach_node(ifg, &ifg_iter, node) {
+ be_ifg_foreach_node(ifg, node) {
neighbours_iter_t neigh_iter;
- ir_node *neighbour;
be_ifg_foreach_neighbour(ifg, &neigh_iter, node, neighbour) {
/* interference is bidirectional, but it's enough to dump 1
static void dump_affinity_edges(FILE *F, const copy_opt_t *co,
bool dump_costs, bool dump_colors)
{
- affinity_node_t *a;
co_gs_foreach_aff_node(co, a) {
- neighb_t *n;
-
co_gs_foreach_neighb(a, n) {
/* edges are bidirection, dumping one direction is enough */
if (get_irn_node_nr(a->irn) >= get_irn_node_nr(n->irn))
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 = (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));
- }
+ 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)
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);
}