libFirm
Loading...
Searching...
No Matches
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 <stddef.h>
16#include "firm_types.h"
17
18#include "begin.h"
19
48
65FIRM_API ir_mode *new_int_mode(const char *name,
66 unsigned bit_size, int sign,
67 unsigned modulo_shift);
68
74FIRM_API ir_mode *new_reference_mode(const char *name,
75 unsigned bit_size,
76 unsigned modulo_shift);
77
89FIRM_API ir_mode *new_float_mode(const char *name,
90 ir_mode_arithmetic arithmetic,
91 unsigned exponent_size,
92 unsigned mantissa_size,
93 float_int_conversion_overflow_style_t
94 int_conv_overflow);
95
100FIRM_API ir_mode *new_non_arithmetic_mode(const char *name, unsigned bit_size);
101
103FIRM_API ident *get_mode_ident(const ir_mode *mode);
104
106FIRM_API const char *get_mode_name(const ir_mode *mode);
107
109FIRM_API unsigned get_mode_size_bits(const ir_mode *mode);
110
113FIRM_API unsigned get_mode_size_bytes(const ir_mode *mode);
114
117
124FIRM_API unsigned int get_mode_modulo_shift(const ir_mode *mode);
125
132FIRM_API ir_tarval *get_mode_min(const ir_mode *mode);
133
140FIRM_API ir_tarval *get_mode_max(const ir_mode *mode);
141
150FIRM_API ir_tarval *get_mode_null(const ir_mode *mode);
151
159FIRM_API ir_tarval *get_mode_one(const ir_mode *mode);
160
167FIRM_API ir_tarval *get_mode_all_one(const ir_mode *mode);
168
176FIRM_API ir_tarval *get_mode_infinite(const ir_mode *mode);
177
178FIRM_API ir_mode *mode_M;
180FIRM_API ir_mode *mode_F;
181FIRM_API ir_mode *mode_D;
182FIRM_API ir_mode *mode_Bs;
183FIRM_API ir_mode *mode_Bu;
184FIRM_API ir_mode *mode_Hs;
185FIRM_API ir_mode *mode_Hu;
186FIRM_API ir_mode *mode_Is;
187FIRM_API ir_mode *mode_Iu;
188FIRM_API ir_mode *mode_Ls;
189FIRM_API ir_mode *mode_Lu;
190FIRM_API ir_mode *mode_P;
203FIRM_API ir_mode *mode_b;
204
205FIRM_API ir_mode *mode_X;
206FIRM_API ir_mode *mode_BB;
208FIRM_API ir_mode *mode_T;
213FIRM_API ir_mode *get_modeF(void);
215FIRM_API ir_mode *get_modeD(void);
217FIRM_API ir_mode *get_modeBs(void);
219FIRM_API ir_mode *get_modeBu(void);
221FIRM_API ir_mode *get_modeHs(void);
223FIRM_API ir_mode *get_modeHu(void);
225FIRM_API ir_mode *get_modeIs(void);
227FIRM_API ir_mode *get_modeIu(void);
229FIRM_API ir_mode *get_modeLs(void);
231FIRM_API ir_mode *get_modeLu(void);
233FIRM_API ir_mode *get_modeP(void);
235FIRM_API ir_mode *get_modeb(void);
237FIRM_API ir_mode *get_modeX(void);
239FIRM_API ir_mode *get_modeBB(void);
241FIRM_API ir_mode *get_modeM(void);
243FIRM_API ir_mode *get_modeT(void);
245FIRM_API ir_mode *get_modeANY(void);
247FIRM_API ir_mode *get_modeBAD(void);
248
250FIRM_API void set_modeP(ir_mode *p);
251
253FIRM_API int mode_is_signed(const ir_mode *mode);
254
256FIRM_API int mode_is_float(const ir_mode *mode);
257
259FIRM_API int mode_is_int(const ir_mode *mode);
260
262FIRM_API int mode_is_reference(const ir_mode *mode);
263
269FIRM_API int mode_is_num(const ir_mode *mode);
270
277FIRM_API int mode_is_data(const ir_mode *mode);
278
290FIRM_API int smaller_mode(const ir_mode *sm, const ir_mode *lm);
291
302FIRM_API int values_in_mode(const ir_mode *sm, const ir_mode *lm);
303
308FIRM_API ir_mode *find_unsigned_mode(const ir_mode *mode);
309
314FIRM_API ir_mode *find_signed_mode(const ir_mode *mode);
315
321
327FIRM_API int mode_has_signed_zero(const ir_mode *mode);
328
332FIRM_API int mode_overflow_on_unary_Minus(const ir_mode *mode);
333
340FIRM_API int mode_wrap_around(const ir_mode *mode);
341
347
351FIRM_API void set_reference_offset_mode(ir_mode *ref_mode, ir_mode *int_mode);
352
357FIRM_API unsigned get_mode_mantissa_size(const ir_mode *mode);
358
362FIRM_API unsigned get_mode_exponent_size(const ir_mode *mode);
363
367FIRM_API float_int_conversion_overflow_style_t get_mode_float_int_overflow(
368 const ir_mode *mode);
369
375FIRM_API int is_reinterpret_cast(const ir_mode *src, const ir_mode *dst);
376
380FIRM_API ir_type *get_type_for_mode(const ir_mode *mode);
381
383FIRM_API size_t ir_get_n_modes(void);
384
386FIRM_API ir_mode *ir_get_mode(size_t num);
387
390#include "end.h"
391
392#endif
const char ident
Identifier.
Definition firm_types.h:50
int mode_is_signed(const ir_mode *mode)
Returns 1 if mode is signed, 0 otherwise.
ir_tarval * get_mode_null(const ir_mode *mode)
Returns the value Zero represented in this mode.
ir_mode * find_unsigned_mode(const ir_mode *mode)
Returns a matching unsigned mode for a given integer signed mode.
ir_mode * get_modeb(void)
Returns internal boolean mode.
ir_mode * mode_M
memory
Definition irmode.h:178
size_t ir_get_n_modes(void)
Returns number of known modes.
int mode_is_num(const ir_mode *mode)
Returns 1 if mode is for numeric values, 0 otherwise.
ir_mode * get_modeF(void)
Returns float mode.
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_tarval * get_mode_all_one(const ir_mode *mode)
Returns the value where all bits are One, represented in this mode.
ir_mode * mode_Bu
uint8
Definition irmode.h:183
ir_mode * mode_P
pointer
Definition irmode.h:190
ir_mode * mode_Ls
int64
Definition irmode.h:188
unsigned get_mode_size_bytes(const ir_mode *mode)
Returns the size of values of the mode in bytes.
ir_mode * get_modeBB(void)
Returns Basic-Block mode.
ir_mode * get_modeBAD(void)
Returns BAD mode.
ir_mode * get_modeM(void)
Returns memory mode.
int mode_has_signed_zero(const ir_mode *mode)
Returns non-zero if the given mode has negative zeros, i.e.
float_int_conversion_overflow_style_t get_mode_float_int_overflow(const ir_mode *mode)
Returns semantic on float to integer conversion overflow.
int mode_overflow_on_unary_Minus(const ir_mode *mode)
Returns non-zero if the given mode might overflow on unary Minus.
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 * 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.
ir_mode_arithmetic
These values represent the different arithmetic operations possible with a mode.
Definition irmode.h:36
int mode_is_int(const ir_mode *mode)
Returns 1 if mode is for integer numbers, 0 otherwise.
ir_mode * mode_Hs
int16
Definition irmode.h:184
ir_tarval * get_mode_min(const ir_mode *mode)
Returns the smallest representable value of a given mode.
ir_mode * mode_F
ieee754 binary32 float (single precision)
Definition irmode.h:180
unsigned get_mode_mantissa_size(const ir_mode *mode)
Returns size of bits used for to encode the mantissa (for float modes).
ir_tarval * get_mode_infinite(const ir_mode *mode)
Returns a positive infinite value of a mode.
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_ANY
undefined mode
Definition irmode.h:209
ir_mode * mode_BB
block
Definition irmode.h:206
unsigned get_mode_exponent_size(const ir_mode *mode)
Returns size of exponent in bits (for float modes)
ir_mode * get_modeANY(void)
Returns ANY mode.
ir_mode * new_reference_mode(const char *name, unsigned bit_size, unsigned modulo_shift)
Create a new reference mode.
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_Lu
uint64
Definition irmode.h:189
ir_mode * get_modeHu(void)
Returns halfword unsigned mode.
ir_mode * mode_X
execution
Definition irmode.h:205
ir_mode * mode_Bs
int8
Definition irmode.h:182
ir_mode * get_modeD(void)
Returns double mode.
const char * get_mode_name(const ir_mode *mode)
Returns the null-terminated name of this mode.
ir_type * get_type_for_mode(const ir_mode *mode)
Returns the primitive type matching the given mode.
ir_mode * mode_T
tuple (none)
Definition irmode.h:208
int mode_is_float(const ir_mode *mode)
Returns 1 if mode is for floating point numbers, 0 otherwise.
ir_tarval * get_mode_one(const ir_mode *mode)
Returns the value One, represented in this 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_modeP(void)
Returns pointer mode.
ir_mode * get_modeIs(void)
Returns integer signed mode.
struct ir_mode ir_mode
SSA Value mode.
Definition firm_types.h:59
void set_reference_offset_mode(ir_mode *ref_mode, ir_mode *int_mode)
Sets the (signed) integer equivalent mode for an reference mode.
int mode_is_reference(const ir_mode *mode)
Returns 1 if mode is for references/pointers, 0 otherwise.
ir_mode * get_modeLu(void)
Returns long unsigned mode.
ir_mode * mode_Iu
uint32
Definition irmode.h:187
ident * get_mode_ident(const ir_mode *mode)
Returns the ident* of the mode.
ir_mode * mode_b
This mode represents (parts of) the processor status flag queried in conditional jumps or predicated ...
Definition irmode.h:203
ir_mode * ir_get_mode(size_t num)
Returns known mode number num.
ir_tarval * get_mode_max(const ir_mode *mode)
Returns the biggest representable value of a given mode.
int mode_is_data(const ir_mode *mode)
Returns 1 if mode is for data values, 0 otherwise.
ir_mode * get_modeX(void)
Returns control-flow mode.
ir_mode * get_modeHs(void)
Returns halfword signed mode.
ir_mode * mode_Is
int32
Definition irmode.h:186
ir_mode * get_modeIu(void)
Returns integer unsigned mode.
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.
unsigned int get_mode_modulo_shift(const ir_mode *mode)
Returns the modulo shift attribute.
ir_mode * mode_BAD
bad mode
Definition irmode.h:210
ir_mode * mode_Hu
uint16
Definition irmode.h:185
ir_mode * get_modeBs(void)
Returns byte signed mode.
ir_mode * mode_D
ieee754 binary64 float (double precision)
Definition irmode.h:181
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_arithmetic get_mode_arithmetic(const ir_mode *mode)
Returns the arithmetic of a mode.
void set_modeP(ir_mode *p)
Sets the machine specific pointer mode.
ir_mode * get_modeLs(void)
Returns long signed mode.
ir_mode * get_modeBu(void)
Returns byte unsigned mode.
ir_mode * new_int_mode(const char *name, unsigned bit_size, int sign, unsigned modulo_shift)
Creates a new mode.
unsigned get_mode_size_bits(const ir_mode *mode)
Returns the size of values of the mode in bits.
ir_mode * find_signed_mode(const ir_mode *mode)
Returns a matching signed mode for a given integer unsigned mode.
@ irma_none
For modes for which no representation is specified.
Definition irmode.h:37
@ irma_x86_extended_float
x86 extended floating point values
Definition irmode.h:45
@ irma_ieee754
Values of the mode are represented according to ieee754 floating point standard.
Definition irmode.h:42
@ irma_last
Definition irmode.h:46
@ irma_twos_complement
Values of the mode are represented as two's complement.
Definition irmode.h:39
struct ir_tarval ir_tarval
Target Machine Value.
Definition firm_types.h:68
struct ir_type ir_type
Type.
Definition firm_types.h:71