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
8b055230
Commit
8b055230
authored
May 25, 2015
by
Christoph Mallon
Browse files
sparc: Implement memory asm constraints 'g', 'm' and 'w'.
parent
90812b9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/be/sparc/sparc_emitter.c
View file @
8b055230
...
@@ -729,6 +729,12 @@ static void emit_sparc_asm_operand(ir_node const *const node, char const modifie
...
@@ -729,6 +729,12 @@ static void emit_sparc_asm_operand(ir_node const *const node, char const modifie
case
ASM_OPERAND_OUTPUT_VALUE
:
case
ASM_OPERAND_OUTPUT_VALUE
:
sparc_emit_register
(
arch_get_irn_register_out
(
node
,
op
->
pos
));
sparc_emit_register
(
arch_get_irn_register_out
(
node
,
op
->
pos
));
return
;
return
;
case
ASM_OPERAND_MEMORY
:
be_emit_char
(
'['
);
sparc_emit_register
(
arch_get_irn_register_in
(
node
,
op
->
pos
));
be_emit_char
(
']'
);
return
;
}
}
panic
(
"invalid asm operand kind"
);
panic
(
"invalid asm operand kind"
);
}
}
...
...
ir/be/sparc/sparc_nodes_attr.h
View file @
8b055230
...
@@ -94,7 +94,8 @@ struct sparc_switch_jmp_attr_t {
...
@@ -94,7 +94,8 @@ struct sparc_switch_jmp_attr_t {
typedef
enum
operand_kind_t
{
typedef
enum
operand_kind_t
{
ASM_OPERAND_INPUT_VALUE
,
ASM_OPERAND_INPUT_VALUE
,
ASM_OPERAND_OUTPUT_VALUE
,
ASM_OPERAND_OUTPUT_VALUE
,
ASM_OPERAND_IMMEDIATE
ASM_OPERAND_IMMEDIATE
,
ASM_OPERAND_MEMORY
,
}
operand_kind_t
;
}
operand_kind_t
;
typedef
struct
sparc_asm_operand_t
{
typedef
struct
sparc_asm_operand_t
{
...
...
ir/be/sparc/sparc_transform.c
View file @
8b055230
...
@@ -204,6 +204,7 @@ static void sparc_parse_constraint_letter(void const *const env, be_asm_constrai
...
@@ -204,6 +204,7 @@ static void sparc_parse_constraint_letter(void const *const env, be_asm_constrai
case
'g'
:
case
'g'
:
c
->
all_registers_allowed
=
true
;
c
->
all_registers_allowed
=
true
;
c
->
memory_possible
=
true
;
/* FALLTHROUGH */
/* FALLTHROUGH */
case
'A'
:
case
'A'
:
case
'I'
:
case
'I'
:
...
@@ -218,6 +219,11 @@ static void sparc_parse_constraint_letter(void const *const env, be_asm_constrai
...
@@ -218,6 +219,11 @@ static void sparc_parse_constraint_letter(void const *const env, be_asm_constrai
c
->
immediate_type
=
l
;
c
->
immediate_type
=
l
;
break
;
break
;
case
'm'
:
case
'w'
:
c
->
memory_possible
=
true
;
break
;
default:
default:
panic
(
"unknown asm constraint '%c'"
,
l
);
panic
(
"unknown asm constraint '%c'"
,
l
);
}
}
...
@@ -242,7 +248,8 @@ void sparc_init_asm_constraints(void)
...
@@ -242,7 +248,8 @@ void sparc_init_asm_constraints(void)
{
{
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_REGISTER
,
"0123456789efr"
);
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_REGISTER
,
"0123456789efr"
);
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_IMMEDIATE
,
"AIJLMOPin"
);
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_IMMEDIATE
,
"AIJLMOPin"
);
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_IMMEDIATE
|
ASM_CONSTRAINT_FLAG_SUPPORTS_REGISTER
,
"g"
);
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_ANY
,
"g"
);
be_set_constraint_support
(
ASM_CONSTRAINT_FLAG_SUPPORTS_MEMOP
,
"mw"
);
/* Note there are many more flags in gcc which we can't properly support
/* Note there are many more flags in gcc which we can't properly support
* at the moment. see gcc/config/sparc/constraints.md */
* at the moment. see gcc/config/sparc/constraints.md */
}
}
...
@@ -390,13 +397,18 @@ static ir_node *gen_ASM(ir_node *node)
...
@@ -390,13 +397,18 @@ static ir_node *gen_ASM(ir_node *node)
if
(
imm_type
!=
'\0'
&&
sparc_match_immediate
(
operand
,
pred
,
imm_type
))
if
(
imm_type
!=
'\0'
&&
sparc_match_immediate
(
operand
,
pred
,
imm_type
))
continue
;
continue
;
arch_register_req_t
const
*
const
req
=
be_make_register_req
(
obst
,
&
parsed_constraint
,
n_out_constraints
,
out_reg_reqs
,
i
);
ir_node
*
const
new_pred
=
be_transform_node
(
pred
);
operand_kind_t
kind
=
ASM_OPERAND_INPUT_VALUE
;
arch_register_req_t
const
*
req
=
be_make_register_req
(
obst
,
&
parsed_constraint
,
n_out_constraints
,
out_reg_reqs
,
i
);
if
(
req
==
arch_no_register_req
)
{
kind
=
ASM_OPERAND_MEMORY
;
req
=
arch_get_irn_register_req
(
new_pred
)
->
cls
->
class_req
;
}
in_reg_reqs
[
i
]
=
req
;
in_reg_reqs
[
i
]
=
req
;
int
op_pos
=
n_ins
++
;
int
const
op_pos
=
n_ins
++
;
ir_node
*
new_pred
=
be_transform_node
(
pred
);
in
[
op_pos
]
=
new_pred
;
in
[
op_pos
]
=
new_pred
;
operand
->
kind
=
ASM_OPERAND_INPUT_VALUE
;
operand
->
kind
=
kind
;
operand
->
pos
=
op_pos
;
operand
->
pos
=
op_pos
;
}
}
...
...
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