2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @file strength_red.h
25 * File name: ir/opt/strenth_red.h
26 * Purpose: Strength reduction.
27 * Author: Beyhan Veliev
31 * Copyright: (c) 2004 Universität Karlsruhe
39 # ifndef _STRENGTH_RED_H_
40 # define _STRENGTH_RED_H_
46 /** Performs strength reduction for the passed graph. */
47 void reduce_strength(ir_graph *irg);
49 /* The information needed for an induction variable */
50 # ifndef _STRENGTH_RED_TYP_
51 # define _STRENGTH_RED_TYP_
52 typedef struct _induct_var_info {
53 ir_op *operation_code; /**< The opcode of "op" */
54 ir_node *increment; /**< The value which increase or decrease the iteration variable. */
55 ir_node *init; /**< The start value of the iteration variable. */
56 ir_node *op; /**< The operation which increase or decrease the iteration variable. */
57 ir_node *itervar_phi; /**< The iteration variable. */
58 ir_node *new_phi; /**< The new iteration variable. */
59 ir_node *new_increment; /**< The new increment which replace the old one. */
60 ir_node *new_init; /**< The new init value of the iteration variable. */
61 ir_node *new_op; /**< The new operation that we need after replace. */
62 ir_node *new_cmp; /**< The new Cmp which replaces the old one. */
63 ir_node *cmp; /**< The Cmp which breaks the loop and compares the iteration variable with a constant. */
64 ir_node *cmp_const; /**< The other operand of Cmp. */
65 ir_node *cmp_init_block; /**< The initial block of the Cmp. */
66 ir_node *reducible_node; /**< The reducible nodes are save here. */
67 int is_reducible; /**< To save information if anything is reducible. */
68 int phi_pred; /**< To save the value of iteration variable predecessors. */
69 int init_pred_pos; /**< To save the position of iteration variable start value. */
70 int op_pred_pos; /**< To save the backedge of iteration variable. */
71 ir_loop *l_itervar_phi; /**< The loop of the induction variable */
75 /** If an ir_node is an induction variable return info else return NULL. */
76 induct_var_info *is_induction_variable(induct_var_info *info);
78 #endif /* _STRENGTH_RED_H_ */