Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
920031da
Commit
920031da
authored
Sep 24, 2003
by
Götz Lindenmaier
Browse files
added new field for behaviour of shift instructions
[r1863]
parent
efb7c715
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/ir/irgraph.h
View file @
920031da
...
...
@@ -144,9 +144,11 @@ ir_node *get_irg_cstore (ir_graph *irg);
void
set_irg_cstore
(
ir_graph
*
irg
,
ir_node
*
node
);
/* end oblivious */
/* node that represents frame pointer */
ir_node
*
get_irg_frame
(
ir_graph
*
irg
);
void
set_irg_frame
(
ir_graph
*
irg
,
ir_node
*
node
);
/* node that represents global pointer */
ir_node
*
get_irg_globals
(
ir_graph
*
irg
);
void
set_irg_globals
(
ir_graph
*
irg
,
ir_node
*
node
);
...
...
ir/ir/irmode.c
View file @
920031da
...
...
@@ -56,9 +56,13 @@ static int num_modes;
INLINE
static
int
modes_are_equal
(
const
ir_mode
*
m
,
const
ir_mode
*
n
)
{
if
(
m
==
n
)
return
1
;
if
(
m
->
sort
==
n
->
sort
&&
m
->
arithmetic
==
n
->
arithmetic
&&
m
->
size
==
n
->
size
&&
m
->
align
==
n
->
align
&&
m
->
sign
==
n
->
sign
)
if
(
m
->
sort
==
n
->
sort
&&
m
->
arithmetic
==
n
->
arithmetic
&&
m
->
size
==
n
->
size
&&
m
->
align
==
n
->
align
&&
m
->
sign
==
n
->
sign
&&
m
->
modulo_shift
==
n
->
modulo_shift
)
return
1
;
// if (0 == memcmp(&m->sort, &n->sort, offsetof(ir_mode,min) - offsetof(ir_mode,sort))) return 1;
return
0
;
}
...
...
@@ -228,19 +232,21 @@ static ir_mode *register_mode(const ir_mode* new_mode)
/*
* Creates a new mode.
*/
ir_mode
*
new_ir_mode
(
const
char
*
name
,
mode_sort
sort
,
int
bit_size
,
int
align
,
int
sign
,
mode_arithmetic
arithmetic
)
ir_mode
*
new_ir_mode
(
const
char
*
name
,
mode_sort
sort
,
int
bit_size
,
int
align
,
int
sign
,
mode_arithmetic
arithmetic
,
unsigned
int
modulo_shift
)
{
ir_mode
mode_tmpl
;
ir_mode
*
mode
;
mode_tmpl
.
name
=
new_id_from_str
(
name
);
mode_tmpl
.
sort
=
sort
;
mode_tmpl
.
size
=
bit_size
;
mode_tmpl
.
align
=
align
;
mode_tmpl
.
sign
=
sign
?
1
:
0
;
mode_tmpl
.
arithmetic
=
arithmetic
;
mode_tmpl
.
link
=
NULL
;
mode_tmpl
.
tv_priv
=
NULL
;
mode_tmpl
.
name
=
new_id_from_str
(
name
);
mode_tmpl
.
sort
=
sort
;
mode_tmpl
.
size
=
bit_size
;
mode_tmpl
.
align
=
align
;
mode_tmpl
.
sign
=
sign
?
1
:
0
;
mode_tmpl
.
modulo_shift
=
(
mode_tmpl
.
sort
==
irms_int_number
)
?
modulo_shift
:
0
;
mode_tmpl
.
arithmetic
=
arithmetic
;
mode_tmpl
.
link
=
NULL
;
mode_tmpl
.
tv_priv
=
NULL
;
mode
=
find_mode
(
&
mode_tmpl
);
if
(
mode
)
...
...
@@ -333,6 +339,15 @@ int get_mode_arithmetic (const ir_mode *mode)
return
mode
->
arithmetic
;
}
/* Attribute modulo shift specifies for modes of kind irms_int_number
* whether shift applies modulo to value of bits to shift. Asserts
* if mode is not irms_int_number.
*/
unsinged
int
get_mode_modulo_shift
(
const
ir_mode
*
mode
)
{
return
mode
->
modulo_shift
;
}
void
*
get_mode_link
(
const
ir_mode
*
mode
)
{
ANNOUNCE
();
...
...
@@ -633,12 +648,13 @@ init_mode (void)
/* initialize predefined modes */
/* Internal Modes */
newmode
.
arithmetic
=
irma_none
;
newmode
.
size
=
0
;
newmode
.
align
=
0
;
newmode
.
sign
=
0
;
newmode
.
link
=
NULL
;
newmode
.
tv_priv
=
NULL
;
newmode
.
arithmetic
=
irma_none
;
newmode
.
size
=
0
;
newmode
.
align
=
0
;
newmode
.
sign
=
0
;
newmode
.
modulo_shift
=
0
;
newmode
.
link
=
NULL
;
newmode
.
tv_priv
=
NULL
;
/* Control Flow Modes*/
newmode
.
sort
=
irms_control_flow
;
...
...
@@ -737,6 +753,7 @@ init_mode (void)
newmode
.
sign
=
1
;
newmode
.
align
=
1
;
newmode
.
size
=
8
;
newmode
.
modulo_shift
=
32
;
mode_Bs
=
register_mode
(
&
newmode
);
...
...
@@ -747,6 +764,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
1
;
newmode
.
size
=
8
;
newmode
.
modulo_shift
=
32
;
mode_Bu
=
register_mode
(
&
newmode
);
...
...
@@ -756,6 +774,7 @@ init_mode (void)
newmode
.
sign
=
1
;
newmode
.
align
=
2
;
newmode
.
size
=
16
;
newmode
.
modulo_shift
=
32
;
mode_Hs
=
register_mode
(
&
newmode
);
...
...
@@ -765,6 +784,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
2
;
newmode
.
size
=
16
;
newmode
.
modulo_shift
=
32
;
mode_Hu
=
register_mode
(
&
newmode
);
...
...
@@ -774,6 +794,7 @@ init_mode (void)
newmode
.
sign
=
1
;
newmode
.
align
=
4
;
newmode
.
size
=
32
;
newmode
.
modulo_shift
=
32
;
mode_Is
=
register_mode
(
&
newmode
);
...
...
@@ -783,6 +804,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
4
;
newmode
.
size
=
32
;
newmode
.
modulo_shift
=
32
;
mode_Iu
=
register_mode
(
&
newmode
);
...
...
@@ -792,6 +814,7 @@ init_mode (void)
newmode
.
sign
=
1
;
newmode
.
align
=
4
;
newmode
.
size
=
64
;
newmode
.
modulo_shift
=
64
;
mode_Ls
=
register_mode
(
&
newmode
);
...
...
@@ -801,6 +824,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
4
;
newmode
.
size
=
64
;
newmode
.
modulo_shift
=
64
;
mode_Lu
=
register_mode
(
&
newmode
);
...
...
@@ -814,6 +838,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
1
;
newmode
.
size
=
8
;
newmode
.
modulo_shift
=
32
;
mode_C
=
register_mode
(
&
newmode
);
...
...
@@ -823,6 +848,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
2
;
newmode
.
size
=
16
;
newmode
.
modulo_shift
=
32
;
mode_U
=
register_mode
(
&
newmode
);
...
...
@@ -836,6 +862,7 @@ init_mode (void)
newmode
.
sign
=
0
;
newmode
.
align
=
4
;
newmode
.
size
=
32
;
newmode
.
modulo_shift
=
0
;
mode_P
=
register_mode
(
&
newmode
);
...
...
ir/ir/irmode.h
View file @
920031da
...
...
@@ -51,6 +51,8 @@
* - int align: byte alignment
* - 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
...
...
@@ -141,6 +143,7 @@ typedef enum {
* @param align the byte alignment for an entity of this mode (in bits)
* @param sign non-zero if this is a signed mode
* @param arithmetic arithmetic operations possible with a mode
* @param modulo_shift Is ignored for modes other than integer.
*
* This function constructs a new mode given by the parameters.
* If the parameters match an already defined mode, this mode is returned
...
...
@@ -154,9 +157,10 @@ typedef enum {
*
* @note
* It is allowed to construct the default modes. So, a call
* new_ir_mode("Is", irms_int_number, 32, 4, 1) will return mode_Is.
* new_ir_mode("Is", irms_int_number, 32, 4, 1
, 32
) will return mode_Is.
*/
ir_mode
*
new_ir_mode
(
const
char
*
name
,
mode_sort
sort
,
int
bit_size
,
int
align
,
int
sign
,
mode_arithmetic
arithmetic
);
ir_mode
*
new_ir_mode
(
const
char
*
name
,
mode_sort
sort
,
int
bit_size
,
int
align
,
int
sign
,
mode_arithmetic
arithmetic
,
unsigned
int
modulo_shift
);
/**
* Checks whether a pointer points to a mode.
...
...
@@ -198,6 +202,13 @@ int get_mode_sign (const ir_mode *mode);
/** Returns the arithmetic of a mode */
int
get_mode_arithmetic
(
const
ir_mode
*
mode
);
/** Attribute modulo shift specifies for modes of kind irms_int_number
* whether shift applies modulo to value of bits to shift. Zero for
* modes that are not integer.
*/
unsinged
int
get_mode_modulo_shift
(
const
ir_mode
*
mode
);
/** Returns the stored intermediate information. */
void
*
get_mode_link
(
const
ir_mode
*
mode
);
...
...
ir/ir/irmode_t.h
View file @
920031da
...
...
@@ -28,7 +28,7 @@ struct ir_mode {
ident
*
name
;
/**< Name ident of this mode */
/* ----------------------------------------------------------------------- */
/* On changing this struct you have to valuate the mode_are_equal function!*/
/* On changing this struct you have to
e
valuate the mode_are_equal function!*/
mode_sort
sort
;
/**< coarse classification of this mode:
int, float, reference ...
(see irmode.h) */
...
...
@@ -36,6 +36,7 @@ struct ir_mode {
int
size
;
/**< size of the mode in Bits. */
int
align
;
/**< byte alignment */
unsigned
sign
:
1
;
/**< signedness of this mode */
unsigned
int
modulo_shift
;
/* ----------------------------------------------------------------------- */
tarval
*
min
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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