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
9a8326b7
Commit
9a8326b7
authored
Nov 20, 2014
by
Matthias Braun
Browse files
TEMPLATE: Add support for addresses
parent
362addbc
Changes
5
Hide whitespace changes
Inline
Side-by-side
ir/be/TEMPLATE/TEMPLATE_emitter.c
View file @
9a8326b7
...
...
@@ -36,6 +36,12 @@ static void TEMPLATE_emit_immediate(const ir_node *node)
be_emit_irprintf
(
"%T"
,
attr
->
value
);
}
static
void
TEMPLATE_emit_entity
(
const
ir_node
*
node
)
{
const
TEMPLATE_attr_t
*
attr
=
get_TEMPLATE_attr_const
(
node
);
be_emit_irprintf
(
"%s"
,
get_entity_ld_name
(
attr
->
entity
));
}
static
void
emit_register
(
const
arch_register_t
*
reg
)
{
be_emit_string
(
reg
->
name
);
...
...
@@ -97,6 +103,10 @@ void TEMPLATE_emitf(const ir_node *node, const char *format, ...)
break
;
}
case
'E'
:
TEMPLATE_emit_entity
(
node
);
break
;
case
'I'
:
TEMPLATE_emit_immediate
(
node
);
break
;
...
...
ir/be/TEMPLATE/TEMPLATE_new_nodes.c
View file @
9a8326b7
...
...
@@ -94,11 +94,18 @@ static void set_TEMPLATE_value(ir_node *node, ir_tarval *value)
attr
->
value
=
value
;
}
static
void
set_TEMPLATE_entity
(
ir_node
*
node
,
ir_entity
*
entity
)
{
TEMPLATE_attr_t
*
attr
=
get_TEMPLATE_attr
(
node
);
attr
->
entity
=
entity
;
}
static
int
TEMPLATE_attrs_equal
(
const
ir_node
*
a
,
const
ir_node
*
b
)
{
const
TEMPLATE_attr_t
*
attr_a
=
get_TEMPLATE_attr_const
(
a
);
const
TEMPLATE_attr_t
*
attr_b
=
get_TEMPLATE_attr_const
(
b
);
return
attr_a
->
value
==
attr_b
->
value
;
return
attr_a
->
value
==
attr_b
->
value
&&
attr_a
->
entity
==
attr_b
->
entity
;
}
static
void
TEMPLATE_copy_attr
(
ir_graph
*
irg
,
const
ir_node
*
old_node
,
...
...
ir/be/TEMPLATE/TEMPLATE_nodes_attr.h
View file @
9a8326b7
...
...
@@ -17,6 +17,7 @@ typedef struct TEMPLATE_attr_t TEMPLATE_attr_t;
struct
TEMPLATE_attr_t
{
ir_tarval
*
value
;
ir_entity
*
entity
;
};
#endif
ir/be/TEMPLATE/TEMPLATE_spec.pl
View file @
9a8326b7
...
...
@@ -182,6 +182,16 @@ Const => {
mode
=>
$mode_gp
,
},
Address
=>
{
op_flags
=>
[
"
constlike
"
],
irn_flags
=>
[
"
rematerializable
"
],
attr
=>
"
ir_entity *entity
",
custominit
=>
"
set_TEMPLATE_entity(res, entity);
",
reg_req
=>
{
out
=>
[
"
gp
"
]
},
emit
=>
'
%D0 = address of %E
',
mode
=>
$mode_gp
,
},
# Control Flow
Jmp
=>
{
...
...
ir/be/TEMPLATE/TEMPLATE_transform.c
View file @
9a8326b7
...
...
@@ -165,6 +165,15 @@ static ir_node *gen_Const(ir_node *node)
return
new_bd_TEMPLATE_Const
(
dbgi
,
new_block
,
value
);
}
static
ir_node
*
gen_Address
(
ir_node
*
node
)
{
ir_node
*
block
=
get_nodes_block
(
node
);
ir_node
*
new_block
=
be_transform_node
(
block
);
dbg_info
*
dbgi
=
get_irn_dbg_info
(
node
);
ir_entity
*
entity
=
get_Address_entity
(
node
);
return
new_bd_TEMPLATE_Address
(
dbgi
,
new_block
,
entity
);
}
static
ir_node
*
gen_Load
(
ir_node
*
node
)
{
ir_node
*
block
=
get_nodes_block
(
node
);
...
...
@@ -298,25 +307,26 @@ static void TEMPLATE_register_transformers(void)
{
be_start_transform_setup
();
be_set_transform_function
(
op_Add
,
gen_Add
);
be_set_transform_function
(
op_And
,
gen_And
);
be_set_transform_function
(
op_Const
,
gen_Const
);
be_set_transform_function
(
op_Div
,
gen_Div
);
be_set_transform_function
(
op_Eor
,
gen_Eor
);
be_set_transform_function
(
op_Jmp
,
gen_Jmp
);
be_set_transform_function
(
op_Load
,
gen_Load
);
be_set_transform_function
(
op_Minus
,
gen_Minus
);
be_set_transform_function
(
op_Mul
,
gen_Mul
);
be_set_transform_function
(
op_Not
,
gen_Not
);
be_set_transform_function
(
op_Or
,
gen_Or
);
be_set_transform_function
(
op_Phi
,
gen_Phi
);
be_set_transform_function
(
op_Return
,
gen_Return
);
be_set_transform_function
(
op_Shl
,
gen_Shl
);
be_set_transform_function
(
op_Shr
,
gen_Shr
);
be_set_transform_function
(
op_Start
,
gen_Start
);
be_set_transform_function
(
op_Store
,
gen_Store
);
be_set_transform_function
(
op_Sub
,
gen_Sub
);
be_set_transform_proj_function
(
op_Start
,
gen_Proj_Start
);
be_set_transform_function
(
op_Add
,
gen_Add
);
be_set_transform_function
(
op_Address
,
gen_Address
);
be_set_transform_function
(
op_And
,
gen_And
);
be_set_transform_function
(
op_Const
,
gen_Const
);
be_set_transform_function
(
op_Div
,
gen_Div
);
be_set_transform_function
(
op_Eor
,
gen_Eor
);
be_set_transform_function
(
op_Jmp
,
gen_Jmp
);
be_set_transform_function
(
op_Load
,
gen_Load
);
be_set_transform_function
(
op_Minus
,
gen_Minus
);
be_set_transform_function
(
op_Mul
,
gen_Mul
);
be_set_transform_function
(
op_Not
,
gen_Not
);
be_set_transform_function
(
op_Or
,
gen_Or
);
be_set_transform_function
(
op_Phi
,
gen_Phi
);
be_set_transform_function
(
op_Return
,
gen_Return
);
be_set_transform_function
(
op_Shl
,
gen_Shl
);
be_set_transform_function
(
op_Shr
,
gen_Shr
);
be_set_transform_function
(
op_Start
,
gen_Start
);
be_set_transform_function
(
op_Store
,
gen_Store
);
be_set_transform_function
(
op_Sub
,
gen_Sub
);
be_set_transform_proj_function
(
op_Proj
,
gen_Proj_Proj
);
}
...
...
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