Commit 09117779 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

bepeephole: Factorise code to register peephole optimizations.

parent 901af1c4
......@@ -163,15 +163,6 @@ static void peephole_arm_Str_Ldr(ir_node *node)
attr->offset = 0;
}
/**
* Register a peephole optimization function.
*/
static void register_peephole_optimization(ir_op *op, peephole_opt_func func)
{
assert(op->ops.generic == NULL);
op->ops.generic = (op_func)func;
}
/* Perform peephole-optimizations. */
void arm_peephole_optimization(ir_graph *irg)
{
......
......@@ -73,6 +73,15 @@ bool be_can_move_down(ir_heights_t *heights, const ir_node *node,
bool be_can_move_up(ir_heights_t *heights, const ir_node *node,
const ir_node *after);
/**
* Register a peephole optimization function.
*/
static inline void register_peephole_optimization(ir_op *const op, peephole_opt_func const func)
{
assert(!op->ops.generic);
op->ops.generic = (op_func)func;
}
/**
* Do peephole optimizations. It traverses the schedule of all blocks in
* backward direction. The register_values variable indicates which (live)
......
......@@ -1011,16 +1011,6 @@ static void peephole_ia32_Rol(ir_node *node)
}
}
/**
* Register a peephole optimization function.
*/
static void register_peephole_optimization(ir_op *op, peephole_opt_func func)
{
assert(op->ops.generic == NULL);
op->ops.generic = (op_func)func;
}
/* Perform peephole-optimizations. */
void ia32_peephole_optimization(ir_graph *irg)
{
......
......@@ -607,12 +607,6 @@ static void peephole_sparc_SubCC(ir_node *node)
remove_unused_CC(node, op_sparc_Sub);
}
static void register_peephole_optimization(ir_op *op, peephole_opt_func func)
{
assert(op->ops.generic == NULL);
op->ops.generic = (op_func) func;
}
static bool is_frame_load(const ir_node *node)
{
return is_sparc_Ld(node) || is_sparc_Ldf(node);
......
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