Typo fixed.
[libfirm] / ir / ir / irflag.c
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 * All rights reserved.
3 *
4 * Authors: Christian Schaefer
5 *
6 * irflag --- optimization flags
7 */
8
9 /* $Id$ */
10
11 #ifdef HAVE_CONFIG_H
12 # include <config.h>
13 #endif
14
15 #include "irflag.h"
16 #include "firm_common.h"
17
18
19 /* 0 - don't do this optimization
20    1 - lets see, if there is a better graph */
21 int optimized = 1;                  /* Turn off all optimizations. */
22
23 int opt_cse = 1;                    /* Hash the nodes. */
24 int opt_global_cse = 0;             /* Don't use block predecessor for comparison.
25                                        Default must be zero as code placement must
26                                        be run right after a local optimize walk with
27                                        opt_global_cse on. */
28 int opt_constant_folding = 1;       /* Evaluate operations. */
29 int opt_unreachable_code = 1;       /* Bad node propagation. */
30 int opt_control_flow_straightening = 1;           /*  */
31 int opt_control_flow_weak_simplification = 1;     /*  */
32 int opt_control_flow_strong_simplification = 1;   /*  */
33 int opt_critical_edges = 1;
34 int opt_dead_node_elimination = 1;  /* Reclaim memory. */
35 int opt_reassociation = 1;          /* Reassociate nodes. */
36 int opt_inline = 1;                 /* Do inlining transformation. */
37 int opt_dyn_meth_dispatch = 1;      /* Remove dynamic method dispatch. */
38
39 int opt_normalize = 1;              /* Transformations that normalize the firm representation
40                                        as removing Ids and Tuples, useless Phis, SymConst(id) ->
41                                        Const(entity) ... */
42
43 /* set the flags with set_flagname, get the flag with get_flagname */
44 INLINE void
45 set_opt_cse (int value)
46 {
47   opt_cse = value;
48 }
49
50 INLINE int
51 get_opt_cse (void)
52 {
53   return opt_cse;
54 }
55
56 void set_opt_global_cse (int value)
57 {
58   opt_global_cse = value;
59 }
60
61 int  get_opt_global_cse (void)
62 {
63   return opt_global_cse;
64 }
65
66 INLINE void
67 set_opt_constant_folding (int value)
68 {
69   opt_constant_folding=value;
70 }
71
72 INLINE int
73 get_opt_constant_folding (void)
74 {
75   return opt_constant_folding;
76 }
77
78 INLINE void
79 set_opt_unreachable_code(int value)
80 {
81   opt_unreachable_code = value;
82 }
83
84 INLINE int
85 get_opt_unreachable_code(void)
86 {
87   return opt_unreachable_code;
88 }
89
90 INLINE void set_opt_control_flow(int value) {
91   set_opt_control_flow_straightening(value);
92   set_opt_control_flow_weak_simplification(value);
93   set_opt_control_flow_strong_simplification(value);
94   set_opt_critical_edges(value);
95 }
96
97 /* Performs Straightening */
98 void set_opt_control_flow_straightening(int value) {
99   opt_control_flow_straightening = value;
100 }
101 int  get_opt_control_flow_straightening(void) {
102   return opt_control_flow_straightening;
103 }
104 /* Performs if simplifications in local optimizations. */
105 void set_opt_control_flow_weak_simplification(int value) {
106   opt_control_flow_weak_simplification = value;
107 }
108 int  get_opt_control_flow_weak_simplification(void) {
109   return opt_control_flow_weak_simplification;
110 }
111 /* Performs strong if and loop simplification (in optimize_cf). */
112 void set_opt_control_flow_strong_simplification(int value) {
113   opt_control_flow_strong_simplification = value;
114 }
115 int  get_opt_control_flow_strong_simplification(void) {
116   return opt_control_flow_strong_simplification;
117 }
118
119 void set_opt_critical_edges(int value) {
120   opt_critical_edges = value;
121 }
122 int  get_opt_critical_edges(void) {
123   return opt_critical_edges;
124 }
125
126
127 INLINE void
128 set_opt_reassociation(int value)
129 {
130   opt_reassociation = value;
131 }
132
133 INLINE int
134 get_opt_reassociation(void)
135 {
136   return opt_reassociation;
137 }
138
139 INLINE void
140 set_opt_dead_node_elimination (int value)
141 {
142   opt_dead_node_elimination = value;
143 }
144
145 INLINE int
146 get_opt_dead_node_elimination (void)
147 {
148   return opt_dead_node_elimination;
149 }
150
151 INLINE void
152 set_optimize (int value)
153 {
154   optimized = value;
155 }
156
157 INLINE int
158 get_optimize (void)
159 {
160   return optimized;
161 }
162
163
164 INLINE void set_opt_inline (int value) {
165   opt_inline = value;
166 }
167
168 INLINE int  get_opt_inline (void) {
169   return opt_inline;
170 }
171
172 /** Enable/Disable optimization of dynamic method dispatch
173  *
174  * This flag enables/disables the optimization of dynamic method dispatch.
175  * If the flag is turned on Sel nodes can be replaced by Const nodes representing
176  * the address of a function.
177  */
178 void set_opt_dyn_meth_dispatch (int value) {
179   opt_dyn_meth_dispatch = value;
180 }
181 int  get_opt_dyn_meth_dispatch (void) {
182   return opt_dyn_meth_dispatch;
183 }
184
185
186
187 INLINE void set_opt_normalize (int value) {
188   opt_normalize = value;
189 }
190
191 INLINE int  get_opt_normalize (void) {
192   return opt_normalize;
193 }