Add get_opt_overflow_unsafe_transform() option.
[libfirm] / ir / ir / irflag_t.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    Flags to control optimizations, inline implementation.
23  * @author   Michael Beck, Sebastian Hack
24  * @version  $Id$
25  */
26 #ifndef FIRM_IR_IRFLAG_T_H
27 #define FIRM_IR_IRFLAG_T_H
28
29 #include "firm_config.h"
30
31 #include "irflag.h"
32
33 /**
34  * libFIRM optimizations flags
35  */
36 typedef enum {
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)
40
41 #include "irflag_t.def"
42         irf_last
43 #undef I_FLAG
44 #undef E_FLAG
45 #undef R_FLAG
46 } libfirm_opts_t;
47
48 /**
49  * libFIRM running flags
50  */
51 typedef enum {
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),
55
56 #include "irflag_t.def"
57         ir_rf_last
58 #undef I_FLAG
59 #undef E_FLAG
60 #undef R_FLAG
61 } libfirm_running_t;
62
63 extern optimization_state_t libFIRM_opt, libFIRM_running, libFIRM_verb;
64 extern firm_verification_t opt_do_node_verification;
65
66 extern int firm_verbosity_level;
67
68 /** initialises the flags */
69 void firm_init_flags(void);
70
71 /* generate the getter functions for external access */
72 #define E_FLAG(name, value, def)                    \
73 static INLINE int _get_opt_##name(void) {           \
74   return libFIRM_opt & irf_##name;                  \
75 }                                                   \
76 static INLINE int get_opt_##name##_verbose(void) {  \
77   return libFIRM_verb & irf_##name;                 \
78 }
79
80 /* generate the getter functions for internal access */
81 #define I_FLAG(name, value, def)                   \
82 static INLINE int get_opt_##name(void) {           \
83   return libFIRM_opt & irf_##name;                 \
84 }                                                  \
85 static INLINE int get_opt_##name##_verbose(void) { \
86   return libFIRM_verb & irf_##name;                \
87 }
88
89 /* generate getter and setter functions for running flags */
90 #define R_FLAG(name, value)                        \
91 static INLINE int is_##name##_running(void) {      \
92   return libFIRM_running & ir_rf_##name;           \
93 }                                                  \
94 static INLINE void set_##name##_running(int flag) {\
95   if (flag) libFIRM_running |= ir_rf_##name;       \
96   else      libFIRM_running &= ~ir_rf_##name;      \
97 }
98
99 #include "irflag_t.def"
100
101 #undef I_FLAG
102 #undef E_FLAG
103 #undef R_FLAG
104
105 static INLINE int _get_firm_verbosity(void) {
106         return firm_verbosity_level;
107 }
108
109 static INLINE int _get_optimize(void) {
110         return get_opt_optimize();
111 }
112
113 static INLINE firm_verification_t
114 get_node_verification_mode(void) {
115         return opt_do_node_verification;
116 }
117
118 #define get_optimize()                           _get_optimize()
119 #define get_opt_cse()                            _get_opt_cse()
120 #define get_firm_verbosity()                     _get_firm_verbosity()
121 #define get_opt_dyn_meth_dispatch()              _get_opt_dyn_meth_dispatch()
122 #define get_opt_optimize_class_casts()           _get_opt_optimize_class_casts()
123 #define get_opt_suppress_downcast_optimization() _get_opt_suppress_downcast_optimization()
124
125 extern void firm_init_flags(void);
126
127 #endif