/** The memory Proj node. */
static ir_op _op_ProjM;
+/** A Sel of a Sel */
+static ir_op _op_SelSel;
+
+/** A Sel of a Sel of a Sel */
+static ir_op _op_SelSelSel;
+
/* ---------------------------------------------------------------------------------- */
/** Marks the begin of a statistic (hook) function. */
return elem;
elem = obstack_alloc(&status->cnts, sizeof(*elem));
+ memset(elem, 0, sizeof(*elem));
/* clear counter */
opcode_clear_entry(elem);
cnt_clr(&elem->cnt_was_inlined);
cnt_clr(&elem->cnt_got_inlined);
cnt_clr(&elem->cnt_strength_red);
+ cnt_clr(&elem->cnt_real_func_call);
}
cnt_clr(&elem->cnt_edges);
cnt_clr(&elem->cnt_all_calls);
/* allocate a new one */
elem = obstack_alloc(&status->cnts, sizeof(*elem));
+ memset(elem, 0, sizeof(*elem));
/* clear counter */
graph_clear_entry(elem, 1);
return elem;
elem = obstack_alloc(&status->cnts, sizeof(*elem));
+ memset(elem, 0, sizeof(*elem));
/* clear new counter */
opt_clear_entry(elem);
cnt_clr(&elem->cnt_edges);
cnt_clr(&elem->cnt_in_edges);
cnt_clr(&elem->cnt_out_edges);
+ cnt_clr(&elem->cnt_phi_data);
}
/**
return elem;
elem = obstack_alloc(&status->cnts, sizeof(*elem));
+ memset(elem, 0, sizeof(*elem));
/* clear new counter */
block_clear_entry(elem);
/* special case, a division/modulo by a const, count on extra counter */
op = status->op_DivModC ? status->op_DivModC : op;
}
+ else if (op == op_Sel && get_irn_op(get_Sel_ptr(node)) == op_Sel) {
+ /* special case, a Sel of a Sel, count on extra counter */
+ op = status->op_SelSel ? status->op_SelSel : op;
+
+ if (get_irn_op(get_Sel_ptr(get_Sel_ptr(node))) == op_Sel) {
+ /* special case, a Sel of a Sel of a Sel, count on extra counter */
+ op = status->op_SelSelSel ? status->op_SelSelSel : op;
+ }
+ }
return op;
}
}
return;
}
+ else if (op == op_Phi && mode_is_datab(get_irn_mode(node))) {
+ /* count data Phi */
+ ir_node *block = get_nodes_block(node);
+ block_entry_t *b_entry = block_get_entry(get_irn_node_nr(block), graph->block_hash);
+
+ cnt_inc(&b_entry->cnt_phi_data);
+ }
block = get_nodes_block(node);
b_entry = block_get_entry(get_irn_node_nr(block), graph->block_hash);
*
* @param ctx the hook context
*/
-static void stat_tail_rec(void *ctx, ir_graph *irg)
+static void stat_tail_rec(void *ctx, ir_graph *irg, int n_calls)
{
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;
}
--status->in_dead_node_elim;
}
+/**
+ * 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)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt_if_conv[reason]);
+ }
+ STAT_LEAVE;
+}
+
+/**
+ * real function call was optimized
+ */
+static void stat_func_call(void *context, ir_graph *irg, ir_node *call)
+{
+ if (! status->stat_options)
+ return;
+
+ STAT_ENTER;
+ {
+ graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
+
+ cnt_inc(&graph->cnt_real_func_call);
+ }
+ STAT_LEAVE;
+}
+
/**
* A multiply was replaced by a series of Shifts/Adds/Subs
*
HOOK(hook_strength_red, stat_strength_red);
HOOK(hook_dead_node_elim_start, stat_dead_node_elim_start);
HOOK(hook_dead_node_elim_stop, stat_dead_node_elim_stop);
+ HOOK(hook_if_conversion, stat_if_conversion);
+ HOOK(hook_func_call, stat_func_call);
HOOK(hook_arch_dep_replace_mul_with_shifts, stat_arch_dep_replace_mul_with_shifts);
HOOK(hook_arch_dep_replace_div_by_const, stat_arch_dep_replace_div_by_const);
HOOK(hook_arch_dep_replace_mod_by_const, stat_arch_dep_replace_mod_by_const);
status->op_DivModC = NULL;
}
+ if (enable_options & FIRMSTAT_COUNT_SELS) {
+ _op_SelSel.code = get_next_ir_opcode();
+ _op_SelSel.name = new_id_from_chars(X("Sel(Sel)"));
+
+ _op_SelSelSel.code = get_next_ir_opcode();
+ _op_SelSelSel.name = new_id_from_chars(X("Sel(Sel(Sel))"));
+
+ status->op_SelSel = &_op_SelSel;
+ status->op_SelSelSel = &_op_SelSelSel;
+ }
+ else {
+ status->op_SelSel = NULL;
+ status->op_SelSelSel = NULL;
+ }
+
/* register the dumper */
stat_register_dumper(&simple_dumper);