Loads do not remove any nodes from the exec after sets. Also fix a 'node leak'.
[libfirm] / ir / opt / strength_red.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  *
22  * @file strength_red.h
23  *
24  * Project:     libFIRM
25  * File name:   ir/opt/strenth_red.h
26  * Purpose:     Strength reduction.
27  * Author:      Beyhan Veliev
28  * Modified by:
29  * Created:     22.8.2004
30  * CVS-ID:      $Id$
31  * Copyright:   (c) 2004 Universität Karlsruhe
32  *
33  *
34  *
35  *
36  */
37
38
39 # ifndef _STRENGTH_RED_H_
40 # define _STRENGTH_RED_H_
41
42 #include "irnode.h"
43 #include "irgraph.h"
44 #include "irloop.h"
45
46 /** Performs strength reduction for the passed graph. */
47 void reduce_strength(ir_graph *irg);
48
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 */
72 } induct_var_info;
73 #endif
74
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);
77
78 #endif /* _STRENGTH_RED_H_ */