X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fstat%2Fdags.c;h=ff6f17750bc27946580e97b16a0d8894753cc10b;hb=8339a006827f6552b48f7ea6efa257085b90ecb7;hp=c0244ef53a8c6d233b88af965a68f7b509f65f54;hpb=c47eb955f454e1b488a4175d6831c025e0b76293;p=libfirm diff --git a/ir/stat/dags.c b/ir/stat/dags.c index c0244ef53..ff6f17750 100644 --- a/ir/stat/dags.c +++ b/ir/stat/dags.c @@ -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; @@ -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)) @@ -316,25 +315,21 @@ 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; /* 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 */