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
4096b5c8
Commit
4096b5c8
authored
Jun 30, 2010
by
Robin Redeker
Browse files
amd64: made SymConst rematerializable and added emission of be_Perm.
[r27683]
parent
8b7059c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/be/amd64/amd64_emitter.c
View file @
4096b5c8
...
...
@@ -43,6 +43,7 @@
#include
"amd64_emitter.h"
#include
"gen_amd64_emitter.h"
#include
"gen_amd64_regalloc_if.h"
#include
"amd64_nodes_attr.h"
#include
"amd64_new_nodes.h"
...
...
@@ -395,6 +396,30 @@ static void emit_be_Copy(const ir_node *irn)
}
}
static
void
emit_be_Perm
(
const
ir_node
*
node
)
{
const
arch_register_t
*
in0
,
*
in1
;
const
arch_register_class_t
*
cls0
,
*
cls1
;
in0
=
arch_get_irn_register
(
get_irn_n
(
node
,
0
));
in1
=
arch_get_irn_register
(
get_irn_n
(
node
,
1
));
cls0
=
arch_register_get_class
(
in0
);
cls1
=
arch_register_get_class
(
in1
);
assert
(
cls0
==
cls1
&&
"Register class mismatch at Perm"
);
be_emit_cstring
(
"
\t
xchg "
);
amd64_emit_register
(
in0
);
be_emit_cstring
(
", "
);
amd64_emit_register
(
in1
);
be_emit_finish_line_gas
(
node
);
if
(
cls0
!=
&
amd64_reg_classes
[
CLASS_amd64_gp
])
{
panic
(
"unexpected register class in be_Perm (%+F)"
,
node
);
}
}
static
void
emit_amd64_FrameAddr
(
const
ir_node
*
irn
)
{
const
amd64_SymConst_attr_t
*
attr
=
get_irn_generic_attr_const
(
irn
);
...
...
@@ -530,6 +555,7 @@ static void amd64_register_emitters(void)
set_emitter
(
op_be_Call
,
emit_be_Call
);
set_emitter
(
op_be_Copy
,
emit_be_Copy
);
set_emitter
(
op_be_IncSP
,
emit_be_IncSP
);
set_emitter
(
op_be_Perm
,
emit_be_Perm
);
set_emitter
(
op_amd64_Add
,
emit_amd64_binop
);
set_emitter
(
op_amd64_Sub
,
emit_amd64_binop
);
...
...
ir/be/amd64/amd64_new_nodes.c
View file @
4096b5c8
...
...
@@ -196,5 +196,23 @@ static int cmp_amd64_attr(ir_node *a, ir_node *b)
return
attr_a
->
ext
.
imm_value
!=
attr_b
->
ext
.
imm_value
;
}
/** copies the AMD64 attributes of a node. */
static
void
amd64_copy_attr
(
ir_graph
*
irg
,
const
ir_node
*
old_node
,
ir_node
*
new_node
)
{
struct
obstack
*
obst
=
get_irg_obstack
(
irg
);
const
amd64_attr_t
*
attr_old
=
get_amd64_attr_const
(
old_node
);
amd64_attr_t
*
attr_new
=
get_amd64_attr
(
new_node
);
backend_info_t
*
old_info
=
be_get_info
(
old_node
);
backend_info_t
*
new_info
=
be_get_info
(
new_node
);
/* copy the attributes */
memcpy
(
attr_new
,
attr_old
,
get_op_attr_size
(
get_irn_op
(
old_node
)));
/* copy out flags */
new_info
->
out_infos
=
DUP_ARR_D
(
reg_out_info_t
,
obst
,
old_info
->
out_infos
);
}
/* Include the generated constructor functions */
#include
"gen_amd64_new_nodes.c.inl"
ir/be/amd64/amd64_spec.pl
View file @
4096b5c8
...
...
@@ -158,6 +158,8 @@ sub amd64_custom_init_attr {
}
$custom_init_attr_func
=
\
&amd64_custom_init_attr
;
$default_copy_attr
=
"
amd64_copy_attr
";
%emit_templates
=
(
S1
=>
"
${arch}
_emit_source_register(node, 0);
",
S2
=>
"
${arch}
_emit_source_register(node, 1);
",
...
...
@@ -257,7 +259,7 @@ Immediate => {
},
SymConst
=>
{
op_flags
=>
"
c
",
#
irn_flags => "R",
irn_flags
=>
"
R
",
attr
=>
"
ir_entity *entity
",
attr_type
=>
"
amd64_SymConst_attr_t
",
reg_req
=>
{
out
=>
[
"
gp
"
]
},
...
...
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