Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
a3085c47
Commit
a3085c47
authored
Sep 07, 2015
by
Matthias Braun
Browse files
Move ir_mode struct from irtypes.h to irmode_t.h, cleanup
parent
6bc8ebef
Changes
5
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/ia32_architecture.c
View file @
a3085c47
...
...
@@ -9,6 +9,7 @@
* @author Michael Beck, Matthias Braun
*/
#include
<stdbool.h>
#include
<string.h>
#include
"irmode_t.h"
#include
"lc_opts.h"
...
...
ir/ir/irmode_t.h
View file @
a3085c47
...
...
@@ -12,9 +12,12 @@
#ifndef FIRM_IR_IRMODE_T_H
#define FIRM_IR_IRMODE_T_H
#include
"irtypes.h"
#include
"irmode.h"
#include
<stdbool.h>
#include
"compiler.h"
#include
"firm_common.h"
#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)
...
...
@@ -31,6 +34,65 @@
#define get_mode_mantissa_size(mode) get_mode_mantissa_size_(mode)
#define get_mode_exponent_size(mode) get_mode_exponent_size_(mode)
/** Helper values for ir_mode_sort. */
enum
ir_mode_sort_helper
{
irmsh_is_num
=
0x10
,
/**< mode represents a number */
irmsh_is_data
=
0x20
,
/**< mode represents data that can be in a register */
};
/**
* These values represent the different mode classes of value representations.
*/
typedef
enum
ir_mode_sort
{
irms_auxiliary
=
0
,
irms_internal_boolean
=
1
|
irmsh_is_data
,
irms_data
=
2
|
irmsh_is_data
,
irms_reference
=
3
|
irmsh_is_data
,
irms_int_number
=
4
|
irmsh_is_data
|
irmsh_is_num
,
irms_float_number
=
5
|
irmsh_is_data
|
irmsh_is_num
,
}
ir_mode_sort
;
/**
* A descriptor for an IEEE754 float value.
*/
typedef
struct
float_descriptor_t
{
unsigned
char
exponent_size
;
/**< size of exponent in bits */
unsigned
char
mantissa_size
;
/**< size of mantissa in bits */
bool
explicit_one
;
/**< set if the leading one is explicit */
}
float_descriptor_t
;
/**
* 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.
*/
struct
ir_mode
{
firm_kind
kind
;
/**< Distinguishes this thing from others */
ident
*
name
;
/**< Name ident of this mode */
ir_type
*
type
;
/**< Corresponding primitive type */
ir_mode_sort
sort
;
/**< Coarse classification of this mode */
ir_mode_arithmetic
arithmetic
;
/**< Class of possible arithmetic ops */
unsigned
size
;
/**< Size of the mode in Bits. */
bool
sign
:
1
;
/**< Whether mode has a sign bit. */
ENUMBF
(
float_int_conversion_overflow_style_t
)
int_conv_overflow:
1
;
/** For shift operations the effective shift amount will be calculated
* modulo this value. */
unsigned
modulo_shift
;
float_descriptor_t
float_desc
;
/**< Floatingpoint descriptor */
ir_tarval
*
min
;
/**< smallest representable (real) value */
ir_tarval
*
max
;
/**< biggest representable (real) value */
ir_tarval
*
null
;
/**< The value 0 */
ir_tarval
*
one
;
/**< The value 1 */
ir_tarval
*
all_one
;
/**< The value where all bits are set */
ir_tarval
*
infinity
;
/**< The (positive) infinity value */
/** For pointer modes, the equivalent unsigned integer one. */
ir_mode
*
eq_unsigned
;
};
static
inline
ident
*
get_mode_ident_
(
const
ir_mode
*
mode
)
{
return
mode
->
name
;
...
...
ir/ir/irtypes.h
View file @
a3085c47
...
...
@@ -34,88 +34,6 @@ struct ir_nodemap {
void
**
data
;
/**< maps node indices to void* */
};
/** Helper values for ir_mode_sort. */
enum
ir_mode_sort_helper
{
irmsh_is_num
=
0x10
,
/**< mode represents a number */
irmsh_is_data
=
0x20
,
/**< mode represents data (can be carried in registers) */
};
/**
* These values represent the different mode classes of value representations.
*/
typedef
enum
ir_mode_sort
{
irms_auxiliary
=
0
,
irms_internal_boolean
=
1
|
irmsh_is_data
,
irms_data
=
2
|
irmsh_is_data
,
/** A mode to represent entities.
Restricted int computations can be performed */
irms_reference
=
3
|
irmsh_is_data
,
/** A mode to represent int numbers.
Integer computations can be performed. */
irms_int_number
=
4
|
irmsh_is_data
|
irmsh_is_num
,
/** A mode to represent float numbers.
Floating point computations can be performed. */
irms_float_number
=
5
|
irmsh_is_data
|
irmsh_is_num
,
}
ir_mode_sort
;
/**
* A descriptor for an IEEE754 float value.
*/
typedef
struct
float_descriptor_t
{
unsigned
char
exponent_size
;
/**< size of exponent in bits */
unsigned
char
mantissa_size
;
/**< size of mantissa in bits */
bool
explicit_one
;
/**< set if the leading one is explicit */
}
float_descriptor_t
;
/**
* 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:
* - ident *name: Name of this mode. Two modes are different if the name is different.
* - ir_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 */
ident
*
name
;
/**< Name ident of this mode */
ir_type
*
type
;
/**< corresponding primitive type */
/* ---------------------------------------------------------------------- */
/* On changing this struct you have to evaluate the mode_are_equal function!*/
ir_mode_sort
sort
;
/**< coarse classification of this mode:
int, float, reference ...
(see irmode.h) */
ir_mode_arithmetic
arithmetic
;
/**< different arithmetic operations possible with a mode */
unsigned
size
;
/**< size of the mode in Bits. */
bool
sign
:
1
;
/**< signedness of this mode */
ENUMBF
(
float_int_conversion_overflow_style_t
)
int_conv_overflow:
1
;
unsigned
modulo_shift
;
/**< number of bits a values of this mode will be shifted */
float_descriptor_t
float_desc
;
/* ---------------------------------------------------------------------- */
ir_tarval
*
min
;
/**< the minimum value that can be expressed */
ir_tarval
*
max
;
/**< the maximum value that can be expressed */
ir_tarval
*
null
;
/**< the value 0 */
ir_tarval
*
one
;
/**< the value 1 */
ir_tarval
*
all_one
;
/**< the value ~0 */
ir_tarval
*
infinity
;
/**< the infinity value */
ir_mode
*
eq_unsigned
;
/**< For pointer modes, the equivalent unsigned integer one. */
};
/* note: we use "long" here because that is the type used for Proj-Numbers */
typedef
struct
ir_switch_table_entry
{
ir_tarval
*
min
;
...
...
ir/tv/fltcalc.h
View file @
a3085c47
...
...
@@ -13,7 +13,7 @@
#define FIRM_TV_FLTCALC_H
#include
<stdlib.h>
#include
"ir
types
.h"
#include
"ir
mode_t
.h"
#include
"strcalc.h"
typedef
enum
{
...
...
ir/tv/tv.c
View file @
a3085c47
...
...
@@ -24,6 +24,7 @@
#include
<strings.h>
#include
"bitfiddle.h"
#include
"hashptr.h"
#include
"tv_t.h"
#include
"set.h"
#include
"entity_t.h"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment