6 * File name: ir/opt/strenth_red.h
7 * Purpose: Strength reduction.
8 * Author: Beyhan Veliev
12 * Copyright: (c) 2004 Universität Karlsruhe
13 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 # ifndef _STRENGTH_RED_H_
22 # define _STRENGTH_RED_H_
28 /** Performs strength reduction for the passed graph. */
29 void reduce_strength(ir_graph *irg);
31 /* The information needed for an induction variable */
32 # ifndef _STRENGTH_RED_TYP_
33 # define _STRENGTH_RED_TYP_
34 typedef struct _induct_var_info {
35 ir_op *operation_code; /**< The opcode of "op" */
36 ir_node *increment; /**< The value which increase or decrease the iteration variable. */
37 ir_node *init; /**< The start value of the iteration variable. */
38 ir_node *op; /**< The operation which increase or decrease the iteration variable. */
39 ir_node *itervar_phi; /**< The iteration variable. */
40 ir_node *new_phi; /**< The new iteration variable. */
41 ir_node *new_increment; /**< The new increment which replace the old one. */
42 ir_node *new_init; /**< The new init value of the iteration variable. */
43 ir_node *new_op; /**< The new operation that we need after replace. */
44 ir_node *new_cmp; /**< The new Cmp which replaces the old one. */
45 ir_node *cmp; /**< The Cmp which breaks the loop and compares the iteration variable with a constant. */
46 ir_node *cmp_const; /**< The other operand of Cmp. */
47 ir_node *cmp_init_block; /**< The initial block of the Cmp. */
48 ir_node *reducible_node; /**< The reducible nodes are save here. */
49 int is_reducible; /**< To save information if anything is reducible. */
50 int phi_pred; /**< To save the value of iteration variable predecessors. */
51 int init_pred_pos; /**< To save the position of iteration variable start value. */
52 int op_pred_pos; /**< To save the backedge of iteration variable. */
53 ir_loop *l_itervar_phi; /**< The loop of the induction variable */
57 /** If an ir_node is an induction variable return info else return NULL. */
58 induct_var_info *is_induction_variable(induct_var_info *info);
60 #endif /* _STRENGTH_RED_H_ */