Reset link field to NULL on construction
[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  * right after a call to local_optimize with global cse turned on.
58  * Default: opt_global_cse == 0.
59  */
60 void set_opt_global_cse (int value);
61 /** Returns global constant subexpression elimination setting. */
62 int  get_opt_global_cse (void);
63
64 /** Enables/Disables unreachble code elimination.
65  *
66  * If opt_unreachable_code == 1 replace nodes (except Block,
67  * Phi and Tuple) with a Bad predecessor by the Bad node.
68  * Default: opt_unreachable_code == 1.
69  */
70 void set_opt_unreachable_code(int value);
71 /** Returns unreachble code elimination setting. */
72 int  get_opt_unreachable_code(void);
73
74 /** Enables/Disables control flow optimizations.
75  *
76  * Performs Straightening, if simplifications and loop simplifications.
77  * Sets all separate control flow flags (control_flow_straightening,
78  * weak_simplification, strong_simplification and critical_edges).
79  */
80 void set_opt_control_flow(int value);
81
82 /** Enables/Disables Straightening. */
83 void set_opt_control_flow_straightening(int value);
84 /** Returns Straightening setting. */
85 int  get_opt_control_flow_straightening(void);
86
87 /** Enables/Disables if simplifications in local optimizations. */
88 void set_opt_control_flow_weak_simplification(int value);
89 /** Returns if simplifications in local optimizations setting. */
90 int  get_opt_control_flow_weak_simplification(void);
91
92 /** Enables/Disables strong if and loop simplification (in optimize_cf). */
93 void set_opt_control_flow_strong_simplification(int value);
94 /** Returns strong if and loop simplification setting */
95 int  get_opt_control_flow_strong_simplification(void);
96
97 /** Enables/Disables removal of critical control flow edges. */
98 void set_opt_critical_edges(int value);
99 /** Returns whether critical edges are removed */
100 int  get_opt_critical_edges(void);
101
102 /** Enables/Disables reassociation.
103  *
104  * If opt_reassociation == 1 reassociation is performed.
105  * Default: opt_reassociation == 1.
106  */
107 void set_opt_reassociation(int value);
108 /** Returns reassociation setting. */
109 int  get_opt_reassociation(void);
110
111 /** Enables/Disables dead node elimination.
112  *
113  * If opt_dead_node_elimination == 1 deallocate all dead nodes
114  * by copying the firm graph.
115  * Default: opt_dead_node_elimination == 1. */
116 void set_opt_dead_node_elimination (int value);
117 /** Returns dead node elimination setting. */
118 int  get_opt_dead_node_elimination (void);
119
120 /** Enable/Disables inlining.
121  *
122  * If opt_inline == 1 the inlining transformation is performed.
123  */
124 void set_opt_inline (int value);
125 /** Returns inlining setting. */
126 int  get_opt_inline (void);
127
128 /** Enable/Disable optimization of dynamic method dispatch
129  *
130  * This flag enables/disables the optimization of dynamic method dispatch.
131  * If the flag is turned on Sel nodes can be replaced by Const nodes representing
132  * the address of a function.
133  */
134 void set_opt_dyn_meth_dispatch (int value);
135 int  get_opt_dyn_meth_dispatch (void);
136
137 /** Enable/Disable normalizations of the firm representation.
138  *
139  *  This flag guards transformations that normalize the firm representation
140  *  as removing Ids and Tuples, useless Phis, replacing SymConst(id) by
141  *  Const(entity) and others.
142  *  The transformations guarded by this flag are not guarded by flag
143  *  "optimize".
144  *  Many algorithms operating on firm can not deal with constructs in
145  *  the non-normalized representation.
146  *  default: 1
147  *  @@@ ATTENTION: not all such transformations are guarded by a flag.
148  */
149 void set_opt_normalize (int value);
150 int  get_opt_normalize (void);
151
152
153 #endif