X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firmode_t.h;h=dce37f1d4ffc8dd8af09cdf2b54080d55ecbed94;hb=f600524c363556c785b85c0dff8792d04f73e252;hp=22670d5267592745a9b481b1f5c4ec17ebbcbc18;hpb=1ec30d95387eb392ba5a1adc7958ebd91383d59c;p=libfirm diff --git a/ir/ir/irmode_t.h b/ir/ir/irmode_t.h index 22670d526..dce37f1d4 100644 --- a/ir/ir/irmode_t.h +++ b/ir/ir/irmode_t.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -28,60 +28,8 @@ #define FIRM_IR_IRMODE_T_H #include +#include "irtypes.h" #include "irmode.h" -#include "tv.h" - -/** - * Contains relevant information about a mode. - * - * Necessary information about a mode is stored in this struct - * which is used by the tarval module to perform calculations - * and comparisons of values of a such described mode. - * - * ATTRIBUTES: - * - modecode code: An unambiguous int (enum) for the mode - * - ident *name: Name of this mode. Two modes are different if the name is different. - * - mode_sort sort: sort of mode specifying possible usage categories - * - int size: size of the mode in Bits. - * - unsigned sign:1: signedness of this mode - * - ... more to come - * - modulo_shift specifies for modes of kind irms_int_number - * whether shift applies modulo to value of bits to shift - * - * SEE ALSO: - * The tech report 1999-44 describing FIRM and predefined modes - * tarval.h - */ -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 values 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 */ - tarval *minus_one; /**< the value -1 */ - ir_mode *eq_signed; /**< For pointer modes, the equivalent signed integer one. */ - ir_mode *eq_unsigned; /**< For pointer modes, the equivalent unsigned integer one. */ - void *link; /**< To store some intermediate information */ - const void *tv_priv; /**< tarval module will save private data here */ -}; - /* ------------------------------- * * inline functions * @@ -103,20 +51,20 @@ _get_mode_ident(const ir_mode *mode) { return mode->name; } static INLINE mode_sort _get_mode_sort(const ir_mode* mode) { return mode->sort; } -static INLINE int +static INLINE unsigned _get_mode_size_bits(const ir_mode *mode) { return mode->size; } -static INLINE int +static INLINE unsigned _get_mode_size_bytes(const ir_mode *mode) { - int size = _get_mode_size_bits(mode); - if ((size & 7) != 0) return -1; + unsigned size = _get_mode_size_bits(mode); + if ((size & 7) != 0) return (unsigned) -1; return size >> 3; } static INLINE int _get_mode_sign(const ir_mode *mode) { return mode->sign; } -static INLINE int +static INLINE mode_arithmetic _get_mode_arithmetic(const ir_mode *mode) { return mode->arithmetic; } static INLINE unsigned int @@ -186,12 +134,6 @@ _mode_is_int(const ir_mode *mode) { return (_get_mode_sort(mode) == irms_int_number); } -static INLINE int -_mode_is_character(const ir_mode *mode) { - assert(mode); - return (_get_mode_sort(mode) == irms_character); -} - static INLINE int _mode_is_reference(const ir_mode *mode) { assert(mode); @@ -204,16 +146,9 @@ _mode_is_num(const ir_mode *mode) { return (_mode_is_int(mode) || _mode_is_float(mode)); } -static INLINE int -_mode_is_numP(const ir_mode *mode) { - assert(mode); - return (_mode_is_int(mode) || _mode_is_float(mode) || _mode_is_reference(mode)); -} - static INLINE int _mode_is_data(const ir_mode *mode) { - assert(mode); - return (_mode_is_numP(mode) || _get_mode_sort(mode) == irms_character); + return (_mode_is_int(mode) || _mode_is_float(mode) || _mode_is_reference(mode)); } static INLINE int @@ -262,10 +197,8 @@ void finish_mode(void); #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_character(mode) _mode_is_character(mode) #define mode_is_reference(mode) _mode_is_reference(mode) #define mode_is_num(mode) _mode_is_num(mode) -#define mode_is_numP(mode) _mode_is_numP(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)