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
9a169e46
Commit
9a169e46
authored
Oct 04, 2013
by
Matthias Braun
Browse files
improvements
parent
f642eb79
Changes
5
Show whitespace changes
Inline
Side-by-side
ir/be/amd64/amd64_emitter.c
View file @
9a169e46
...
...
@@ -212,8 +212,13 @@ static void amd64_emit_am(const ir_node *const node,
{
ir_entity
*
entity
=
am
->
symconst
;
if
(
entity
!=
NULL
)
{
ir_type
*
owner
=
get_entity_owner
(
entity
);
if
(
is_frame_type
(
owner
))
{
entity
=
NULL
;
/* only emit offset for frame entities */
}
else
{
be_gas_emit_entity
(
entity
);
}
}
int32_t
offset
=
am
->
offset
;
uint8_t
base_input
=
am
->
base_input
;
...
...
@@ -233,11 +238,16 @@ static void amd64_emit_am(const ir_node *const node,
if
(
base_input
==
RIP_INPUT
)
{
be_emit_cstring
(
"%rip"
);
}
else
if
(
base_input
!=
NO_INPUT
)
{
be_emit_char
(
','
);
const
arch_register_t
*
reg
=
arch_get_irn_register_in
(
node
,
base_input
);
emit_register
(
reg
);
}
if
(
index_input
!=
NO_INPUT
)
{
be_emit_char
(
','
);
const
arch_register_t
*
reg
=
arch_get_irn_register_in
(
node
,
index_input
);
emit_register
(
reg
);
unsigned
scale
=
am
->
log_scale
;
if
(
scale
>
0
)
...
...
ir/be/amd64/amd64_new_nodes.c
View file @
9a169e46
...
...
@@ -181,12 +181,24 @@ static int cmp_imm(const amd64_imm_t *const imm0, const amd64_imm_t *const imm1)
return
imm0
->
offset
!=
imm1
->
offset
||
imm0
->
symconst
!=
imm1
->
symconst
;
}
static
int
cmp_am
(
const
amd64_am_info_t
*
const
am0
,
const
amd64_am_info_t
*
const
am1
)
{
return
am0
->
offset
!=
am1
->
offset
||
am0
->
symconst
!=
am1
->
symconst
||
am0
->
base_input
!=
am1
->
base_input
||
am0
->
index_input
!=
am1
->
index_input
||
am0
->
mem_input
!=
am1
->
mem_input
||
am0
->
log_scale
!=
am1
->
log_scale
||
am0
->
segment
!=
am1
->
segment
;
}
/** Compare common amd64 node attributes. */
static
int
cmp_amd64_attr
(
const
ir_node
*
a
,
const
ir_node
*
b
)
{
const
amd64_attr_t
*
attr_a
=
get_amd64_attr_const
(
a
);
const
amd64_attr_t
*
attr_b
=
get_amd64_attr_const
(
b
);
return
cmp_imm
(
&
attr_a
->
imm
,
&
attr_b
->
imm
);
return
cmp_imm
(
&
attr_a
->
imm
,
&
attr_b
->
imm
)
||
cmp_am
(
&
attr_a
->
am
,
&
attr_b
->
am
);
}
/** copies the AMD64 attributes of a node. */
...
...
ir/be/amd64/amd64_nodes_attr.h
View file @
9a169e46
...
...
@@ -64,6 +64,7 @@ struct amd64_attr_t
unsigned
ins_permuted
:
1
;
/**< inputs of node have been permuted
(for commutative nodes) */
unsigned
cmp_unsigned
:
1
;
/**< compare should be unsigned */
bool
needs_frame_ent
:
1
;
ENUMBF
(
amd64_insn_mode_t
)
insn_mode
:
2
;
}
data
;
struct
amd64_attr_extended
{
...
...
ir/be/amd64/amd64_transform.c
View file @
9a169e46
...
...
@@ -963,6 +963,8 @@ ir_node *amd64_new_spill(ir_node *value, ir_node *after)
ir_node
*
in
[]
=
{
value
,
frame
,
mem
};
ir_node
*
store
=
new_bd_amd64_Store
(
NULL
,
block
,
ARRAY_SIZE
(
in
),
in
,
INSN_MODE_64
,
am
);
amd64_attr_t
*
attr
=
get_amd64_attr
(
store
);
attr
->
data
.
needs_frame_ent
=
true
;
arch_set_irn_register_reqs_in
(
store
,
am_store_base_reqs
);
sched_add_after
(
after
,
store
);
return
store
;
...
...
@@ -985,6 +987,8 @@ ir_node *amd64_new_reload(ir_node *value, ir_node *spill, ir_node *before)
INSN_MODE_64
,
am
);
arch_set_irn_register_reqs_in
(
load
,
am_load_base_reqs
);
sched_add_before
(
before
,
load
);
amd64_attr_t
*
attr
=
get_amd64_attr
(
load
);
attr
->
data
.
needs_frame_ent
=
true
;
ir_node
*
res
=
new_r_Proj
(
load
,
mode
,
pn_amd64_LoadZ_res
);
return
res
;
}
...
...
ir/be/amd64/bearch_amd64.c
View file @
9a169e46
...
...
@@ -235,8 +235,10 @@ static void amd64_after_ra_walker(ir_node *block, void *data)
static
void
amd64_set_frame_entity
(
ir_node
*
node
,
ir_entity
*
entity
)
{
assert
(
be_is_Reload
(
node
)
||
be_is_Spill
(
node
));
be_node_set_frame_entity
(
node
,
entity
);
assert
(
is_amd64_Store
(
node
)
||
is_amd64_LoadZ
(
node
)
||
is_amd64_LoadS
(
node
));
amd64_attr_t
*
attr
=
get_amd64_attr
(
node
);
attr
->
am
.
symconst
=
entity
;
}
/**
...
...
@@ -244,9 +246,13 @@ static void amd64_set_frame_entity(ir_node *node, ir_entity *entity)
*/
static
void
amd64_collect_frame_entity_nodes
(
ir_node
*
node
,
void
*
data
)
{
if
(
be_is_Reload
(
node
)
&&
be_get_frame_entity
(
node
)
==
NULL
)
{
if
(
!
is_amd64_LoadZ
(
node
))
return
;
const
amd64_attr_t
*
attr
=
get_amd64_attr_const
(
node
);
if
(
attr
->
data
.
needs_frame_ent
)
{
be_fec_env_t
*
env
=
(
be_fec_env_t
*
)
data
;
const
ir_mode
*
mode
=
get_irn_mode
(
node
);
const
ir_mode
*
mode
=
mode_Lu
;
/* TODO: improve */
int
align
=
get_mode_size_bytes
(
mode
);
be_node_needs_frame_entity
(
env
,
node
,
mode
,
align
);
}
...
...
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