3 * File name: ir/ir/irflag.c
4 * Purpose: Flags to control optimizations.
5 * Author: Christian Schaefer, Goetz Lindenmaier
9 * Copyright: (c) 1999-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
19 #include "firm_common.h"
22 /* 0 - don't do this optimization
23 1 - lets see, if there is a better graph */
24 int optimized = 1; /* Turn off all optimizations. */
26 int opt_cse = 1; /* Hash the nodes. */
27 int opt_global_cse = 0; /* Don't use block predecessor for comparison.
28 Default must be zero as code placement must
29 be run right after a local optimize walk with
31 int opt_constant_folding = 1; /* Evaluate operations. */
32 int opt_unreachable_code = 1; /* Bad node propagation. */
33 int opt_control_flow_straightening = 1; /* */
34 int opt_control_flow_weak_simplification = 1; /* */
35 int opt_control_flow_strong_simplification = 1; /* */
36 int opt_critical_edges = 1;
37 int opt_dead_node_elimination = 1; /* Reclaim memory. */
38 int opt_reassociation = 1; /* Reassociate nodes. */
39 int opt_inline = 1; /* Do inlining transformation. */
40 int opt_dyn_meth_dispatch = 1; /* Remove dynamic method dispatch. */
42 int opt_normalize = 1; /* Transformations that normalize the firm representation
43 as removing Ids and Tuples, useless Phis, SymConst(id) ->
46 /* set the flags with set_flagname, get the flag with get_flagname */
48 set_opt_cse (int value)
59 void set_opt_global_cse (int value)
61 opt_global_cse = value;
64 int get_opt_global_cse (void)
66 return opt_global_cse;
70 set_opt_constant_folding (int value)
72 opt_constant_folding=value;
76 get_opt_constant_folding (void)
78 return opt_constant_folding;
82 set_opt_unreachable_code(int value)
84 opt_unreachable_code = value;
88 get_opt_unreachable_code(void)
90 return opt_unreachable_code;
93 INLINE void set_opt_control_flow(int value) {
94 set_opt_control_flow_straightening(value);
95 set_opt_control_flow_weak_simplification(value);
96 set_opt_control_flow_strong_simplification(value);
97 set_opt_critical_edges(value);
100 /* Performs Straightening */
101 void set_opt_control_flow_straightening(int value) {
102 opt_control_flow_straightening = value;
104 int get_opt_control_flow_straightening(void) {
105 return opt_control_flow_straightening;
107 /* Performs if simplifications in local optimizations. */
108 void set_opt_control_flow_weak_simplification(int value) {
109 opt_control_flow_weak_simplification = value;
111 int get_opt_control_flow_weak_simplification(void) {
112 return opt_control_flow_weak_simplification;
114 /* Performs strong if and loop simplification (in optimize_cf). */
115 void set_opt_control_flow_strong_simplification(int value) {
116 opt_control_flow_strong_simplification = value;
118 int get_opt_control_flow_strong_simplification(void) {
119 return opt_control_flow_strong_simplification;
122 void set_opt_critical_edges(int value) {
123 opt_critical_edges = value;
125 int get_opt_critical_edges(void) {
126 return opt_critical_edges;
131 set_opt_reassociation(int value)
133 opt_reassociation = value;
137 get_opt_reassociation(void)
139 return opt_reassociation;
143 set_opt_dead_node_elimination (int value)
145 opt_dead_node_elimination = value;
149 get_opt_dead_node_elimination (void)
151 return opt_dead_node_elimination;
155 set_optimize (int value)
167 INLINE void set_opt_inline (int value) {
171 INLINE int get_opt_inline (void) {
175 /** Enable/Disable optimization of dynamic method dispatch
177 * This flag enables/disables the optimization of dynamic method dispatch.
178 * If the flag is turned on Sel nodes can be replaced by Const nodes representing
179 * the address of a function.
181 void set_opt_dyn_meth_dispatch (int value) {
182 opt_dyn_meth_dispatch = value;
184 int get_opt_dyn_meth_dispatch (void) {
185 return opt_dyn_meth_dispatch;
190 INLINE void set_opt_normalize (int value) {
191 opt_normalize = value;
194 INLINE int get_opt_normalize (void) {
195 return opt_normalize;