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
29 #include "firm_config.h"
34 * libFIRM optimizations flags
37 #define E_FLAG(name, value, def) irf_##name = (1 << value),
38 #define I_FLAG(name, value, def) irf_##name = (1 << value),
39 #define R_FLAG(name, value)
41 #include "irflag_t.def"
49 * libFIRM running flags
52 #define E_FLAG(name, value, def)
53 #define I_FLAG(name, value, def)
54 #define R_FLAG(name, value) ir_rf_##name = (1 << value),
56 #include "irflag_t.def"
63 extern optimization_state_t libFIRM_opt, libFIRM_running, libFIRM_verb;
64 extern firm_verification_t opt_do_node_verification;
66 /** initialises the flags */
67 void firm_init_flags(void);
69 /* generate the getter functions for external access */
70 #define E_FLAG(name, value, def) \
71 static INLINE int _get_opt_##name(void) { \
72 return libFIRM_opt & irf_##name; \
75 /* generate the getter functions for internal access */
76 #define I_FLAG(name, value, def) \
77 static INLINE int get_opt_##name(void) { \
78 return libFIRM_opt & irf_##name; \
81 /* generate getter and setter functions for running flags */
82 #define R_FLAG(name, value) \
83 static INLINE int is_##name##_running(void) { \
84 return libFIRM_running & ir_rf_##name; \
86 static INLINE void set_##name##_running(int flag) {\
87 if (flag) libFIRM_running |= ir_rf_##name; \
88 else libFIRM_running &= ~ir_rf_##name; \
91 #include "irflag_t.def"
97 static INLINE int _get_optimize(void) {
98 return get_opt_optimize();
101 static INLINE firm_verification_t
102 get_node_verification_mode(void) {
103 return opt_do_node_verification;
106 #define get_optimize() _get_optimize()
107 #define get_opt_cse() _get_opt_cse()
108 #define get_opt_dyn_meth_dispatch() _get_opt_dyn_meth_dispatch()
109 #define get_opt_optimize_class_casts() _get_opt_optimize_class_casts()
110 #define get_opt_suppress_downcast_optimization() _get_opt_suppress_downcast_optimization()
112 extern void firm_init_flags(void);