added new licence header
[libfirm] / ir / ir / irflag_t.h
1 /*
2  * Copyright (C) 1995-2007 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  * Project:     libFIRM
22  * File name:   ir/ir/irgraph.c
23  * Purpose:     Flags to control optimizations, inline implementation.
24  * Author:      Michael Beck
25  * Created:
26  * CVS-ID:      $Id$
27  * Copyright:   (c) 1998-2004 Universität Karlsruhe
28  */
29
30 /**
31  * @file irflag_t.h
32  *
33  * Inline implementation of Optimization flags.
34  *
35  * @author Michael Beck
36  */
37 #ifndef _IRFLAG_T_H_
38 #define _IRFLAG_T_H_
39
40 #include "irflag.h"
41
42 /**
43  * current libFIRM optimizations
44  */
45 typedef enum {
46 #define E_FLAG(name, value, def)        irf_##name = (1 << value),
47 #define I_FLAG(name, value, def)        irf_##name = (1 << value),
48
49 #include "irflag_t.def"
50         irf_last
51 #undef I_FLAG
52 #undef E_FLAG
53 } libfirm_opts_t;
54
55 extern optimization_state_t libFIRM_opt;
56 extern optimization_state_t libFIRM_verb;
57 extern firm_verification_t opt_do_node_verification;
58
59 extern int firm_verbosity_level;
60
61 /** initialises the flags */
62 void firm_init_flags(void);
63
64 /* generate the getter functions for external access */
65 #define E_FLAG(name, value, def)                    \
66 static INLINE int _get_opt_##name(void) {           \
67   return libFIRM_opt & irf_##name;                  \
68 }                                                   \
69 static INLINE int get_opt_##name##_verbose(void) {  \
70   return libFIRM_verb & irf_##name;                 \
71 }
72
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;                 \
77 }                                                  \
78 static INLINE int get_opt_##name##_verbose(void) { \
79   return libFIRM_verb & irf_##name;                \
80 }
81
82 #include "irflag_t.def"
83
84 #undef I_FLAG
85 #undef E_FLAG
86
87 static INLINE int _get_firm_verbosity (void) {
88         return firm_verbosity_level;
89 }
90
91 static INLINE int _get_optimize (void) {
92   return get_opt_optimize();
93 }
94
95 static INLINE firm_verification_t
96 get_node_verification_mode(void) {
97   return opt_do_node_verification;
98 }
99
100 #define get_optimize()                           _get_optimize()
101 #define get_opt_cse()                            _get_opt_cse()
102 #define get_firm_verbosity()                     _get_firm_verbosity()
103 #define get_opt_dyn_meth_dispatch()              _get_opt_dyn_meth_dispatch()
104 #define get_opt_optimize_class_casts()           _get_opt_optimize_class_casts()
105 #define get_opt_suppress_downcast_optimization() _get_opt_suppress_downcast_optimization()
106
107 extern void firm_init_flags(void);
108
109 #endif /* _IRFLAG_T_H_ */