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
c361c2a3
Commit
c361c2a3
authored
Jul 26, 2015
by
Christoph Mallon
Browse files
template: Merge Address into Const.
Now the template backend has a node, which can represent an adress with an offset.
parent
332b22a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/be/TEMPLATE/TEMPLATE_emitter.c
View file @
c361c2a3
...
...
@@ -21,14 +21,16 @@
static
void
TEMPLATE_emit_immediate
(
const
ir_node
*
node
)
{
const
TEMPLATE_attr_t
*
attr
=
get_TEMPLATE_attr_const
(
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
));
TEMPLATE_attr_t
const
*
const
attr
=
get_TEMPLATE_attr_const
(
node
);
ir_entity
*
const
ent
=
attr
->
entity
;
ir_tarval
*
const
val
=
attr
->
value
;
if
(
ent
)
{
be_emit_irprintf
(
"&%s"
,
get_entity_ld_name
(
ent
));
if
(
val
)
be_emit_char
(
'+'
);
}
if
(
val
)
be_emit_irprintf
(
"%T"
,
val
);
}
static
void
emit_register
(
const
arch_register_t
*
reg
)
...
...
@@ -92,10 +94,6 @@ 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 @
c361c2a3
...
...
@@ -68,16 +68,11 @@ TEMPLATE_attr_t *get_TEMPLATE_attr(ir_node *node)
return
(
TEMPLATE_attr_t
*
)
get_irn_generic_attr
(
node
);
}
static
void
set_TEMPLATE_value
(
ir_node
*
node
,
ir_tarval
*
value
)
{
TEMPLATE_attr_t
*
attr
=
get_TEMPLATE_attr
(
node
);
attr
->
value
=
value
;
}
static
void
set_TEMPLATE_entity
(
ir_node
*
node
,
ir_entity
*
entity
)
static
void
set_TEMPLATE_value
(
ir_node
*
const
node
,
ir_entity
*
const
entity
,
ir_tarval
*
const
value
)
{
TEMPLATE_attr_t
*
attr
=
get_TEMPLATE_attr
(
node
);
attr
->
entity
=
entity
;
attr
->
value
=
value
;
}
static
int
TEMPLATE_attrs_equal
(
const
ir_node
*
a
,
const
ir_node
*
b
)
...
...
ir/be/TEMPLATE/TEMPLATE_spec.pl
View file @
c361c2a3
...
...
@@ -166,18 +166,11 @@ Not => {
Const
=>
{
template
=>
$constop
,
attr
=>
"
ir_tarval *value
",
custominit
=>
"
set_TEMPLATE_value(res, value);
",
attr
=>
"
ir_entity *entity,
ir_tarval *value
",
custominit
=>
"
set_TEMPLATE_value(res,
entity,
value);
",
emit
=>
'
%D0 = const %I
',
},
Address
=>
{
template
=>
$constop
,
attr
=>
"
ir_entity *entity
",
custominit
=>
"
set_TEMPLATE_entity(res, entity);
",
emit
=>
'
%D0 = address of %E
',
},
# Control Flow
Jmp
=>
{
...
...
ir/be/TEMPLATE/TEMPLATE_transform.c
View file @
c361c2a3
...
...
@@ -43,6 +43,13 @@ static inline bool mode_needs_gp_reg(ir_mode *mode)
return
get_mode_arithmetic
(
mode
)
==
irma_twos_complement
;
}
static
ir_node
*
transform_const
(
ir_node
*
const
node
,
ir_entity
*
const
entity
,
ir_tarval
*
const
value
)
{
ir_node
*
const
block
=
be_transform_nodes_block
(
node
);
dbg_info
*
const
dbgi
=
get_irn_dbg_info
(
node
);
return
new_bd_TEMPLATE_Const
(
dbgi
,
block
,
entity
,
value
);
}
static
ir_node
*
transform_binop
(
ir_node
*
node
,
new_binop_func
new_func
)
{
ir_node
*
new_block
=
be_transform_nodes_block
(
node
);
...
...
@@ -155,18 +162,14 @@ static ir_node *gen_Not(ir_node *node)
static
ir_node
*
gen_Const
(
ir_node
*
node
)
{
ir_node
*
new_block
=
be_transform_nodes_block
(
node
);
dbg_info
*
dbgi
=
get_irn_dbg_info
(
node
);
ir_tarval
*
value
=
get_Const_tarval
(
node
);
return
new_bd_TEMPLATE_Const
(
dbgi
,
new_block
,
value
);
ir_tarval
*
const
value
=
get_Const_tarval
(
node
);
return
transform_const
(
node
,
NULL
,
value
);
}
static
ir_node
*
gen_Address
(
ir_node
*
node
)
{
ir_node
*
new_block
=
be_transform_nodes_block
(
node
);
dbg_info
*
dbgi
=
get_irn_dbg_info
(
node
);
ir_entity
*
entity
=
get_Address_entity
(
node
);
return
new_bd_TEMPLATE_Address
(
dbgi
,
new_block
,
entity
);
ir_entity
*
const
entity
=
get_Address_entity
(
node
);
return
transform_const
(
node
,
entity
,
NULL
);
}
static
ir_node
*
gen_Load
(
ir_node
*
node
)
...
...
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