Improved flag testing
[libfirm] / ir / ir / irflag.h
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 * All rights reserved.
3 */
4
5 /**
6  * @file irflag.h
7  *
8  * Optimization flags.
9  *
10  * @author Christian Schaefer
11  */
12
13 /* $Id$ */
14
15 #ifndef _IRFLAG_H_
16 #define _IRFLAG_H_
17
18 /**
19  * This function enables/disables optimizations globally.
20  *
21  * If optimize == 0 no optimizations are performed at all.
22  * Default: optimize == 1.
23  */
24 void set_optimize (int value);
25 /** Returns global optimization setting */
26 int  get_optimize (void);
27
28 /** Enables/Disables constant folding optimization.
29  *
30  *  If opt_constant_folding == 1 perform
31  *  - constant expression evaluation (2 + 5 ==> 7, 3 < 2 ==> false)
32  *  - algebraic simplification  (a * 0 ==> 0, a or a ==> a)
33  *  - simplification of tests   ( !(a < b) ==> (a >= b))
34  *  - refining the memory representation
35  *  - remove store after load
36  * Default: opt_constant_folding == 1.
37  */
38 void set_opt_constant_folding (int value);
39 /** Returns constant folding optimization setting. */
40 int  get_opt_constant_folding (void);
41
42 /** Enables/Disables constant subexpression elimination.
43  *
44  * If opt_cse == 1 perform constant subexpression elimination.
45  * Default: opt_cse == 1.
46  */
47 void set_opt_cse (int value);
48 /** Returns constant subexpression elimination setting. */
49 int  get_opt_cse (void);
50
51 /** Enables/Disables global constant subexpression elimination.
52  *
53  * If opt_global_cse == 1 and opt_cse == 1 perform intra procedure
54  * constant subexpression elimination for floating nodes.  Intra
55  * procedure cse gets the graph into state "floating".  It is necessary
56  * to run pre/code motion to get the graph back into state "pinned".
57  * Default: opt_global_cse == 1.
58  */
59 void set_opt_global_cse (int value);
60 /** Returns global constant subexpression elimination setting. */
61 int  get_opt_global_cse (void);
62
63 /** Enables/Disables unreachble code elimination.
64  *
65  * If opt_unreachable_code == 1 replace nodes (except Block,
66  * Phi and Tuple) with a Bad predecessor by the Bad node.
67  * Default: opt_unreachable_code == 1.
68  */
69 void set_opt_unreachable_code(int value);
70 /** Returns unreachble code elimination setting. */
71 int  get_opt_unreachable_code(void);
72
73 /** Enables/Disables control flow optimizations.
74  *
75  * Performs Straightening, if simplifications and loop simplifications.
76  * Sets all separate control flow flags (control_flow_straightening,
77  * weak_simplification, strong_simplification and critical_edges).
78  */
79 void set_opt_control_flow(int value);
80
81 /** Enables/Disables Straightening. */
82 void set_opt_control_flow_straightening(int value);
83 /** Returns Straightening setting. */
84 int  get_opt_control_flow_straightening(void);
85
86 /** Enables/Disables if simplifications in local optimizations. */
87 void set_opt_control_flow_weak_simplification(int value);
88 /** Returns if simplifications in local optimizations setting. */
89 int  get_opt_control_flow_weak_simplification(void);
90
91 /** Enables/Disables strong if and loop simplification (in optimize_cf). */
92 void set_opt_control_flow_strong_simplification(int value);
93 /** Returns strong if and loop simplification setting */
94 int  get_opt_control_flow_strong_simplification(void);
95
96 /** Enables/Disables removal of critical control flow edges. */
97 void set_opt_critical_edges(int value);
98 /** Returns whether critical edges are removed */
99 int  get_opt_critical_edges(void);
100
101 /** Enables/Disables reassociation.
102  *
103  * If opt_reassociation == 1 reassociation is performed.
104  * Default: opt_reassociation == 1.
105  */
106 void set_opt_reassociation(int value);
107 /** Returns reassociation setting. */
108 int  get_opt_reassociation(void);
109
110 /** Enables/Disables dead node elimination.
111  *
112  * If opt_dead_node_elimination == 1 deallocate all dead nodes
113  * by copying the firm graph.
114  * Default: opt_dead_node_elimination == 1. */
115 void set_opt_dead_node_elimination (int value);
116 /** Returns dead node elimination setting. */
117 int  get_opt_dead_node_elimination (void);
118
119 /** Enable/Disables inlining.
120  *
121  * If opt_inline == 1 the inlining transformation is performed.
122  */
123 void set_opt_inline (int value);
124 /** Returns inlining setting. */
125 int  get_opt_inline (void);
126
127 #endif