3 * File name: ir/ir/irgraph.c
4 * Purpose: Flags to control optimizations, inline implementation.
8 * Copyright: (c) 1998-2004 Universität Karlsruhe
9 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
15 * Inline implementation of Optimization flags.
17 * @author Michael Beck
25 * current libFIRM optimizations
28 /** Common subexpression eliminations: Hash the nodes. */
31 /** Don't use block predecessor for comparison.
32 * Default must be zero as code placement must
33 * be run right after a local optimize walk with
34 * opt_global_cse on. */
35 OPT_GLOBAL_CSE = 0x00000002,
37 /** Evaluate operations. */
38 OPT_CONSTANT_FOLDING = 0x00000004,
40 /** Bad node propagation. */
41 OPT_UNREACHABLE_CODE = 0x00000008,
44 OPT_CONTROL_FLOW_STRAIGHTENING = 0x00000010,
47 OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION = 0x00000020,
50 OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION = 0x00000040,
53 OPT_CRITICAL_EDGES = 0x00000080,
55 /** Reclaim memory. */
56 OPT_DEAD_NODE_ELIMINATION = 0x00000100,
58 /** Reassociate nodes. */
59 OPT_REASSOCIATION = 0x00000200,
61 /** Do inlining transformation. */
62 OPT_INLINE = 0x00000400,
64 /** Remove dynamic method dispatch. */
65 OPT_DYN_METH_DISPATCH = 0x00000800,
67 /** Transformations that normalize the firm representation
68 * as removing Ids and Tuples, useless Phis, SymConst(id) -> Const(entity) ...
70 OPT_NORMALIZE = 0x00001000,
72 /** Remove tail-recursion. */
73 OPT_TAIL_RECURSION = 0x00002000,
75 /** Free never called methods */
76 OPT_DEAD_METHOD_ELIMINATION = 0x00004000,
78 /** precise exception context */
79 OPT_PRECISE_EXC_CONTEXT = 0x00008000,
81 /** Free never called methods */
82 OPT_DEAD_METHOD_ELIMINATION_VERBOSE = 0x00010000,
84 /** Turn off all optimizations. */
85 OPT_OPTIMIZED = 0x40000000,
88 extern optimization_state_t libFIRM_opt;
90 /** Returns constant folding optimization setting. */
91 static INLINE int get_opt_cse(void)
93 return libFIRM_opt & OPT_CSE;
96 /** Returns constant subexpression elimination setting. */
97 static INLINE int get_opt_global_cse(void)
99 return libFIRM_opt & OPT_GLOBAL_CSE;
102 /** Returns global constant subexpression elimination setting. */
103 static INLINE int get_opt_constant_folding(void)
105 return libFIRM_opt & OPT_CONSTANT_FOLDING;
108 /** Returns unreachable code elimination setting. */
109 static INLINE int get_opt_unreachable_code(void)
111 return libFIRM_opt & OPT_UNREACHABLE_CODE;
114 /** Returns Straightening setting. */
115 static INLINE int get_opt_control_flow_straightening(void)
117 return libFIRM_opt & OPT_CONTROL_FLOW_STRAIGHTENING;
120 /** Returns if simplifications in local optimizations setting. */
121 static INLINE int get_opt_control_flow_weak_simplification(void)
123 return libFIRM_opt & OPT_CONTROL_FLOW_WEAK_SIMPLIFICATION;
126 /** Returns strong if and loop simplification setting */
127 static INLINE int get_opt_control_flow_strong_simplification(void)
129 return libFIRM_opt & OPT_CONTROL_FLOW_STRONG_SIMPLIFICATION;
132 /** Returns whether critical edges are removed */
133 static INLINE int get_opt_critical_edges(void)
135 return libFIRM_opt & OPT_CRITICAL_EDGES;
138 /** Returns reassociation setting. */
139 static INLINE int get_opt_reassociation(void)
141 return libFIRM_opt & OPT_REASSOCIATION;
144 /** Returns dead node elimination setting. */
145 static INLINE int get_opt_dead_node_elimination(void)
147 return libFIRM_opt & OPT_DEAD_NODE_ELIMINATION;
150 /** Returns dead method elimination setting. */
151 static INLINE int get_opt_dead_method_elimination(void)
153 return libFIRM_opt & OPT_DEAD_METHOD_ELIMINATION;
156 /** Returns dead method elimination setting. */
157 static INLINE int get_opt_dead_method_elimination_verbose(void)
159 return libFIRM_opt & OPT_DEAD_METHOD_ELIMINATION_VERBOSE;
162 /** Returns global optimization setting */
163 static INLINE int get_opt_optimize(void)
165 return libFIRM_opt & OPT_OPTIMIZED;
168 /** Returns inlining setting. */
169 static INLINE int get_opt_inline(void)
171 return libFIRM_opt & OPT_INLINE;
174 static INLINE int get_opt_dyn_meth_dispatch(void)
176 return libFIRM_opt & OPT_DYN_METH_DISPATCH;
179 static INLINE int get_opt_normalize(void)
181 return libFIRM_opt & OPT_NORMALIZE;
184 /** Returns tail-recursion setting. */
185 static INLINE int get_opt_tail_recursion(void)
187 return libFIRM_opt & OPT_TAIL_RECURSION;
190 /** Returns precise exception context setting. */
191 static INLINE int get_opt_precise_exc_context(void)
193 return libFIRM_opt & OPT_PRECISE_EXC_CONTEXT;
196 #endif /* _IRFLAG_T_H_ */