Fixed wrong array declaration
[libfirm] / ir / opt / opt_osr.h
1 /**
2  * Project:     libFIRM
3  * File name:   ir/opt/opt_osr.h
4  * Purpose:     Operator Strength Reduction,
5  *              Keith D. Cooper, L. Taylor Simpson, Christopher A. Vick
6  * Author:      Michael Beck
7  * Modified by:
8  * Created:     12.5.2006
9  * CVS-ID:      $Id$
10  * Copyright:   (c) 2006 Universität Karlsruhe
11  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
12  */
13 #ifndef _OPT_OSR_H_
14 #define _OPT_OSR_H_
15
16 #include "firm_types.h"
17
18 enum osr_flags {
19         osr_flag_none               = 0,  /**< no additional flags */
20         osr_flag_lftr_with_ov_check = 1,  /**< do only linear function test replacement
21                                                if no overflow occurs. */
22         /** default setting */
23         osr_flag_default = osr_flag_lftr_with_ov_check
24 } osr_flags;
25
26 /**
27  * Do the Operator Scalar Replacement optimization and linear
28  * function test replacement for loop control.
29  *
30  * @param irg    the graph which should be optimized
31  * @param flags  one of osr_flags
32  *
33  * The linear function replacement test is controlled by the flags.
34  * If the osr_flag_lftr_with_ov_check is set, the replacement is only
35  * done if do overflow can occur.
36  * Otherwise it is ALWAYS done which might be unsure.
37  *
38  * For instance:
39  *
40  * for (i = 0; i < 100; ++i)
41  *
42  * might be replaced by
43  *
44  * for (i = 0; i < 400; i += 4)
45  *
46  * But
47  *
48  * for (i = 0; i < 0x7FFFFFFF; ++i)
49  *
50  * will not be replaced by
51  *
52  * for (i = 0; i < 0xFFFFFFFC; i += 4)
53  *
54  * because of overflow.
55  *
56  * Note that i < a + 400 is also not possible with the current implementation
57  * although this might be allowed by other compilers...
58  */
59 void opt_osr(ir_graph *irg, unsigned flags);
60
61 #endif /* _OPT_OSR_H_ */