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
f17bb2ac
Commit
f17bb2ac
authored
Mar 10, 2006
by
Christian Würdig
Browse files
fixed several bugs
parent
00aeb91b
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/bearch_ia32.c
View file @
f17bb2ac
...
...
@@ -344,13 +344,15 @@ static void ia32_before_ra(void *self) {
* Transforms a be node into a Load.
*/
static
void
transform_to_Load
(
ia32_transform_env_t
*
env
)
{
ir_node
*
irn
=
env
->
irn
;
entity
*
ent
=
be_get_frame_entity
(
irn
);
ir_mode
*
mode
=
env
->
mode
;
ir_node
*
noreg
=
ia32_new_NoReg_gp
(
env
->
cg
);
ir_node
*
nomem
=
new_rd_NoMem
(
env
->
irg
);
ir_node
*
new_op
,
*
proj
;
ir_node
*
irn
=
env
->
irn
;
entity
*
ent
=
be_get_frame_entity
(
irn
);
ir_mode
*
mode
=
env
->
mode
;
ir_node
*
noreg
=
ia32_new_NoReg_gp
(
env
->
cg
);
ir_node
*
nomem
=
new_rd_NoMem
(
env
->
irg
);
ir_node
*
sched_point
=
NULL
;
ir_node
*
ptr
=
get_irn_n
(
irn
,
0
);
ir_node
*
mem
=
be_is_Reload
(
irn
)
?
get_irn_n
(
irn
,
1
)
:
nomem
;
ir_node
*
new_op
,
*
proj
;
const
arch_register_t
*
reg
;
if
(
sched_is_scheduled
(
irn
))
{
...
...
@@ -358,10 +360,10 @@ static void transform_to_Load(ia32_transform_env_t *env) {
}
if
(
mode_is_float
(
mode
))
{
new_op
=
new_rd_ia32_fLoad
(
env
->
dbg
,
env
->
irg
,
env
->
block
,
get_irn_n
(
irn
,
0
)
,
noreg
,
no
mem
,
mode_T
);
new_op
=
new_rd_ia32_fLoad
(
env
->
dbg
,
env
->
irg
,
env
->
block
,
ptr
,
noreg
,
mem
,
mode_T
);
}
else
{
new_op
=
new_rd_ia32_Load
(
env
->
dbg
,
env
->
irg
,
env
->
block
,
get_irn_n
(
irn
,
0
)
,
noreg
,
no
mem
,
mode_T
);
new_op
=
new_rd_ia32_Load
(
env
->
dbg
,
env
->
irg
,
env
->
block
,
ptr
,
noreg
,
mem
,
mode_T
);
}
set_ia32_am_support
(
new_op
,
ia32_am_Source
);
...
...
@@ -658,7 +660,7 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab
int
i
,
ignore
;
ir_mode
**
modes
;
const
arch_register_t
*
reg
;
be_abi_call_flags_t
call_flags
=
{
0
,
0
,
1
,
0
,
1
};
be_abi_call_flags_t
call_flags
=
{
0
,
0
,
0
,
0
,
1
};
/* get the between type and the frame pointer save entity */
between_type
=
get_between_type
();
...
...
ir/be/ia32/ia32_emitter.c
View file @
f17bb2ac
...
...
@@ -43,6 +43,9 @@ static const arch_env_t *arch_env = NULL;
char
*
ia32_emit_binop
(
const
ir_node
*
n
)
{
static
char
*
buf
=
NULL
;
/* verify that this function is never called on non-AM supporting operations */
assert
(
get_ia32_am_support
(
n
)
!=
ia32_am_None
&&
"emit binop expects addressmode support"
);
if
(
!
buf
)
{
buf
=
xcalloc
(
1
,
SNPRINTF_BUF_LEN
);
}
...
...
@@ -53,26 +56,21 @@ char *ia32_emit_binop(const ir_node *n) {
switch
(
get_ia32_op_type
(
n
))
{
case
ia32_Normal
:
if
(
get_ia32_cnst
(
n
))
{
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%
1D
, %s"
,
n
,
get_ia32_cnst
(
n
));
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%
3S
, %s"
,
n
,
get_ia32_cnst
(
n
));
}
else
{
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%
1D
, %4S"
,
n
,
n
);
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%
3S
, %4S"
,
n
,
n
);
}
break
;
case
ia32_AddrModeS
:
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%
1D
, %s"
,
n
,
ia32_emit_am
(
n
));
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%
4S
, %s"
,
n
,
ia32_emit_am
(
n
));
break
;
case
ia32_AddrModeD
:
if
(
get_ia32_cnst
(
n
))
{
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%s, %s"
,
ia32_emit_am
(
n
),
get_ia32_cnst
(
n
));
}
else
{
if
(
is_ia32_St
(
n
))
{
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%s, %3S"
,
ia32_emit_am
(
n
),
n
);
}
else
{
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%s, %4S"
,
ia32_emit_am
(
n
),
n
);
}
lc_esnprintf
(
ia32_get_arg_env
(),
buf
,
SNPRINTF_BUF_LEN
,
"%s, %3S"
,
ia32_emit_am
(
n
),
n
);
}
break
;
default:
...
...
@@ -488,8 +486,8 @@ static void finish_CondJmp(FILE *F, const ir_node *irn) {
static
void
emit_ia32_CondJmp
(
const
ir_node
*
irn
,
emit_env_t
*
env
)
{
FILE
*
F
=
env
->
out
;
lc_efprintf
(
ia32_get_arg_env
(),
F
,
"
\t
cmp %
2S, %1S
\t\t\t
/* CondJmp(%+F, %+F) */
\n
"
,
irn
,
irn
,
get_irn_n
(
irn
,
0
),
get_irn_n
(
irn
,
1
));
lc_efprintf
(
ia32_get_arg_env
(),
F
,
"
\t
cmp %
s
\t\t\t
/* CondJmp(%+F, %+F) */
\n
"
,
ia32_emit_binop
(
irn
),
get_irn_n
(
irn
,
0
),
get_irn_n
(
irn
,
1
));
finish_CondJmp
(
F
,
irn
);
}
...
...
@@ -499,7 +497,8 @@ static void emit_ia32_CondJmp(const ir_node *irn, emit_env_t *env) {
void
emit_ia32_CondJmp_i
(
const
ir_node
*
irn
,
emit_env_t
*
env
)
{
FILE
*
F
=
env
->
out
;
lc_efprintf
(
ia32_get_arg_env
(),
F
,
"
\t
cmp %C, %1S
\t\t\t
/* CondJmp_i(%+F) */
\n
"
,
irn
,
irn
,
get_irn_n
(
irn
,
0
));
lc_efprintf
(
ia32_get_arg_env
(),
F
,
"
\t
cmp %s
\t\t\t
/* CondJmp_i(%+F) */
\n
"
,
ia32_emit_binop
(
irn
),
get_irn_n
(
irn
,
0
));
finish_CondJmp
(
F
,
irn
);
}
...
...
@@ -624,7 +623,7 @@ void emit_ia32_SwitchJmp(const ir_node *irn, emit_env_t *emit_env) {
if
(
tbl
.
num_branches
>
1
)
{
/* create table */
lc_efprintf
(
env
,
F
,
"
\t
jmp
*%s(,%1S,4)
\t\t
/* get jump table entry as target */
\n
"
,
tbl
.
label
,
irn
);
lc_efprintf
(
env
,
F
,
"
\t
jmp
[%1S*4+%s]
\t\t
/* get jump table entry as target */
\n
"
,
irn
,
tbl
.
label
);
fprintf
(
F
,
"
\t
.section
\t
.rodata
\t\t
/* start jump table */
\n
"
);
fprintf
(
F
,
"
\t
.align 4
\n
"
);
...
...
ir/be/ia32/ia32_spec.pl
View file @
f17bb2ac
...
...
@@ -351,7 +351,7 @@ $arch = "ia32";
"
op_flags
"
=>
"
L|X|Y
",
"
comment
"
=>
"
construct switch
",
"
cmp_attr
"
=>
"
return ia32_compare_immop_attr(attr_a, attr_b);
\n
",
"
reg_req
"
=>
{
"
in
"
=>
[
"
gp
"
,
"
gp
",
"
gp
",
"
none
"
],
"
out
"
=>
[
"
none
"
]
},
"
reg_req
"
=>
{
"
in
"
=>
[
"
gp
"
],
"
out
"
=>
[
"
none
"
]
},
},
"
Const
"
=>
{
...
...
ir/be/ia32/ia32_transform.c
View file @
f17bb2ac
...
...
@@ -1213,9 +1213,10 @@ static ir_node *gen_Cond(ia32_transform_env_t *env) {
}
set_ia32_pncode
(
res
,
get_Proj_proj
(
sel
));
set_ia32_am_support
(
res
,
ia32_am_Source
);
}
else
{
res
=
new_rd_ia32_SwitchJmp
(
dbg
,
irg
,
block
,
noreg
,
noreg
,
sel
,
nomem
,
mode_T
);
res
=
new_rd_ia32_SwitchJmp
(
dbg
,
irg
,
block
,
sel
,
mode_T
);
set_ia32_pncode
(
res
,
get_Cond_defaultProj
(
node
));
}
...
...
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