+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * A new node is created.
+ *
+ * @param ctx the hook context
+ * @param irg the IR graph on which the node is created
+ * @param node the new IR node that was created
+ */
+static void stat_new_node(void *ctx, ir_graph *irg, ir_node *node)
+{
+ if (! status->stat_options)
+ return;
+
+ /* do NOT count during dead node elimination */
+ if (status->in_dead_node_elim > 0)
+ return;
+
+ STAT_ENTER;
+ {
+ node_entry_t *entry;
+ graph_entry_t *graph;
+ ir_op *op = stat_get_irn_op(node);
+
+ /* increase global value */
+ graph = graph_get_entry(NULL, status->irg_hash);
+ entry = opcode_get_entry(op, graph->opcode_hash);
+ cnt_inc(&entry->new_node);
+
+ /* increase local value */
+ graph = graph_get_entry(current_ir_graph, status->irg_hash);
+ entry = opcode_get_entry(op, graph->opcode_hash);
+ cnt_inc(&entry->new_node);
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * A node is changed into a Id node
+ *
+ * @param ctx the hook context
+ * @param node the IR node that will be turned into an ID
+ */
+static void stat_turn_into_id(void *ctx, ir_node *node)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ node_entry_t *entry;
+ graph_entry_t *graph;
+ ir_op *op = stat_get_irn_op(node);
+
+ /* increase global value */
+ graph = graph_get_entry(NULL, status->irg_hash);
+ entry = opcode_get_entry(op, graph->opcode_hash);
+ cnt_inc(&entry->into_Id);
+
+ /* increase local value */
+ graph = graph_get_entry(current_ir_graph, status->irg_hash);
+ entry = opcode_get_entry(op, graph->opcode_hash);
+ cnt_inc(&entry->into_Id);
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * A new graph was created
+ *
+ * @param ctx the hook context
+ * @param irg the new IR graph that was created
+ * @param ent the entity of this graph
+ */
+static void stat_new_graph(void *ctx, ir_graph *irg, entity *ent)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ /* execute for side effect :-) */
+ graph_entry_t * graph = graph_get_entry(irg, status->irg_hash);
+
+ graph->ent = ent;
+ graph->is_deleted = 0;
+ graph->is_leaf = 0;
+ graph->is_leaf_call = 0;
+ graph->is_recursive = 0;
+ graph->is_chain_call = 0;
+ graph->is_analyzed = 0;
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * A graph will be deleted
+ *
+ * @param ctx the hook context
+ * @param irg the IR graph that will be deleted
+ *
+ * Note that we still hold the information for this graph
+ * in our hash maps, only a flag is set which prevents this
+ * information from being changed, it's "frozen" from now.
+ */
+static void stat_free_graph(void *ctx, ir_graph *irg)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+ graph_entry_t *global = graph_get_entry(NULL, status->irg_hash);
+
+ graph->is_deleted = 1;
+
+ if (status->stat_options & FIRMSTAT_COUNT_DELETED) {
+ /* count the nodes of the graph yet, it will be destroyed later */
+ update_graph_stat(global, graph);
+ }
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * A walk over a graph is initiated. Do not count walks from statistic code.
+ *
+ * @param ctx the hook context
+ * @param irg the IR graph that will be walked
+ * @param pre the pre walker
+ * @param post the post walker
+ */
+static void stat_irg_walk(void *ctx, ir_graph *irg, generic_func *pre, generic_func *post)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER_SINGLE;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt_walked);
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * A walk over a graph in block-wise order is initiated. Do not count walks from statistic code.
+ *
+ * @param ctx the hook context
+ * @param irg the IR graph that will be walked
+ * @param pre the pre walker
+ * @param post the post walker
+ */
+static void stat_irg_walk_blkwise(void *ctx, ir_graph *irg, generic_func *pre, generic_func *post)
+{
+ /* for now, do NOT differentiate between blockwise and normal */
+ stat_irg_walk(ctx, irg, pre, post);
+}
+
+/**
+ * A walk over the graph's blocks is initiated. Do not count walks from statistic code.
+ *
+ * @param ctx the hook context
+ * @param irg the IR graph that will be walked
+ * @param node the IR node
+ * @param pre the pre walker
+ * @param post the post walker
+ */
+static void stat_irg_block_walk(void *ctx, ir_graph *irg, ir_node *node, generic_func *pre, generic_func *post)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER_SINGLE;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt_walked_blocks);
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * called for every node that is removed due to an optimization.
+ *
+ * @param n the IR node that will be removed
+ * @param hmap the hash map containing ir_op* -> opt_entry_t*
+ */
+static void removed_due_opt(ir_node *n, hmap_opt_entry_t *hmap)
+{
+ ir_op *op = stat_get_irn_op(n);
+ opt_entry_t *entry = opt_get_entry(op, hmap);