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
cc63b6e6
Commit
cc63b6e6
authored
May 06, 2015
by
Matthias Braun
Browse files
amd64: use existing reg_reqs where possible
parent
4cbee069
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/be/amd64/amd64_transform.c
View file @
cc63b6e6
...
...
@@ -106,33 +106,6 @@ const x86_asm_constraint_list_t amd64_asm_constraints = {
};
#undef GP
static
const
arch_register_req_t
amd64_requirement_gp
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
NULL
,
.
type
=
arch_register_req_type_none
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
arch_register_req_t
amd64_requirement_flags
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_flags
],
.
limited
=
NULL
,
.
type
=
arch_register_req_type_none
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
arch_register_req_t
amd64_requirement_xmm
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_xmm
],
.
limited
=
NULL
,
.
type
=
arch_register_req_type_none
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
#define BIT(x) (1u << x)
static
const
arch_register_req_t
amd64_requirement_gp_same_0
=
{
...
...
@@ -163,138 +136,98 @@ static const arch_register_req_t amd64_requirement_gp_same_0_not_1 = {
.
width
=
1
,
};
static
const
unsigned
amd64_limited_gp_rcx
[]
=
{
BIT
(
REG_GP_RCX
)
};
static
const
arch_register_req_t
amd64_requirement_rcx
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
amd64_limited_gp_rcx
,
.
type
=
arch_register_req_type_limited
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
unsigned
amd64_limited_gp_rax
[]
=
{
BIT
(
REG_GP_RAX
)
};
static
const
arch_register_req_t
amd64_requirement_rax
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
amd64_limited_gp_rax
,
.
type
=
arch_register_req_type_limited
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
unsigned
amd64_limited_gp_rdx
[]
=
{
BIT
(
REG_GP_RDX
)
};
static
const
arch_register_req_t
amd64_requirement_rdx
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
amd64_limited_gp_rdx
,
.
type
=
arch_register_req_type_limited
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
unsigned
amd64_limited_gp_rsp
[]
=
{
BIT
(
REG_GP_RSP
)
};
static
const
arch_register_req_t
amd64_requirement_rsp
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
amd64_limited_gp_rsp
,
.
type
=
arch_register_req_type_limited
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
arch_register_req_t
*
mem_reqs
[]
=
{
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
reg_mem_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
rsp_mem_reqs
[]
=
{
&
amd64_
requirement
_rsp
,
&
amd64_
single_reg_req_gp
_rsp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
rsp_reg_mem_reqs
[]
=
{
&
amd64_
requirement
_rsp
,
&
amd64_
requirement
_gp
,
&
amd64_
single_reg_req_gp
_rsp
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
xmm_mem_reqs
[]
=
{
&
amd64_
requirement
_xmm
,
&
amd64_
class_reg_req
_xmm
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
reg_reg_mem_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
xmm_reg_mem_reqs
[]
=
{
&
amd64_
requirement
_xmm
,
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_xmm
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
reg_reg_reg_mem_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
xmm_reg_reg_mem_reqs
[]
=
{
&
amd64_
requirement
_xmm
,
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_xmm
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
reg_flags_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_flags
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
class_reg_req
_flags
,
};
static
const
arch_register_req_t
*
reg_reg_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
class_reg_req
_gp
,
};
static
const
arch_register_req_t
*
rax_reg_reqs
[]
=
{
&
amd64_
requirement
_rax
,
&
amd64_
requirement
_gp
,
&
amd64_
single_reg_req_gp
_rax
,
&
amd64_
class_reg_req
_gp
,
};
static
const
arch_register_req_t
*
rax_reg_rdx_mem_reqs
[]
=
{
&
amd64_
requirement
_rax
,
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_rdx
,
&
amd64_
single_reg_req_gp
_rax
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
single_reg_req_gp
_rdx
,
&
arch_no_requirement
,
};
static
const
arch_register_req_t
*
reg_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_gp
,
};
arch_register_req_t
const
*
amd64_xmm_reqs
[]
=
{
&
amd64_
requirement
_xmm
,
&
amd64_
class_reg_req
_xmm
,
};
static
const
arch_register_req_t
*
reg_rcx_reqs
[]
=
{
&
amd64_
requirement
_gp
,
&
amd64_
requirement
_rcx
,
&
amd64_
class_reg_req
_gp
,
&
amd64_
single_reg_req_gp
_rcx
,
};
static
const
arch_register_req_t
*
no_reqs
[]
=
{
};
static
const
arch_register_req_t
*
xmm_xmm_reqs
[]
=
{
&
amd64_
requirement
_xmm
,
&
amd64_
requirement
_xmm
,
&
amd64_
class_reg_req
_xmm
,
&
amd64_
class_reg_req
_xmm
,
};
arch_register_req_t
const
**
const
gp_am_reqs
[]
=
{
...
...
@@ -1672,11 +1605,11 @@ static ir_node *gen_Call(ir_node *node)
perform_address_matching
(
load_ptr
,
&
in_arity
,
in
,
&
addr
);
if
(
addr
.
base_input
!=
NO_INPUT
)
{
in_req
[
addr
.
base_input
]
=
&
amd64_
requirement
_gp
;
in_req
[
addr
.
base_input
]
=
&
amd64_
class_reg_req
_gp
;
}
if
(
addr
.
index_input
!=
NO_INPUT
)
{
in_req
[
addr
.
index_input
]
=
&
amd64_
requirement
_gp
;
in_req
[
addr
.
index_input
]
=
&
amd64_
class_reg_req
_gp
;
}
ir_node
*
load_mem
=
get_Load_mem
(
load
);
...
...
@@ -1689,7 +1622,7 @@ static ir_node *gen_Call(ir_node *node)
assert
(
input
==
0
);
/* UNOP_REG is currently hardcoded to always
* output the register of the first input. */
in
[
input
]
=
be_transform_node
(
callee
);
in_req
[
input
]
=
&
amd64_
requirement
_gp
;
in_req
[
input
]
=
&
amd64_
class_reg_req
_gp
;
addr
.
base_input
=
NO_INPUT
;
addr
.
index_input
=
NO_INPUT
;
op_mode
=
AMD64_OP_UNOP_REG
;
...
...
ir/be/amd64/bearch_amd64.c
View file @
cc63b6e6
...
...
@@ -114,28 +114,9 @@ static void amd64_before_ra(ir_graph *irg)
be_sched_fix_flags
(
irg
,
&
amd64_reg_classes
[
CLASS_amd64_flags
],
NULL
,
NULL
,
NULL
);
}
static
const
arch_register_req_t
amd64_requirement_gp
=
{
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
NULL
,
.
type
=
arch_register_req_type_none
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
unsigned
amd64_limited_gp_rsp
[]
=
{
(
1
<<
REG_GP_RSP
)
};
static
const
arch_register_req_t
amd64_single_reg_req_gp_rsp
=
{
.
type
=
arch_register_req_type_limited
,
.
cls
=
&
amd64_reg_classes
[
CLASS_amd64_gp
],
.
limited
=
amd64_limited_gp_rsp
,
.
other_same
=
0
,
.
other_different
=
0
,
.
width
=
1
,
};
static
const
arch_register_req_t
*
am_pushpop_base_reqs
[]
=
{
&
amd64_single_reg_req_gp_rsp
,
&
amd64_
requirement
_gp
,
&
amd64_
class_reg_req
_gp
,
&
arch_no_requirement
,
};
...
...
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