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 Representation of and static computations on target machine
23 * values -- private header.
25 * @author Mathias Heil
28 #ifndef FIRM_TV_TV_T_H
29 #define FIRM_TV_TV_T_H
31 #include "firm_common.h"
37 /** Debugging aid for the firmEvaluator: Marks for reserved tarvals values. */
39 resid_tarval_bad = 1, /**< tarval_bad marker. */
40 resid_tarval_undefined = 2, /**< tarval_undefined marker. */
41 resid_tarval_b_false = 3, /**< tarval_b_false marker. */
42 resid_tarval_b_true = 4, /**< tarval_b_true marker. */
43 resid_tarval_unreachable = 5, /**< tarval_unreachable marker. */
44 resid_tarval_reachable = 6 /**< tarval_reachable marker. */
48 * Initialization of the tarval module.
50 * Call before init_mode().
53 * The reference mode NULL value, typical 0l
54 * @param support_quad_precision
55 * If non-zero, activate support for quad precision
57 void init_tarval_1(long null_value, int support_quad_precision);
60 * Initialization of the tarval module.
62 * Call after init_mode().
64 void init_tarval_2(void);
67 * Free all memory occupied by the tarval module.
69 void finish_tarval(void);
72 * This struct represents the afore mentioned tarvals.
74 * A tarval struct consists of an internal representation of the
75 * value and some additional fields further describing the value.
78 * - ir_mode *mode The mode of the stored value
79 * - void *value The internal representation
82 * irmode.h for predefined modes
85 firm_kind kind; /**< must be k_tarval */
86 ir_mode *mode; /**< the mode of the stored value */
87 const void *value; /**< the value stored in an internal way... */
88 unsigned int length; /**< the length of the stored value */
91 /* inline functions */
93 * Access routines for tarval fields ========================================
95 static INLINE ir_mode *
96 _get_tarval_mode(const tarval *tv) {
101 static INLINE tarval *
102 _get_tarval_bad(void) {
106 static INLINE tarval *
107 _get_tarval_undefined(void) {
108 return tarval_undefined;
111 static INLINE tarval *
112 _get_tarval_b_false(void) {
113 return tarval_b_false;
116 static INLINE tarval *
117 _get_tarval_b_true(void) {
118 return tarval_b_true;
121 static INLINE tarval *
122 _get_tarval_reachable(void) {
123 return tarval_reachable;
126 static INLINE tarval *
127 _get_tarval_unreachable(void) {
128 return tarval_unreachable;
132 _is_tarval(const void *thing) {
133 return get_kind(thing) == k_tarval;
136 #define get_tarval_mode(tv) _get_tarval_mode(tv)
137 #define get_tarval_bad() _get_tarval_bad()
138 #define get_tarval_undefined() _get_tarval_undefined()
139 #define get_tarval_b_false() _get_tarval_b_false()
140 #define get_tarval_b_true() _get_tarval_b_true()
141 #define get_tarval_unreachable() _get_tarval_unreachable()
142 #define get_tarval_reachable() _get_tarval_reachable()
143 #define get_tarval_P_void() _get_tarval_P_void()
144 #define is_tarval(thing) _is_tarval(thing)
146 #endif /* FIRM_TV_TV_T_H */