3 * File name: ir/opt/opt_osr.h
4 * Purpose: Operator Strength Reduction,
5 * Keith D. Cooper, L. Taylor Simpson, Christopher A. Vick
10 * Copyright: (c) 2006 Universität Karlsruhe
11 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 #include "firm_types.h"
18 /** Possible flags for the Operator Scalar Replacement. */
19 typedef enum osr_flags {
20 osr_flag_none = 0, /**< no additional flags */
21 osr_flag_lftr_with_ov_check = 1, /**< do only linear function test replacement
22 if no overflow occurs. */
23 /** default setting */
24 osr_flag_default = osr_flag_lftr_with_ov_check
28 * Do the Operator Scalar Replacement optimization and linear
29 * function test replacement for loop control.
31 * @param irg the graph which should be optimized
32 * @param flags one of osr_flags
34 * The linear function replacement test is controlled by the flags.
35 * If the osr_flag_lftr_with_ov_check is set, the replacement is only
36 * done if do overflow can occur.
37 * Otherwise it is ALWAYS done which might be unsure.
41 * for (i = 0; i < 100; ++i)
43 * might be replaced by
45 * for (i = 0; i < 400; i += 4)
49 * for (i = 0; i < 0x7FFFFFFF; ++i)
51 * will not be replaced by
53 * for (i = 0; i < 0xFFFFFFFC; i += 4)
55 * because of overflow.
57 * Note that i < a + 400 is also not possible with the current implementation
58 * although this might be allowed by other compilers...
60 void opt_osr(ir_graph *irg, unsigned flags);
62 #endif /* _OPT_OSR_H_ */