tv: remove unused reserved_id
[libfirm] / ir / tv / tv_t.h
1 /*
2  * Copyright (C) 1995-2011 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    Representation of and static computations on target machine
23  *           values -- private header.
24  * @date     2003
25  * @author   Mathias Heil
26  */
27 #ifndef FIRM_TV_TV_T_H
28 #define FIRM_TV_TV_T_H
29
30 #include "firm_common.h"
31
32 #include <assert.h>
33 #include "irmode.h"
34 #include "tv.h"
35
36 /**
37  * Initialization of the tarval module.
38  *
39  * Call before init_mode().
40  *
41  * @param null_value
42  *            The reference mode NULL value, typical 0l
43  * @param support_quad_precision
44  *            If non-zero, activate support for quad precision
45  */
46 void init_tarval_1(long null_value, int support_quad_precision);
47
48 /**
49  * Initialization of the tarval module.
50  *
51  * Call after init_mode().
52  */
53 void init_tarval_2(void);
54
55 /**
56  * Free all memory occupied by the tarval module.
57  */
58 void finish_tarval(void);
59
60 /**
61  * This struct represents the afore mentioned tarvals.
62  *
63  * A tarval struct consists of an internal representation of the
64  * value and some additional fields further describing the value.
65  *
66  * ATTRIBUTES:
67  *   - ir_mode *mode     The mode of the stored value
68  *   - void *value       The internal representation
69  *
70  * @sa
71  *   irmode.h for predefined modes
72  */
73 struct ir_tarval {
74         firm_kind  kind;    /**< must be k_tarval */
75         ir_mode    *mode;   /**< the mode of the stored value */
76         const void *value;  /**< the value stored in an internal way... */
77         size_t     length;  /**< the length of the stored value */
78 };
79
80 /* inline functions */
81 /*
82  * Access routines for tarval fields ========================================
83  */
84 static inline ir_mode *_get_tarval_mode(const ir_tarval *tv)
85 {
86         assert(tv);
87         return tv->mode;
88 }
89
90 static inline ir_tarval *_get_tarval_bad(void)
91 {
92         return tarval_bad;
93 }
94
95 static inline ir_tarval *_get_tarval_undefined(void)
96 {
97         return tarval_undefined;
98 }
99
100 static inline ir_tarval *_get_tarval_b_false(void)
101 {
102         return tarval_b_false;
103 }
104
105 static inline ir_tarval *_get_tarval_b_true(void)
106 {
107         return tarval_b_true;
108 }
109
110 static inline ir_tarval *_get_tarval_reachable(void)
111 {
112         return tarval_reachable;
113 }
114
115 static inline ir_tarval *_get_tarval_unreachable(void)
116 {
117         return tarval_unreachable;
118 }
119
120 static inline int _is_tarval(const void *thing)
121 {
122         return get_kind(thing) == k_tarval;
123 }
124
125 #define get_tarval_mode(tv)      _get_tarval_mode(tv)
126 #define get_tarval_bad()         _get_tarval_bad()
127 #define get_tarval_undefined()   _get_tarval_undefined()
128 #define get_tarval_b_false()     _get_tarval_b_false()
129 #define get_tarval_b_true()      _get_tarval_b_true()
130 #define get_tarval_unreachable() _get_tarval_unreachable()
131 #define get_tarval_reachable()   _get_tarval_reachable()
132 #define is_tarval(thing)         _is_tarval(thing)
133
134 #endif /* FIRM_TV_TV_T_H */