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
b639f25e
Commit
b639f25e
authored
May 16, 2006
by
Christian Würdig
Browse files
added support for 64bit Minus lowering
parent
0f054f6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/ia32_intrinsics.c
View file @
b639f25e
...
@@ -233,6 +233,35 @@ static int map_Mul(ir_node *call, void *ctx) {
...
@@ -233,6 +233,35 @@ static int map_Mul(ir_node *call, void *ctx) {
return
1
;
return
1
;
}
}
/**
* Map a Minus (a_l, a_h)
*/
static
int
map_Minus
(
ir_node
*
call
,
void
*
ctx
)
{
ir_graph
*
irg
=
current_ir_graph
;
dbg_info
*
dbg
=
get_irn_dbg_info
(
call
);
ir_node
*
block
=
get_nodes_block
(
call
);
ir_node
**
params
=
get_Call_param_arr
(
call
);
ir_type
*
method
=
get_Call_type
(
call
);
ir_node
*
a_l
=
params
[
BINOP_Left_Low
];
ir_node
*
a_h
=
params
[
BINOP_Left_High
];
ir_mode
*
l_res_mode
=
get_type_mode
(
get_method_res_type
(
method
,
0
));
ir_mode
*
h_res_mode
=
get_type_mode
(
get_method_res_type
(
method
,
1
));
ir_node
*
l_res
,
*
h_res
,
*
cnst
;
/* l_res = 0 - a_l */
l_res
=
new_rd_ia32_l_Minus
(
dbg
,
irg
,
block
,
a_l
,
l_res_mode
);
/* h_res = 0 - a_h - carry */
/* too bad: we need 0 in a register here */
cnst
=
new_Const_long
(
h_res_mode
,
0
);
h_res
=
new_rd_ia32_l_SubC
(
dbg
,
irg
,
block
,
cnst
,
a_h
,
h_res_mode
);
resolve_call
(
call
,
l_res
,
h_res
,
irg
,
block
);
return
1
;
}
/* Ia32 implementation of intrinsic mapping. */
/* Ia32 implementation of intrinsic mapping. */
entity
*
ia32_create_intrinsic_fkt
(
ir_type
*
method
,
const
ir_op
*
op
,
entity
*
ia32_create_intrinsic_fkt
(
ir_type
*
method
,
const
ir_op
*
op
,
const
ir_mode
*
imode
,
const
ir_mode
*
omode
,
const
ir_mode
*
imode
,
const
ir_mode
*
omode
,
...
...
ir/be/ia32/ia32_spec.pl
View file @
b639f25e
...
@@ -517,6 +517,11 @@ else {
...
@@ -517,6 +517,11 @@ else {
"
outs
"
=>
[
"
res
",
"
M
"
],
"
outs
"
=>
[
"
res
",
"
M
"
],
},
},
"
l_Minus
"
=>
{
"
comment
"
=>
"
construct lowered Minus: Minus(a) = -a
",
"
arity
"
=>
1
,
},
"
Inc
"
=>
{
"
Inc
"
=>
{
"
irn_flags
"
=>
"
R
",
"
irn_flags
"
=>
"
R
",
"
comment
"
=>
"
construct Increment: Inc(a) = a++
",
"
comment
"
=>
"
construct Increment: Inc(a) = a++
",
...
...
ir/be/ia32/ia32_transform.c
View file @
b639f25e
...
@@ -2264,12 +2264,17 @@ static ir_node *gen_Unknown(ia32_transform_env_t *env) {
...
@@ -2264,12 +2264,17 @@ static ir_node *gen_Unknown(ia32_transform_env_t *env) {
* @param env The transformation environment
* @param env The transformation environment
* @return the created ia32 XXX node
* @return the created ia32 XXX node
*/
*/
#define GEN_LOWERED_OP(op) \
#define GEN_LOWERED_OP(op)
\
static ir_node *gen_ia32_l_##op(ia32_transform_env_t *env) { \
static ir_node *gen_ia32_l_##op(ia32_transform_env_t *env) { \
return gen_binop(env, get_binop_left(env->irn), get_binop_right(env->irn), new_rd_ia32_##op); \
return gen_binop(env, get_binop_left(env->irn), get_binop_right(env->irn), new_rd_ia32_##op); \
} \
} \
#define GEN_LOWERED_SHIFT_OP(op) \
#define GEN_LOWERED_UNOP(op) \
static ir_node *gen_ia32_l_##op(ia32_transform_env_t *env) { \
return gen_unop(env, get_unop_op(env->irn), new_rd_ia32_##op); \
} \
#define GEN_LOWERED_SHIFT_OP(op) \
static ir_node *gen_ia32_l_##op(ia32_transform_env_t *env) { \
static ir_node *gen_ia32_l_##op(ia32_transform_env_t *env) { \
return gen_shift_binop(env, get_binop_left(env->irn), get_binop_right(env->irn), new_rd_ia32_##op); \
return gen_shift_binop(env, get_binop_left(env->irn), get_binop_right(env->irn), new_rd_ia32_##op); \
} \
} \
...
@@ -2280,6 +2285,8 @@ GEN_LOWERED_OP(SubC)
...
@@ -2280,6 +2285,8 @@ GEN_LOWERED_OP(SubC)
GEN_LOWERED_OP
(
Sub
)
GEN_LOWERED_OP
(
Sub
)
GEN_LOWERED_OP
(
Mul
)
GEN_LOWERED_OP
(
Mul
)
GEN_LOWERED_UNOP
(
Minus
)
/**
/**
* Transforms a l_MulS into a "real" MulS node.
* Transforms a l_MulS into a "real" MulS node.
*
*
...
@@ -2633,6 +2640,7 @@ void ia32_register_transformers(void) {
...
@@ -2633,6 +2640,7 @@ void ia32_register_transformers(void) {
GEN
(
ia32_l_AddC
);
GEN
(
ia32_l_AddC
);
GEN
(
ia32_l_Sub
);
GEN
(
ia32_l_Sub
);
GEN
(
ia32_l_SubC
);
GEN
(
ia32_l_SubC
);
GEN
(
ia32_l_Minus
);
GEN
(
ia32_l_Mul
);
GEN
(
ia32_l_Mul
);
GEN
(
ia32_l_MulS
);
GEN
(
ia32_l_MulS
);
GEN
(
ia32_l_Shl
);
GEN
(
ia32_l_Shl
);
...
...
Write
Preview
Markdown
is supported
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