Commit 94317f78 authored by Michael Beck's avatar Michael Beck
Browse files

Added statistic code for reassociation

[r4309]
parent 5aed52c8
......@@ -41,6 +41,7 @@ static const char *opt_names[] = {
"Common subexpression elimination",
"Strength reduction",
"Architecture dependant optimization",
"Reassociation optimization",
"Lowered",
};
......@@ -417,7 +418,8 @@ static void count_call(ir_node *call, graph_entry_t *graph)
}
}
/* check, if it's a chain-call */
/* check, if it's a chain-call: Then, the call-block
* must dominate the end block. */
{
ir_node *curr = get_irg_end_block(graph->irg);
ir_node *block = get_nodes_block(call);
......@@ -476,9 +478,10 @@ static void count_nodes_in_graph(graph_entry_t *global, graph_entry_t *graph)
graph->is_recursive = 0;
graph->is_chain_call = 1;
/* we need dominance info */
/* we need dominator info */
if (graph->irg != get_const_code_irg())
compute_doms(graph->irg);
if (get_irg_dom_state(graph->irg) != dom_consistent)
compute_doms(graph->irg);
/* count the nodes in the graph */
irg_walk_graph(graph->irg, count_nodes, NULL, graph);
......@@ -1096,6 +1099,9 @@ void stat_merge_nodes(
int i, j;
graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
if (status->reassoc_run)
opt = STAT_OPT_REASSOC;
for (i = 0; i < old_num_entries; ++i) {
for (j = 0; j < new_num_entries; ++j)
if (old_node_array[i] == new_node_array[j])
......@@ -1110,6 +1116,21 @@ void stat_merge_nodes(
STAT_LEAVE;
}
/*
* reassociation started/stopped.
*/
void stat_reassociate(int flag)
{
if (! status->enable)
return;
STAT_ENTER;
{
status->reassoc_run = flag;
}
STAT_LEAVE;
}
/*
* A node was lowered into other nodes
*/
......@@ -1358,6 +1379,8 @@ void stat_merge_nodes(
ir_node **old_node_array, int old_num_entries,
stat_opt_kind opt) {}
void stat_reassociate(int start) {}
void stat_lower(ir_node *node) {}
void stat_inline(ir_node *call, ir_graph *irg) {}
......
......@@ -52,6 +52,7 @@ typedef enum {
STAT_OPT_CSE, /**< common subexpression elimination */
STAT_OPT_STRENGTH_RED, /**< strenght reduction */
STAT_OPT_ARCH_DEP, /**< architecture dependant optimization */
STAT_OPT_REASSOC, /**< reassociation */
STAT_LOWERED, /**< lowered */
STAT_OPT_MAX
......@@ -117,6 +118,11 @@ void stat_merge_nodes(
ir_node **old_node_array, int old_num_entries,
stat_opt_kind opt);
/**
* Reassociation of nodes started/stopped.
*/
void stat_reassociate(int start);
/**
* A node was lowered into other nodes
*/
......@@ -190,6 +196,7 @@ ir_op *stat_get_op_from_opcode(opcode code);
#define stat_irg_walk_blkwise(irg, pre, post)
#define stat_irg_block_walk(irg, node, pre, post)
#define stat_merge_nodes(new_node_array, new_num_entries, old_node_array, old_num_entries, opt)
#define stat_reassociate(start)
#define stat_lower(node)
#define stat_inline(call, irg)
#define stat_tail_rec(irg)
......
......@@ -142,6 +142,7 @@ typedef struct _statistic_info_t {
ir_op *op_ModC; /**< pseudo op for modulo by const */
ir_op *op_DivModC; /**< pseudo op for DivMod by const */
dumper_t *dumper; /**< list of dumper */
int reassoc_run; /**< if set, reassociation is running */
int enable; /**< if set, statistic is enabled */
} stat_info_t;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment