+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ int i, j;
+ graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
+
+ cnt_inc(&status->num_opts[opt]);
+ if (status->reassoc_run)
+ opt = HOOK_OPT_REASSOC;
+
+ for (i = 0; i < old_num_entries; ++i) {
+ /* nodes might be in new and old, so if we found a node
+ in both sets, this one is NOT removed */
+ for (j = 0; j < new_num_entries; ++j) {
+ if (old_node_array[i] == new_node_array[j])
+ break;
+ } /* for */
+ if (j >= new_num_entries) {
+ int xopt = opt;
+
+ /* sometimes we did not detect, that it is replaced by a Const */
+ if (opt == HOOK_OPT_CONFIRM && new_num_entries == 1) {
+ ir_op *op = get_irn_op(new_node_array[0]);
+
+ if (op == op_Const || op == op_SymConst)
+ xopt = HOOK_OPT_CONFIRM_C;
+ } /* if */
+
+ removed_due_opt(old_node_array[i], graph->opt_hash[xopt], xopt);
+ } /* if */
+ } /* for */
+ }
+ STAT_LEAVE;
+} /* stat_merge_nodes */
+
+/**
+ * Hook: Reassociation is started/stopped.
+ *
+ * @param ctx the hook context
+ * @param flag if non-zero, reassociation is started else stopped
+ */
+static void stat_reassociate(void *ctx, int flag) {
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ status->reassoc_run = flag;
+ }
+ STAT_LEAVE;
+} /* stat_reassociate */
+
+/**
+ * Hook: A node was lowered into other nodes
+ *
+ * @param ctx the hook context
+ * @param node the IR node that will be lowered
+ */
+static void stat_lower(void *ctx, ir_node *node) {
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
+
+ removed_due_opt(node, graph->opt_hash[HOOK_LOWERED], HOOK_LOWERED);
+ }
+ STAT_LEAVE;
+} /* stat_lower */
+
+/**
+ * Hook: A graph was inlined.
+ *
+ * @param ctx the hook context
+ * @param call the IR call that will re changed into the body of
+ * the called IR graph
+ * @param called_irg the IR graph representing the called routine
+ */
+static void stat_inline(void *ctx, ir_node *call, ir_graph *called_irg)
+{
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ ir_graph *irg = get_irn_irg(call);
+ graph_entry_t *i_graph = graph_get_entry(called_irg, status->irg_hash);
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt[gcnt_acc_got_inlined]);
+ cnt_inc(&i_graph->cnt[gcnt_acc_was_inlined]);
+ }
+ STAT_LEAVE;
+} /* stat_inline */
+
+/**
+ * Hook: A graph with tail-recursions was optimized.
+ *
+ * @param ctx the hook context
+ */
+static void stat_tail_rec(void *ctx, ir_graph *irg, int n_calls) {
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ graph->num_tail_recursion += n_calls;
+ }
+ STAT_LEAVE;
+} /* stat_tail_rec */
+
+/**
+ * Strength reduction was performed on an iteration variable.
+ *
+ * @param ctx the hook context
+ */
+static void stat_strength_red(void *ctx, ir_graph *irg, ir_node *strong) {
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+ cnt_inc(&graph->cnt[gcnt_acc_strength_red]);
+
+ removed_due_opt(strong, graph->opt_hash[HOOK_OPT_STRENGTH_RED], HOOK_OPT_STRENGTH_RED);
+ }
+ STAT_LEAVE;
+} /* stat_strength_red */
+
+/**
+ * Hook: Start/Stop the dead node elimination.
+ *
+ * @param ctx the hook context
+ */
+static void stat_dead_node_elim(void *ctx, ir_graph *irg, int start) {
+ (void) ctx;
+ (void) irg;
+ if (! status->stat_options)
+ return;
+
+ status->in_dead_node_elim = (start != 0);
+} /* stat_dead_node_elim */
+
+/**
+ * Hook: if-conversion was tried.
+ */
+static void stat_if_conversion(void *context, ir_graph *irg, ir_node *phi,
+ int pos, ir_node *mux, if_result_t reason)
+{
+ (void) context;
+ (void) phi;
+ (void) pos;
+ (void) mux;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt[gcnt_if_conv + reason]);
+ }
+ STAT_LEAVE;
+} /* stat_if_conversion */
+
+/**
+ * Hook: real function call was optimized.
+ */
+static void stat_func_call(void *context, ir_graph *irg, ir_node *call)
+{
+ (void) context;
+ (void) call;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt[gcnt_acc_real_func_call]);
+ }
+ STAT_LEAVE;
+} /* stat_func_call */
+
+/**
+ * Hook: A multiply was replaced by a series of Shifts/Adds/Subs.
+ *
+ * @param ctx the hook context
+ */
+static void stat_arch_dep_replace_mul_with_shifts(void *ctx, ir_node *mul) {
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
+ removed_due_opt(mul, graph->opt_hash[HOOK_OPT_ARCH_DEP], HOOK_OPT_ARCH_DEP);
+ }
+ STAT_LEAVE;
+} /* stat_arch_dep_replace_mul_with_shifts */
+
+/**
+ * Hook: A division by const was replaced.
+ *
+ * @param ctx the hook context
+ * @param node the division node that will be optimized
+ */
+static void stat_arch_dep_replace_division_by_const(void *ctx, ir_node *node) {
+ (void) ctx;
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
+ removed_due_opt(node, graph->opt_hash[HOOK_OPT_ARCH_DEP], HOOK_OPT_ARCH_DEP);
+ }
+ STAT_LEAVE;
+} /* stat_arch_dep_replace_division_by_const */