2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Representation of and static computations on target machine
9 * values -- private header.
11 * @author Mathias Heil
13 #ifndef FIRM_TV_TV_T_H
14 #define FIRM_TV_TV_T_H
16 #include "firm_common.h"
23 * Initialization of the tarval module.
25 * Call before init_mode().
28 * The reference mode NULL value, typical 0l
29 * @param support_quad_precision
30 * If non-zero, activate support for quad precision
32 void init_tarval_1(long null_value, int support_quad_precision);
35 * Initialization of the tarval module.
37 * Call after init_mode().
39 void init_tarval_2(void);
42 * Free all memory occupied by the tarval module.
44 void finish_tarval(void);
47 * This struct represents the afore mentioned tarvals.
49 * A tarval struct consists of an internal representation of the
50 * value and some additional fields further describing the value.
53 * - ir_mode *mode The mode of the stored value
54 * - void *value The internal representation
57 * irmode.h for predefined modes
60 firm_kind kind; /**< must be k_tarval */
61 ir_mode *mode; /**< the mode of the stored value */
62 const void *value; /**< the value stored in an internal way... */
63 size_t length; /**< the length of the stored value */
66 /* inline functions */
68 * Access routines for tarval fields ========================================
70 static inline ir_mode *_get_tarval_mode(const ir_tarval *tv)
76 static inline ir_tarval *_get_tarval_bad(void)
81 static inline ir_tarval *_get_tarval_undefined(void)
83 return tarval_undefined;
86 static inline ir_tarval *_get_tarval_b_false(void)
88 return tarval_b_false;
91 static inline ir_tarval *_get_tarval_b_true(void)
96 static inline ir_tarval *_get_tarval_reachable(void)
98 return tarval_reachable;
101 static inline ir_tarval *_get_tarval_unreachable(void)
103 return tarval_unreachable;
106 static inline int _is_tarval(const void *thing)
108 return get_kind(thing) == k_tarval;
111 #define get_tarval_mode(tv) _get_tarval_mode(tv)
112 #define get_tarval_bad() _get_tarval_bad()
113 #define get_tarval_undefined() _get_tarval_undefined()
114 #define get_tarval_b_false() _get_tarval_b_false()
115 #define get_tarval_b_true() _get_tarval_b_true()
116 #define get_tarval_unreachable() _get_tarval_unreachable()
117 #define get_tarval_reachable() _get_tarval_reachable()
118 #define is_tarval(thing) _is_tarval(thing)
120 #endif /* FIRM_TV_TV_T_H */