libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
irmode.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
12 #ifndef FIRM_IR_IRMODE_H
13 #define FIRM_IR_IRMODE_H
14 
15 #include "firm_types.h"
16 #include "begin.h"
17 
18 #include <stddef.h>
19 
36 typedef enum ir_mode_arithmetic {
37  irma_none = 1,
42  irma_ieee754 = 256,
48 
60 
77 FIRM_API ir_mode *new_int_mode(const char *name,
78  ir_mode_arithmetic arithmetic,
79  unsigned bit_size, int sign,
80  unsigned modulo_shift);
81 
87 FIRM_API ir_mode *new_reference_mode(const char *name,
88  ir_mode_arithmetic arithmetic,
89  unsigned bit_size,
90  unsigned modulo_shift);
91 
103 FIRM_API ir_mode *new_float_mode(const char *name,
104  ir_mode_arithmetic arithmetic,
105  unsigned exponent_size,
106  unsigned mantissa_size,
108  int_conv_overflow);
109 
114 FIRM_API ir_mode *new_non_arithmetic_mode(const char *name, unsigned bit_size);
115 
117 FIRM_API ident *get_mode_ident(const ir_mode *mode);
118 
120 FIRM_API const char *get_mode_name(const ir_mode *mode);
121 
123 FIRM_API unsigned get_mode_size_bits(const ir_mode *mode);
124 
127 FIRM_API unsigned get_mode_size_bytes(const ir_mode *mode);
128 
130 FIRM_API ir_mode_arithmetic get_mode_arithmetic(const ir_mode *mode);
131 
138 FIRM_API unsigned int get_mode_modulo_shift(const ir_mode *mode);
139 
146 FIRM_API ir_tarval *get_mode_min(const ir_mode *mode);
147 
154 FIRM_API ir_tarval *get_mode_max(const ir_mode *mode);
155 
164 FIRM_API ir_tarval *get_mode_null(const ir_mode *mode);
165 
173 FIRM_API ir_tarval *get_mode_one(const ir_mode *mode);
174 
181 FIRM_API ir_tarval *get_mode_all_one(const ir_mode *mode);
182 
190 FIRM_API ir_tarval *get_mode_infinite(const ir_mode *mode);
191 
192 FIRM_API ir_mode *mode_M;
194 FIRM_API ir_mode *mode_F;
195 FIRM_API ir_mode *mode_D;
196 FIRM_API ir_mode *mode_Bs;
197 FIRM_API ir_mode *mode_Bu;
198 FIRM_API ir_mode *mode_Hs;
199 FIRM_API ir_mode *mode_Hu;
200 FIRM_API ir_mode *mode_Is;
201 FIRM_API ir_mode *mode_Iu;
202 FIRM_API ir_mode *mode_Ls;
203 FIRM_API ir_mode *mode_Lu;
204 FIRM_API ir_mode *mode_P;
217 FIRM_API ir_mode *mode_b;
218 
219 FIRM_API ir_mode *mode_X;
220 FIRM_API ir_mode *mode_BB;
222 FIRM_API ir_mode *mode_T;
223 FIRM_API ir_mode *mode_ANY;
224 FIRM_API ir_mode *mode_BAD;
227 FIRM_API ir_mode *get_modeF(void);
229 FIRM_API ir_mode *get_modeD(void);
231 FIRM_API ir_mode *get_modeBs(void);
233 FIRM_API ir_mode *get_modeBu(void);
235 FIRM_API ir_mode *get_modeHs(void);
237 FIRM_API ir_mode *get_modeHu(void);
239 FIRM_API ir_mode *get_modeIs(void);
241 FIRM_API ir_mode *get_modeIu(void);
243 FIRM_API ir_mode *get_modeLs(void);
245 FIRM_API ir_mode *get_modeLu(void);
247 FIRM_API ir_mode *get_modeP(void);
249 FIRM_API ir_mode *get_modeb(void);
251 FIRM_API ir_mode *get_modeX(void);
253 FIRM_API ir_mode *get_modeBB(void);
255 FIRM_API ir_mode *get_modeM(void);
257 FIRM_API ir_mode *get_modeT(void);
259 FIRM_API ir_mode *get_modeANY(void);
261 FIRM_API ir_mode *get_modeBAD(void);
262 
264 FIRM_API void set_modeP(ir_mode *p);
265 
267 FIRM_API int mode_is_signed(const ir_mode *mode);
268 
270 FIRM_API int mode_is_float(const ir_mode *mode);
271 
273 FIRM_API int mode_is_int(const ir_mode *mode);
274 
276 FIRM_API int mode_is_reference(const ir_mode *mode);
277 
283 FIRM_API int mode_is_num(const ir_mode *mode);
284 
291 FIRM_API int mode_is_data(const ir_mode *mode);
292 
304 FIRM_API int smaller_mode(const ir_mode *sm, const ir_mode *lm);
305 
316 FIRM_API int values_in_mode(const ir_mode *sm, const ir_mode *lm);
317 
322 FIRM_API ir_mode *find_unsigned_mode(const ir_mode *mode);
323 
328 FIRM_API ir_mode *find_signed_mode(const ir_mode *mode);
329 
334 FIRM_API ir_mode *find_double_bits_int_mode(const ir_mode *mode);
335 
341 FIRM_API int mode_has_signed_zero(const ir_mode *mode);
342 
346 FIRM_API int mode_overflow_on_unary_Minus(const ir_mode *mode);
347 
354 FIRM_API int mode_wrap_around(const ir_mode *mode);
355 
360 FIRM_API ir_mode *get_reference_offset_mode(const ir_mode *mode);
361 
365 FIRM_API void set_reference_offset_mode(ir_mode *ref_mode, ir_mode *int_mode);
366 
371 FIRM_API unsigned get_mode_mantissa_size(const ir_mode *mode);
372 
376 FIRM_API unsigned get_mode_exponent_size(const ir_mode *mode);
377 
382  const ir_mode *mode);
383 
389 FIRM_API int is_reinterpret_cast(const ir_mode *src, const ir_mode *dst);
390 
394 FIRM_API ir_type *get_type_for_mode(const ir_mode *mode);
395 
397 FIRM_API size_t ir_get_n_modes(void);
398 
400 FIRM_API ir_mode *ir_get_mode(size_t num);
401 
404 #include "end.h"
405 
406 #endif
ir_mode * get_modeX(void)
Returns control-flow mode.
ir_mode * mode_Bs
int8
Definition: irmode.h:196
ir_mode * mode_M
memory
Definition: irmode.h:192
ir_mode * get_modeANY(void)
Returns ANY mode.
struct ir_type ir_type
Type.
Definition: firm_types.h:71
ir_mode * new_int_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned bit_size, int sign, unsigned modulo_shift)
Creates a new mode.
ir_mode * find_signed_mode(const ir_mode *mode)
Returns a matching signed mode for a given integer unsigned mode.
ir_mode * mode_Bu
uint8
Definition: irmode.h:197
ir_mode * get_modeT(void)
Returns tuple mode.
ir_mode * get_reference_offset_mode(const ir_mode *mode)
Returns the integer equivalent mode for an reference mode.
ir_mode * mode_P
pointer
Definition: irmode.h:204
ir_mode * get_modeD(void)
Returns double mode.
int mode_is_float(const ir_mode *mode)
Returns 1 if mode is for floating point numbers, 0 otherwise.
ir_mode_arithmetic get_mode_arithmetic(const ir_mode *mode)
Returns the arithmetic of a mode.
unsigned get_mode_exponent_size(const ir_mode *mode)
Returns size of exponent in bits (for float modes)
ident * get_mode_ident(const ir_mode *mode)
Returns the ident* of the mode.
int mode_is_reference(const ir_mode *mode)
Returns 1 if mode is for references/pointers, 0 otherwise.
the integer indefinite value (=INT_MIN) is returned.
Definition: irmode.h:54
void set_reference_offset_mode(ir_mode *ref_mode, ir_mode *int_mode)
Sets the (signed) integer equivalent mode for an reference mode.
ir_mode * new_float_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned exponent_size, unsigned mantissa_size, float_int_conversion_overflow_style_t int_conv_overflow)
Create a new ieee754 float mode.
size_t ir_get_n_modes(void)
Returns number of known modes.
ir_mode * get_modeBs(void)
Returns byte signed mode.
int mode_wrap_around(const ir_mode *mode)
Returns non-zero if the mode has a reversed wrap-around logic, especially (a + x) - x == a...
ir_mode * mode_T
tuple (none)
Definition: irmode.h:222
unsigned get_mode_size_bytes(const ir_mode *mode)
Returns the size of values of the mode in bytes.
ir_tarval * get_mode_all_one(const ir_mode *mode)
Returns the value where all bits are One, represented in this mode.
ir_mode * get_modeIs(void)
Returns integer signed mode.
ir_mode * mode_Is
int32
Definition: irmode.h:200
ir_mode * get_modeBB(void)
Returns Basic-Block mode.
const char * get_mode_name(const ir_mode *mode)
Returns the null-terminated name of this mode.
float_int_conversion_overflow_style_t
Specifies what happens when a float value is converted to an integer and overflow happens...
Definition: irmode.h:53
ir_tarval * get_mode_min(const ir_mode *mode)
Returns the smallest representable value of a given mode.
ir_mode * new_reference_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned bit_size, unsigned modulo_shift)
Create a new reference mode.
ir_mode * get_modeF(void)
Returns float mode.
ir_mode * mode_BB
block
Definition: irmode.h:220
ir_mode * mode_Iu
uint32
Definition: irmode.h:201
ir_mode * mode_F
ieee754 binary32 float (single precision)
Definition: irmode.h:194
ir_mode * mode_BAD
bad mode
Definition: irmode.h:224
unsigned get_mode_size_bits(const ir_mode *mode)
Returns the size of values of the mode in bits.
ir_tarval * get_mode_null(const ir_mode *mode)
Returns the value Zero represented in this mode.
x86 extended floating point values
Definition: irmode.h:45
ir_mode * find_unsigned_mode(const ir_mode *mode)
Returns a matching unsigned mode for a given integer signed mode.
ir_mode * mode_ANY
undefined mode
Definition: irmode.h:223
ir_tarval * get_mode_infinite(const ir_mode *mode)
Returns a positive infinite value of a mode.
int mode_is_int(const ir_mode *mode)
Returns 1 if mode is for integer numbers, 0 otherwise.
ir_mode * find_double_bits_int_mode(const ir_mode *mode)
Returns an integer mode with 2*n bits for a given integer mode with n bits.
ir_mode * mode_X
execution
Definition: irmode.h:219
ir_mode * mode_Lu
uint64
Definition: irmode.h:203
Values of the mode are represented according to ieee754 floating point standard.
Definition: irmode.h:42
ir_type * get_type_for_mode(const ir_mode *mode)
Returns the primitive type matching the given mode.
ir_mode * ir_get_mode(size_t num)
Returns known mode number num.
float_int_conversion_overflow_style_t get_mode_float_int_overflow(const ir_mode *mode)
Returns semantic on float to integer conversion overflow.
int is_reinterpret_cast(const ir_mode *src, const ir_mode *dst)
Returns non-zero if the cast from mode src to mode dst is a reinterpret cast (i.e.
ir_mode * get_modeHs(void)
Returns halfword signed mode.
ir_mode * get_modeM(void)
Returns memory mode.
ir_mode * mode_D
ieee754 binary64 float (double precision)
Definition: irmode.h:195
unsigned get_mode_mantissa_size(const ir_mode *mode)
Returns size of bits used for to encode the mantissa (for float modes).
ir_mode * mode_Hs
int16
Definition: irmode.h:198
int mode_overflow_on_unary_Minus(const ir_mode *mode)
Returns non-zero if the given mode might overflow on unary Minus.
ir_mode * get_modeb(void)
Returns internal boolean mode.
struct ir_tarval ir_tarval
Target Machine Value.
Definition: firm_types.h:68
ir_mode * mode_b
This mode represents (parts of) the processor status flag queried in conditional jumps or predicated ...
Definition: irmode.h:217
int values_in_mode(const ir_mode *sm, const ir_mode *lm)
Returns true if no information is lost when converting a value of mode sm into mode lm (and back to m...
ir_mode * get_modeP(void)
Returns pointer mode.
ir_mode * get_modeLs(void)
Returns long signed mode.
For modes for which no representation is specified.
Definition: irmode.h:37
ir_mode * mode_Ls
int64
Definition: irmode.h:202
INT_MIN/INT_MAX is returned depending on the sign of the floatingpoint number.
Definition: irmode.h:56
int mode_is_data(const ir_mode *mode)
Returns 1 if mode is for data values, 0 otherwise.
int mode_is_signed(const ir_mode *mode)
Returns 1 if mode is signed, 0 otherwise.
int mode_is_num(const ir_mode *mode)
Returns 1 if mode is for numeric values, 0 otherwise.
unsigned int get_mode_modulo_shift(const ir_mode *mode)
Returns the modulo shift attribute.
void set_modeP(ir_mode *p)
Sets the machine specific pointer mode.
ir_mode * get_modeHu(void)
Returns halfword unsigned mode.
ir_mode * new_non_arithmetic_mode(const char *name, unsigned bit_size)
Creates a new mode for data values which are not used to perform arithmetic.
ir_mode * get_modeBAD(void)
Returns BAD mode.
struct ir_mode ir_mode
SSA Value mode.
Definition: firm_types.h:59
ir_tarval * get_mode_max(const ir_mode *mode)
Returns the biggest representable value of a given mode.
ir_mode * get_modeBu(void)
Returns byte unsigned mode.
int smaller_mode(const ir_mode *sm, const ir_mode *lm)
Returns true if a value of mode sm can be converted to mode lm without loss.
ir_mode * mode_Hu
uint16
Definition: irmode.h:199
const char ident
Identifier.
Definition: firm_types.h:50
int mode_has_signed_zero(const ir_mode *mode)
Returns non-zero if the given mode has negative zeros, i.e.
ir_mode_arithmetic
These values represent the different arithmetic operations possible with a mode.
Definition: irmode.h:36
Values of the mode are represented as two's complement.
Definition: irmode.h:39
ir_mode * get_modeIu(void)
Returns integer unsigned mode.
ir_mode * get_modeLu(void)
Returns long unsigned mode.
ir_tarval * get_mode_one(const ir_mode *mode)
Returns the value One, represented in this mode.