Commit c9c1c66d authored by Matthias Braun's avatar Matthias Braun
Browse files

irhooks: Remove some unused hooks

parent 6a3bc1a0
......@@ -254,8 +254,6 @@ static void fix_loops(ir_node *node)
*/
static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
{
hook_dead_node_elim(irg, 1);
inc_irg_visited(irg);
env.worklist = new_pdeq();
......@@ -289,7 +287,6 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
del_pdeq(env.worklist);
free_End(old_end);
hook_dead_node_elim(irg, 0);
}
void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func)
......
......@@ -560,7 +560,6 @@ ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn)
if (tv != NULL) {
res = do_decomposition(irn, operand, tv);
if (res != irn) {
hook_arch_dep_replace_mul_with_shifts(irn);
exchange(irn, res);
}
}
......@@ -972,9 +971,6 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn)
res = left;
}
if (res != irn)
hook_arch_dep_replace_division_by_const(irn);
return res;
}
......@@ -1056,8 +1052,5 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
res = new_rd_Sub(dbg, block, left, res, mode);
}
if (res != irn)
hook_arch_dep_replace_division_by_const(irn);
return res;
}
......@@ -65,8 +65,6 @@ void exchange(ir_node *old, ir_node *nw)
set_irn_op(old, op_Deleted);
} else {
/* Else, do it the old-fashioned way. */
hook_turn_into_id(old);
ir_node *block = old->in[0];
if (block == NULL) {
block = get_block(nw);
......
......@@ -129,7 +129,6 @@ void irg_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
void irg_walk_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post,
void *env)
{
hook_irg_walk(irg, (generic_func*)pre, (generic_func*)post);
irg_walk(get_irg_end(irg), pre, post, env);
}
......@@ -243,7 +242,6 @@ void irg_walk_in_or_dep(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
void irg_walk_in_or_dep_graph(ir_graph *irg, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
hook_irg_walk(irg, (generic_func *)pre, (generic_func *)post);
irg_walk_in_or_dep(get_irg_end(irg), pre, post, env);
}
......@@ -287,8 +285,6 @@ void irg_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
ir_graph *const irg = get_irn_irg(node);
ir_node *const block = get_block(node);
hook_irg_block_walk(irg, node, (generic_func *)pre, (generic_func *)post);
ir_reserve_resources(irg, IR_RESOURCE_BLOCK_VISITED);
inc_irg_block_visited(irg);
irg_block_walk_2(block, pre, post, env);
......
......@@ -402,13 +402,11 @@ static void do_irg_walk_blk(ir_graph *irg, irg_walk_func *pre,
void irg_walk_blkwise_graph(ir_graph *irg, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
hook_irg_walk_blkwise(irg, (generic_func*)pre, (generic_func*)post);
do_irg_walk_blk(irg, pre, post, env, traverse_blocks);
}
void irg_walk_blkwise_dom_top_down(ir_graph *irg, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
hook_irg_walk_blkwise(irg, (generic_func*)pre, (generic_func*)post);
do_irg_walk_blk(irg, pre, post, env, traverse_dom_blocks_top_down);
}
......@@ -17,7 +17,7 @@ hook_entry_t *hooks[hook_last];
void register_hook(hook_type_t hook, hook_entry_t *entry)
{
/* check if a hook function is specified. It's a union, so no matter which one */
if (!entry->hook._hook_turn_into_id)
if (!entry->hook._hook_node_info)
return;
/* hook should not be registered yet */
......
......@@ -31,12 +31,6 @@ struct hook_entry {
/** This hook is called, before a node is replaced (exchange()) by another. */
void (*_hook_replace)(void *context, ir_node *old_node, ir_node *new_node);
/** This hook is called, before a node is changed into an Id node. */
void (*_hook_turn_into_id)(void *context, ir_node *node);
/** This hook is called, after a commutative node was normalized. */
void (*_hook_normalize)(void *context, ir_node *node);
/** This hook is called, after a new graph was created and before the first block
* on this graph is built. */
void (*_hook_new_graph)(void *context, ir_graph *irg, ir_entity *ent);
......@@ -44,42 +38,9 @@ struct hook_entry {
/** This hook is called before a graph is freed. */
void (*_hook_free_graph)(void *context, ir_graph *irg);
/** This hook is called before an irg walk is started. */
void (*_hook_irg_walk)(void *context, ir_graph *irg, generic_func *pre, generic_func *post);
/** This hook is called before an block wise irg walk is started. */
void (*_hook_irg_walk_blkwise)(void *context, ir_graph *irg, generic_func *pre, generic_func *post);
/** This hook is called before an block walk is started. */
void (*_hook_irg_block_walk)(void *context, ir_graph *irg, ir_node *node, generic_func *pre, generic_func *post);
/** This hook is called, when reassociation is started/stopped. */
void (*_hook_reassociate)(void *context, int start);
/** This hook is called, before a node is lowered. */
void (*_hook_lower)(void *context, ir_node *node);
/** This hook is called, before a graph is inlined. */
void (*_hook_inline)(void *context, ir_node *call, ir_graph *irg);
/** This hook is called, before tail recursion is applied to a graph. */
void (*_hook_tail_rec)(void *context, ir_graph *irg, int n_calls);
/** This hook is called, before a node is replaced due to strength reduction */
void (*_hook_strength_red)(void *context, ir_graph *irg, ir_node *node);
/** This hook is called, when dead node elimination is started/stopped. */
void (*_hook_dead_node_elim)(void *context, ir_graph *irg, int start);
/** This hook is called after a call was detected as const call */
void (*_hook_func_call)(void *context, ir_graph *irg, ir_node *call);
/** This hook is called after a Mul was replaced by a series of Shift and Add/Sub operations. */
void (*_hook_arch_dep_replace_mul_with_shifts)(void *context, ir_node *irn);
/** This hook is called after a Div/Mod by a constant value was replaced. */
void (*_hook_arch_dep_replace_division_by_const)(void *context, ir_node *irn);
/** This hook is called after a new mode was registered. */
void (*_hook_new_mode)(void *context, ir_mode *mode);
......@@ -106,24 +67,9 @@ struct hook_entry {
typedef enum {
hook_new_node, /**< type for hook_new_node() hook */
hook_replace, /**< type for hook_replace() hook */
hook_turn_into_id, /**< type for hook_turn_into_id() hook */
hook_normalize, /**< type for hook_normalize() hook */
hook_new_graph, /**< type for hook_new_graph() hook */
hook_free_graph, /**< type for hook_free_graph() hook */
hook_irg_walk, /**< type for hook_irg_walk() hook */
hook_irg_walk_blkwise, /**< type for hook_irg_walk_blkwise() hook */
hook_irg_block_walk, /**< type for hook_irg_block_walk() hook */
hook_reassociate, /**< type for hook_reassociate() hook */
hook_lower, /**< type for hook_lower() hook */
hook_inline, /**< type for hook_inline() hook */
hook_tail_rec, /**< type for hook_tail_rec() hook */
hook_strength_red, /**< type for hook_strength_red() hook */
hook_dead_node_elim, /**< type for hook_dead_node_elim() hook */
hook_func_call, /**< type for hook_func_call() hook */
/** type for hook_arch_dep_replace_mul_with_shifts() hook */
hook_arch_dep_replace_mul_with_shifts,
/** type for hook_arch_dep_replace_division_by_const() hook */
hook_arch_dep_replace_division_by_const,
hook_new_mode, /**< type for hook_new_mode() hook */
hook_new_entity, /**< type for hook_new_entity() hook */
hook_new_type, /**< type for hook_new_type() hook */
......@@ -166,44 +112,12 @@ extern hook_entry_t *hooks[hook_last];
#define hook_new_node(node) hook_exec(hook_new_node, (hook_ctx_, node))
/** Called when a node is replaced */
#define hook_replace(old, nw) hook_exec(hook_replace, (hook_ctx_, old, nw))
/** Called when a node is turned into an Id node */
#define hook_turn_into_id(node) hook_exec(hook_turn_into_id, (hook_ctx_, node))
/** Called when a node is normalized */
#define hook_normalize(node) hook_exec(hook_normalize, (hook_ctx_, node))
/** Called after a new graph has been created */
#define hook_new_graph(irg, ent) hook_exec(hook_new_graph, (hook_ctx_, irg, ent))
/** Called after a graph has been freed */
#define hook_free_graph(irg) hook_exec(hook_free_graph, (hook_ctx_, irg))
/** Called before a graph walk is started */
#define hook_irg_walk(irg, pre, post) hook_exec(hook_irg_walk, (hook_ctx_, irg, pre, post))
/** Called before a blockwise graph walk is started */
#define hook_irg_walk_blkwise(irg, pre, post) \
hook_exec(hook_irg_walk_blkwise, (hook_ctx_, irg, pre, post))
/** Called before a block walk is started */
#define hook_irg_block_walk(irg, node, pre, post) \
hook_exec(hook_irg_block_walk, (hook_ctx_, irg, node, pre, post))
/** Called before node inputs get reassociated */
#define hook_reassociate(start) hook_exec(hook_reassociate, (hook_ctx_, start))
/** Called before a node gets lowered */
#define hook_lower(node) hook_exec(hook_lower, (hook_ctx_, node))
/** Called before a graph is inlined */
#define hook_inline(call, irg) hook_exec(hook_inline, (hook_ctx_, call, irg))
/** Called before tail recursion is performed */
#define hook_tail_rec(irg, n_calls) hook_exec(hook_tail_rec, (hook_ctx_, irg, n_calls))
/** Called before strength reduction is performed */
#define hook_strength_red(irg, node) \
hook_exec(hook_strength_red, (hook_ctx_, irg, node))
/** Called before dead node elimination is performed */
#define hook_dead_node_elim(irg, start) hook_exec(hook_dead_node_elim, (hook_ctx_, irg, start))
/** Called when a function call is optimized */
#define hook_func_call(irg, call) \
hook_exec(hook_func_call, (hook_ctx_, irg, call))
/** Called when a mul is replaced with shifts */
#define hook_arch_dep_replace_mul_with_shifts(irn) \
hook_exec(hook_arch_dep_replace_mul_with_shifts, (hook_ctx_, irn))
/** Called when a dvision by constant is replaced */
#define hook_arch_dep_replace_division_by_const(irn) \
hook_exec(hook_arch_dep_replace_division_by_const, (hook_ctx_, irn))
/** Called when a new mode has been created */
#define hook_new_mode(mode) hook_exec(hook_new_mode, (hook_ctx_, mode))
/** Called when a new entity has been created */
......
......@@ -76,9 +76,6 @@ void dead_node_elimination(ir_graph *irg)
{
edges_deactivate(irg);
/* inform statistics that we started a dead-node elimination run */
hook_dead_node_elim(irg, 1);
/* Handle graph state */
free_callee_info(irg);
free_irg_outs(irg);
......@@ -104,7 +101,4 @@ void dead_node_elimination(ir_graph *irg)
/* Free memory from old unoptimized obstack */
obstack_free(&graveyard_obst, 0); /* First empty the obstack ... */
/* inform statistics that the run is over */
hook_dead_node_elim(irg, 0);
}
......@@ -159,7 +159,6 @@ static void fix_const_call_lists(ir_graph *irg, env_t *ctx)
/* finally, this call can float */
set_irn_pinned(call, false);
hook_func_call(irg, call);
}
if (exc_changed) {
......@@ -243,8 +242,6 @@ static void fix_nothrow_call_list(ir_graph *irg, ir_node **call_list)
break;
}
}
hook_func_call(irg, call);
}
/* changes were done ... */
......
......@@ -7833,7 +7833,6 @@ void ir_normalize_node(ir_node *n)
if (!operands_are_normalized(l, r)) {
set_binop_left(n, r);
set_binop_right(n, l);
hook_normalize(n);
}
} else if (is_Sync(n)) {
/* we assume that most of the time the inputs of a Sync node are already
......
......@@ -349,9 +349,6 @@ static bool inline_method(ir_node *const call, ir_graph *called_graph)
clear_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE);
edges_deactivate(irg);
/* here we know we WILL inline, so inform the statistics */
hook_inline(call, called_graph);
/* -- Decide how to handle exception control flow: Is there a handler
for the Call node, or do we branch directly to End on an exception?
exc_handling:
......
......@@ -444,7 +444,6 @@ static bool replace(ir_node *irn, ir_node *iv, ir_node *rc, iv_env *env)
ir_node *result = reduce(irn, iv, rc, env);
if (result != irn) {
hook_strength_red(get_irn_irg(irn), irn);
exchange(irn, result);
node_entry *e = get_irn_ne(result, env);
if (e->pscc == NULL) {
......
......@@ -281,8 +281,6 @@ static void do_reassociation(pdeq *const wq)
ir_node *n = (ir_node *)pdeq_getl(wq);
set_irn_link(n, NULL);
hook_reassociate(1);
/* reassociation must run until a fixpoint is reached. */
bool changed = false;
bool res;
......@@ -301,7 +299,6 @@ static void do_reassociation(pdeq *const wq)
changed |= res;
}
} while (res);
hook_reassociate(0);
if (changed) {
foreach_irn_in_r(n, i, pred) {
......@@ -2047,8 +2044,6 @@ static void do_chaining(ir_graph *irg)
ir_node *n = (ir_node *)pdeq_getl(wq);
set_irn_link(n, NULL);
hook_reassociate(1);
/* reassociation must run until a fixpoint is reached. */
bool changed = false;
bool res;
......@@ -2062,7 +2057,6 @@ static void do_chaining(ir_graph *irg)
changed |= res;
} while (res);
hook_reassociate(0);
if (changed) {
foreach_irn_in_r(n, i, pred) {
......
......@@ -601,7 +601,6 @@ void opt_tail_rec_irg(ir_graph *irg)
DB((dbg, LEVEL_2,
" Performing tail recursion for graph %s and %u Calls\n",
get_entity_ld_name(get_irg_entity(irg)), n_tail_calls));
hook_tail_rec(irg, n_tail_calls);
do_opt_tail_rec(irg, &env);
confirm_irg_properties(irg, IR_GRAPH_PROPERTIES_NONE);
set_irg_callee_info_state(irg, irg_callee_info_inconsistent);
......
Markdown is supported
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