Better fix for wrong tarval computation of -(infinity).
[libfirm] / ir / kaps / html_dumper.c
index f29a88d..a6cfc91 100644 (file)
@@ -53,9 +53,9 @@ static const char *cost2a(num const cost)
 static void dump_vector(FILE *f, vector_t *vec)
 {
        unsigned index;
+       unsigned len = vec->len;
 
        fprintf(f, "<span class=\"vector\">( ");
-       unsigned len = vec->len;
        assert(len > 0);
        for (index = 0; index < len; ++index) {
 #if KAPS_ENABLE_VECTOR_NAMES
@@ -90,7 +90,7 @@ static void dump_matrix(FILE *f, pbqp_matrix_t *mat)
 void dump_edge(FILE *file, pbqp_edge_t *edge)
 {
        fputs("<tex>\n", file);
-       fprintf(file, "\t\\overline\n{C}_{%d,%d}=\n",
+       fprintf(file, "\t\\overline\n{C}_{%u,%u}=\n",
                        edge->src->index, edge->tgt->index);
        dump_matrix(file, edge->costs);
        fputs("</tex><br>", file);
@@ -103,12 +103,13 @@ static void dump_edge_costs(pbqp_t *pbqp)
        fputs("<p>", pbqp->dump_file);
        for (src_index = 0; src_index < pbqp->num_nodes; ++src_index) {
                pbqp_node_t *src_node = get_node(pbqp, src_index);
+               size_t edge_index;
+               size_t len;
 
                if (!src_node)
                        continue;
 
-               unsigned edge_index;
-               unsigned len = ARR_LEN(src_node->edges);
+               len = ARR_LEN(src_node->edges);
                for (edge_index = 0; edge_index < len; ++edge_index) {
                        pbqp_edge_t *edge      = src_node->edges[edge_index];
                        unsigned     tgt_index = edge->tgt->index;
@@ -123,7 +124,7 @@ static void dump_edge_costs(pbqp_t *pbqp)
 void dump_node(FILE *file, pbqp_node_t *node)
 {
        if (node) {
-               fprintf(file, "\tc<sub>%d</sub> = ", node->index);
+               fprintf(file, "\tc<sub>%u</sub> = ", node->index);
                dump_vector(file, node->costs);
                fputs("<br>\n", file);
        }
@@ -154,12 +155,14 @@ void pbqp_dump_graph(pbqp_t *pbqp)
        for (src_index = 0; src_index < pbqp->num_nodes; ++src_index) {
                pbqp_node_t *node = get_node(pbqp, src_index);
                if (node && !node_is_reduced(node)) {
-                       fprintf(pbqp->dump_file, "\t n%d;\n", src_index);
+                       fprintf(pbqp->dump_file, "\t n%u;\n", src_index);
                }
        }
 
        for (src_index = 0; src_index < pbqp->num_nodes; ++src_index) {
                pbqp_node_t *node = get_node(pbqp, src_index);
+               unsigned len;
+               unsigned edge_index;
 
                if (!node)
                        continue;
@@ -167,8 +170,7 @@ void pbqp_dump_graph(pbqp_t *pbqp)
                if (node_is_reduced(node))
                        continue;
 
-               unsigned len = ARR_LEN(node->edges);
-               unsigned edge_index;
+               len = ARR_LEN(node->edges);
                for (edge_index = 0; edge_index < len; ++edge_index) {
                        pbqp_node_t *tgt_node  = node->edges[edge_index]->tgt;
                        unsigned     tgt_index = tgt_node->index;
@@ -177,7 +179,7 @@ void pbqp_dump_graph(pbqp_t *pbqp)
                                continue;
 
                        if (src_index < tgt_index) {
-                               fprintf(pbqp->dump_file, "\t n%d -- n%d;\n", src_index,
+                               fprintf(pbqp->dump_file, "\t n%u -- n%u;\n", src_index,
                                                tgt_index);
                        }
                }