-
-# ifndef _IRMODE_T_H_
-# define _IRMODE_T_H_
-
-# include "irmode.h"
-# include "tv.h"
-
-/** This struct is supposed to completely define a mode. **/
-struct ir_mode {
- firm_kind kind; /**< distinguishes this node from others */
- modecode code; /**< unambiguous identifier of a mode */
- ident *name; /**< Name ident of this mode */
-
- /* ----------------------------------------------------------------------- */
- /* On changing this struct you have to evaluate the mode_are_equal function!*/
- mode_sort sort; /**< coarse classification of this mode:
- int, float, reference ...
- (see irmode.h) */
- mode_arithmetic arithmetic; /**< different arithmetic operations possible with a mode */
- int size; /**< size of the mode in Bits. */
- unsigned sign:1; /**< signedness of this mode */
- unsigned int modulo_shift; /**< number of bits a valus of this mode will be shifted */
- unsigned vector_elem; /**< if this is not equal 1, this is a vector mode with
- vector_elem number of elements, size contains the size
- of all bits and must be dividable by vector_elem */
-
- /* ----------------------------------------------------------------------- */
- tarval *min; /**< the minimum value that can be expressed */
- tarval *max; /**< the maximum value that can be expressed */
- tarval *null; /**< the value 0 */
- tarval *one; /**< the value 1 */
- void *link; /**< To store some intermediate information */
- const void *tv_priv; /**< tarval module will save private data here */
-};
-
-
-/* ------------------------------- *
- * inline functions *
- * ------------------------------- */
-extern ir_mode *mode_P_mach;
-
-static INLINE ir_mode *
-__get_modeP_mach(void) { return mode_P_mach; }
-
-static INLINE void
-__set_modeP_mach(ir_mode *p) {
- assert(mode_is_reference(p));
- mode_P_mach = p;
+#ifndef FIRM_IR_IRMODE_T_H
+#define FIRM_IR_IRMODE_T_H
+
+#include <assert.h>
+#include "irtypes.h"
+#include "irmode.h"
+
+#define get_modeP_code() get_modeP_code_()
+#define get_modeP_data() get_modeP_data_()
+#define get_mode_ident(mode) get_mode_ident_(mode)
+#define get_mode_sort(mode) get_mode_sort_(mode)
+#define get_mode_size_bits(mode) get_mode_size_bits_(mode)
+#define get_mode_size_bytes(mode) get_mode_size_bytes_(mode)
+#define get_mode_sign(mode) get_mode_sign_(mode)
+#define get_mode_arithmetic(mode) get_mode_arithmetic_(mode)
+#define get_mode_modulo_shift(mode) get_mode_modulo_shift_(mode)
+#define get_mode_link(mode) get_mode_link_(mode)
+#define set_mode_link(mode, l) set_mode_link_(mode, l)
+#define mode_is_signed(mode) mode_is_signed_(mode)
+#define mode_is_float(mode) mode_is_float_(mode)
+#define mode_is_int(mode) mode_is_int_(mode)
+#define mode_is_reference(mode) mode_is_reference_(mode)
+#define mode_is_num(mode) mode_is_num_(mode)
+#define mode_is_data(mode) mode_is_data_(mode)
+#define mode_is_datab(mode) mode_is_datab_(mode)
+#define mode_is_dataM(mode) mode_is_dataM_(mode)
+#define get_type_for_mode(mode) get_type_for_mode_(mode)
+#define get_mode_mantissa_size(mode) get_mode_mantissa_size_(mode)
+#define get_mode_exponent_size(mode) get_mode_exponent_size_(mode)
+
+static inline ir_mode *get_modeP_code_(void) { return mode_P_code; }
+
+static inline ir_mode *get_modeP_data_(void) { return mode_P_data; }
+
+static inline ident *get_mode_ident_(const ir_mode *mode) { return mode->name; }
+
+static inline ir_mode_sort get_mode_sort_(const ir_mode *mode) { return mode->sort; }
+
+static inline unsigned get_mode_size_bits_(const ir_mode *mode) { return mode->size; }
+
+static inline unsigned get_mode_size_bytes_(const ir_mode *mode)
+{
+ unsigned size = get_mode_size_bits_(mode);
+ if ((size & 7) != 0) return (unsigned) -1;
+ return size >> 3;