belive: Remove duplicate assert()s.
[libfirm] / ir / stat / dags.c
index d27013d..ff6f177 100644 (file)
@@ -30,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
@@ -145,10 +146,9 @@ static void find_dag_roots(ir_node *node, void *env)
        block = get_nodes_block(node);
 
        /* ignore start end end blocks */
-       if (block == get_irg_start_block(current_ir_graph) ||
-               block == get_irg_end_block(current_ir_graph)) {
+       ir_graph *const irg = get_Block_irg(block);
+       if (block == get_irg_start_block(irg) || block == get_irg_end_block(irg))
                return;
-       }  /* if */
 
        /* Phi nodes always references nodes from "other" block */
        if (is_Phi(node)) {
@@ -221,10 +221,9 @@ static void connect_dags(ir_node *node, void *env)
        block = get_nodes_block(node);
 
        /* ignore start end end blocks */
-       if (block == get_irg_start_block(current_ir_graph) ||
-               block == get_irg_end_block(current_ir_graph)) {
+       ir_graph *const irg = get_Block_irg(block);
+       if (block == get_irg_start_block(irg) || block == get_irg_end_block(irg))
                return;
-       }  /* if */
 
        /* ignore Phi nodes */
        if (is_Phi(node))
@@ -323,18 +322,14 @@ static int stat_dag_mark_hook(FILE *F, const ir_node *n, const ir_node *l)
 
        /* do not count Bad / NoMem */
        if (l) {
-               ir_op *op = get_irn_op(l);
-
-               if (op == op_NoMem || op == op_Bad)
+               if (is_NoMem(l) || is_Bad(l))
                        return DEFAULT_RET;
 
                /* check for additional options */
-               op = get_irn_op(n);
-
-               if (mark_options & FIRMSTAT_LOAD_IS_LEAVE && op == op_Load)
+               if (mark_options & FIRMSTAT_LOAD_IS_LEAVE && is_Load(n))
                        return DEFAULT_RET;
 
-               if (mark_options & FIRMSTAT_CALL_IS_LEAVE && op == op_Call)
+               if (mark_options & FIRMSTAT_CALL_IS_LEAVE && is_Call(n))
                        return DEFAULT_RET;
        }  /* if */