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
25 #ifndef FIRM_IR_IRFLAG_T_H
26 #define FIRM_IR_IRFLAG_T_H
31 * libFIRM optimizations flags
34 #define E_FLAG(name, value, def) irf_##name = (1 << value),
35 #define I_FLAG(name, value, def) irf_##name = (1 << value),
36 #define R_FLAG(name, value)
38 #include "irflag_t.def"
46 * libFIRM running flags
49 #define E_FLAG(name, value, def)
50 #define I_FLAG(name, value, def)
51 #define R_FLAG(name, value) ir_rf_##name = (1 << value),
53 #include "irflag_t.def"
60 extern optimization_state_t libFIRM_opt, libFIRM_running, libFIRM_verb;
61 extern firm_verification_t opt_do_node_verification;
63 /** initialises the flags */
64 void firm_init_flags(void);
66 /* generate the getter functions for external access */
67 #define E_FLAG(name, value, def) \
68 static inline int get_opt_##name##_(void) { \
69 return libFIRM_opt & irf_##name; \
72 /* generate the getter functions for internal access */
73 #define I_FLAG(name, value, def) \
74 static inline int get_opt_##name(void) { \
75 return libFIRM_opt & irf_##name; \
78 /* generate getter and setter functions for running flags */
79 #define R_FLAG(name, value) \
80 static inline int is_##name##_running(void) { \
81 return libFIRM_running & ir_rf_##name; \
83 static inline void set_##name##_running(int flag) {\
84 if (flag) libFIRM_running |= ir_rf_##name; \
85 else libFIRM_running &= ~ir_rf_##name; \
88 #include "irflag_t.def"
94 static inline int get_optimize_(void)
96 return get_opt_optimize();
99 static inline firm_verification_t 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_suppress_downcast_optimization() get_opt_suppress_downcast_optimization_()