inline version of small functions added
[libfirm] / ir / tv / tv_t.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/tv/tv_t.h
4  * Purpose:     Representation of and static computations on target machine
5  *              values -- private header.
6  * Author:      Mathias Heil
7  * Modified by:
8  * Created:
9  * CVS-ID:      $Id$
10  * Copyright:   (c) 2003 Universität Karlsruhe
11  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
12  */
13 #ifndef _TV_T_H_
14 #define _TV_T_H_
15
16 #include "firm_config.h"
17 #include "entity.h"
18 #include "irmode.h"
19 #include "tv.h"
20
21 /**
22  * Initialization of the tarval module.
23  *
24  * Call before init_mode().
25  */
26 void init_tarval_1(void);
27
28 /**
29  * Initialization of the tarval module.
30  *
31  * Call after init_mode().
32  */
33 void init_tarval_2(void);
34
35 /**
36  * Free all memory occupied by the tarval module.
37  */
38 void finish_tarval(void);
39
40 /**
41  * This struct represents the afore mentioned tarvals.
42  *
43  * A tarval struct consists of an internal representation of the
44  * value and some additional fields further describing the value.
45  *
46  * ATTRIBUTES:
47  *   - ir_mode *mode     The mode of the stored value
48  *   - void *value       The internal representation
49  *
50  * @sa
51  *   irmode.h for predefined modes
52  */
53 struct tarval {
54   ir_mode *mode;          /**< the mode of the stored value */
55   const void *value;      /**< the value stored in an internal way... */
56   unsigned int length;    /**< the length of the stored value */
57 };
58
59 /** remove tarval representing an entity that is about to be destroyed */
60 void free_tarval_entity(entity *ent);
61
62 /* inline functions */
63 /*
64  * Access routines for tarval fields ========================================
65  */
66 static INLINE ir_mode *
67 _get_tarval_mode(const tarval *tv) {
68   assert(tv);
69   return tv->mode;
70 }
71
72 static INLINE tarval *
73 _get_tarval_bad(void) {
74   return tarval_bad;
75 }
76
77 static INLINE tarval *
78 _get_tarval_undefined(void) {
79   return tarval_undefined;
80 }
81
82 static INLINE tarval *
83 _get_tarval_b_false(void) {
84   return tarval_b_false;
85 }
86
87 static INLINE tarval *
88 _get_tarval_b_true(void) {
89   return tarval_b_true;
90 }
91
92 static INLINE tarval *
93 _get_tarval_P_void(void) {
94   return tarval_P_void;
95 }
96
97 #define get_tarval_mode(tv)     _get_tarval_mode(tv)
98 #define get_tarval_bad()        _get_tarval_bad()
99 #define get_tarval_undefined()  _get_tarval_undefined()
100 #define get_tarval_b_false()    _get_tarval_b_false()
101 #define get_tarval_b_true()     _get_tarval_b_true()
102 #define get_tarval_P_void()     _get_tarval_P_void()
103
104 #endif /* _TV_T_H_ */