cleanup, simplify hungarian algorithm implementation
[libfirm] / ir / stat / dags.c
index d52a702..debb813 100644 (file)
@@ -23,9 +23,7 @@
  * @author  Michael Beck
  * @version $Id$
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
 #include <assert.h>
 
@@ -110,8 +108,9 @@ static int is_arg(ir_node *node)
 /**
  * Allocate a new DAG entry.
  */
-static dag_entry_t *new_dag_entry(dag_env_t *dag_env, ir_node *node) {
-       dag_entry_t *entry = obstack_alloc(&dag_env->obst, sizeof(*entry));
+static dag_entry_t *new_dag_entry(dag_env_t *dag_env, ir_node *node)
+{
+       dag_entry_t *entry = OALLOC(&dag_env->obst, dag_entry_t);
 
        entry->num_nodes       = 1;
        entry->num_roots       = 1;
@@ -380,7 +379,7 @@ void count_dags_in_graph(graph_entry_t *global, graph_entry_t *graph)
        /* connect and count them */
        irg_walk_graph(graph->irg, connect_dags, NULL, &root_env);
 
-       printf("Graph %p %s --- %d\n", (void *)graph->irg, get_entity_name(get_irg_entity(graph->irg)),
+       printf("Graph %p %s --- %u\n", (void *)graph->irg, get_entity_name(get_irg_entity(graph->irg)),
                root_env.num_of_dags);
 
        for (id = 0, entry = root_env.list_of_dags; entry; entry = entry->next) {
@@ -388,7 +387,7 @@ void count_dags_in_graph(graph_entry_t *global, graph_entry_t *graph)
                        continue;
                entry->id = id++;
 
-               printf("number of roots %d number of nodes %d inner %d tree %u %ld\n",
+               printf("number of roots %u number of nodes %u inner %u tree %u %ld\n",
                        entry->num_roots,
                        entry->num_nodes,
                        entry->num_inner_nodes,
@@ -400,7 +399,7 @@ void count_dags_in_graph(graph_entry_t *global, graph_entry_t *graph)
        /* dump for test */
        mark_options = root_env.options;
        set_dump_node_vcgattr_hook(stat_dag_mark_hook);
-       dump_ir_block_graph(graph->irg, "-dag");
+       dump_ir_graph(graph->irg, "-dag");
        set_dump_node_vcgattr_hook(NULL);
 #endif