X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbepeephole.h;h=34fafab1f865d7ddf677f4191f96ccd0f2f06ca9;hb=255a9cc77e3cdf878406d722cf8414063c87e99b;hp=1fe1ed5e05136d91e07565c42e2a8d39f0f4d850;hpb=f2062b3d40c421fdb69804343bce89dd289fb307;p=libfirm diff --git a/ir/be/bepeephole.h b/ir/be/bepeephole.h index 1fe1ed5e0..34fafab1f 100644 --- a/ir/be/bepeephole.h +++ b/ir/be/bepeephole.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -23,12 +23,11 @@ * @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; @@ -47,19 +46,41 @@ static inline ir_node *be_peephole_get_reg_value(const arch_register_t *reg) } /** - * Datatype of the generic op handler for optimisation. If it exchanged node - * with something else, then it must return the new node, otherwise NULL. + * Datatype of the generic op handler for optimisation. */ -typedef ir_node*(*peephole_opt_func) (ir_node *node); +typedef void (*peephole_opt_func) (ir_node *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); + +/** + * 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 its previous IncSP node. + * Must be run from a be_peephole_opt() context. + * + * @param node a be_IncSP node + * + * @return the new IncSP node or node itself + */ +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) * values are stored in which register. * The generic op handler is called for each node if it exists. That's where - * backedn specific optimisations should be performed based on the + * 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