Simplify control flow.
[libfirm] / ir / stat / dags.c
index 2612fb3..c9e283d 100644 (file)
@@ -21,7 +21,6 @@
  * @file
  * @brief   Statistics for Firm. DAG's in graphs.
  * @author  Michael Beck
- * @version $Id$
  */
 #include "config.h"
 
@@ -31,6 +30,7 @@
 #include "irdump.h"
 #include "dags.h"
 #include "irtools.h"
+#include "ircons.h"
 
 enum dag_counting_options_t {
        FIRMSTAT_COPY_CONSTANTS = 0x00000001,  /**< if set, constants will be treated as they are in
@@ -71,7 +71,7 @@ struct dag_entry_t {
 /**
  * return an DAG entry for the node n
  */
-static dag_entry_t *get_irn_dag_entry(ir_node *n)
+static dag_entry_t *get_irn_dag_entry(const ir_node *n)
 {
        dag_entry_t *p = (dag_entry_t*)get_irn_link(n);
 
@@ -81,7 +81,8 @@ static dag_entry_t *get_irn_dag_entry(ir_node *n)
                        do {
                                p = p->link;
                        } while (p->link != NULL);
-                       set_irn_link(n, p);
+                       /* hacky cast to ir_node* */
+                       set_irn_link((ir_node*)n, p);
                }
        }  /* if */
        return p;
@@ -316,7 +317,7 @@ static unsigned mark_options;
 /**
  * a vcg attribute hook
  */
-static int stat_dag_mark_hook(FILE *F, ir_node *n, ir_node *l)
+static int stat_dag_mark_hook(FILE *F, const ir_node *n, const ir_node *l)
 {
        static const char *colors[] = { "purple", "pink", "lightblue", "orange", "khaki", "orchid", "lilac", "turquoise" };
        dag_entry_t *entry;
@@ -391,7 +392,7 @@ void count_dags_in_graph(graph_entry_t *global, graph_entry_t *graph)
                        entry->num_roots,
                        entry->num_nodes,
                        entry->num_inner_nodes,
-                       entry->is_tree,
+                       (unsigned)entry->is_tree,
                        get_irn_node_nr(entry->root));
        }  /* for */