2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Flags to control optimizations, inline implementation.
23 * @author Michael Beck, Sebastian Hack
26 #ifndef FIRM_IR_IRFLAG_T_H
27 #define FIRM_IR_IRFLAG_T_H
32 * libFIRM optimizations flags
35 #define E_FLAG(name, value, def) irf_##name = (1 << value),
36 #define I_FLAG(name, value, def) irf_##name = (1 << value),
37 #define R_FLAG(name, value)
39 #include "irflag_t.def"
47 * libFIRM running flags
50 #define E_FLAG(name, value, def)
51 #define I_FLAG(name, value, def)
52 #define R_FLAG(name, value) ir_rf_##name = (1 << value),
54 #include "irflag_t.def"
61 extern optimization_state_t libFIRM_opt, libFIRM_running, libFIRM_verb;
62 extern firm_verification_t opt_do_node_verification;
64 /** initialises the flags */
65 void firm_init_flags(void);
67 /* generate the getter functions for external access */
68 #define E_FLAG(name, value, def) \
69 static inline int _get_opt_##name(void) { \
70 return libFIRM_opt & irf_##name; \
73 /* generate the getter functions for internal access */
74 #define I_FLAG(name, value, def) \
75 static inline int get_opt_##name(void) { \
76 return libFIRM_opt & irf_##name; \
79 /* generate getter and setter functions for running flags */
80 #define R_FLAG(name, value) \
81 static inline int is_##name##_running(void) { \
82 return libFIRM_running & ir_rf_##name; \
84 static inline void set_##name##_running(int flag) {\
85 if (flag) libFIRM_running |= ir_rf_##name; \
86 else libFIRM_running &= ~ir_rf_##name; \
89 #include "irflag_t.def"
95 static inline int _get_optimize(void) {
96 return get_opt_optimize();
99 static inline firm_verification_t
100 get_node_verification_mode(void) {
101 return opt_do_node_verification;
104 #define get_optimize() _get_optimize()
105 #define get_opt_cse() _get_opt_cse()
106 #define get_opt_dyn_meth_dispatch() _get_opt_dyn_meth_dispatch()
107 #define get_opt_optimize_class_casts() _get_opt_optimize_class_casts()
108 #define get_opt_suppress_downcast_optimization() _get_opt_suppress_downcast_optimization()