X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbepeephole.h;h=34fafab1f865d7ddf677f4191f96ccd0f2f06ca9;hb=255a9cc77e3cdf878406d722cf8414063c87e99b;hp=dc2f9f7ac005c56dda5fe14c396a5566572e5b8f;hpb=fc7a995f8446cfcfbb6f41cb53ed5657947084ff;p=libfirm diff --git a/ir/be/bepeephole.h b/ir/be/bepeephole.h index dc2f9f7ac..34fafab1f 100644 --- a/ir/be/bepeephole.h +++ b/ir/be/bepeephole.h @@ -23,22 +23,21 @@ * @author Matthias Braun * @version $Id$ */ - #ifndef BEPEEPHOLE_H #define BEPEEPHOLE_H #include "beirg.h" -#include "bearch_t.h" +#include "bearch.h" extern ir_node ***register_values; -static INLINE ir_node *be_peephole_get_value(unsigned regclass_idx, +static inline ir_node *be_peephole_get_value(unsigned regclass_idx, unsigned register_idx) { return register_values[regclass_idx][register_idx]; } -static INLINE ir_node *be_peephole_get_reg_value(const arch_register_t *reg) +static inline ir_node *be_peephole_get_reg_value(const arch_register_t *reg) { unsigned regclass_idx = arch_register_class_index(arch_register_get_class(reg)); unsigned register_idx = arch_register_get_index(reg); @@ -52,29 +51,18 @@ static INLINE ir_node *be_peephole_get_reg_value(const arch_register_t *reg) typedef void (*peephole_opt_func) (ir_node *node); /** - * must be called from peephole optimisations before a node is exchanged, - * so bepeephole can update it's internal state. - */ -void be_peephole_before_exchange(const ir_node *old_node, ir_node *new_node); - -/** - * must be called from peephole optimisations after a node is exchanged, - * so bepeephole can update it's internal state. - */ -void be_peephole_after_exchange(ir_node *new_node); + * Notify the peephole phase about a newly added node, so it can update its + * internal state. This is not needed for the new node, when + * be_peephole_exchange() is used. */ +void be_peephole_new_node(ir_node *nw); /** - * must be called from peephole optimisations before a node will be killed - * and its users will be redirected to new_node. - * so bepeephole can update it's internal state. - * - * Note: killing a node and rewiring os only allowed if new_node produces - * the same registers as old_node. - */ -void be_peephole_before_exchange_and_kill(const ir_node *old_node, ir_node *new_node); + * When doing peephole optimisation use this function instead of plain + * exchange(), so it can update its internal state. */ +void be_peephole_exchange(ir_node *old, ir_node *nw); /** - * Tries to optimize a beIncSp node with it's previous IncSP node. + * Tries to optimize a beIncSp node with its previous IncSP node. * Must be run from a be_peephole_opt() context. * * @param node a be_IncSP node @@ -83,6 +71,8 @@ void be_peephole_before_exchange_and_kill(const ir_node *old_node, ir_node *new_ */ ir_node *be_peephole_IncSP_IncSP(ir_node *node); +bool be_has_only_one_user(ir_node *node); + /** * Do peephole optimisations. It traverses the schedule of all blocks in * backward direction. The register_values variable indicates which (live) @@ -91,6 +81,6 @@ ir_node *be_peephole_IncSP_IncSP(ir_node *node); * backend specific optimisations should be performed based on the * register-liveness information. */ -void be_peephole_opt(be_irg_t *birg); +void be_peephole_opt(ir_graph *irg); #endif