summaryrefslogtreecommitdiffhomepage
path: root/ir/be/benode.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2015-08-19 08:15:23 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2015-08-19 08:16:46 +0200
commitbaeded4f6357b939b02f974000d67b20964c7668 (patch)
tree2264e9e46d6b1d9ff7d2797d9bdc8226fbadfe68 /ir/be/benode.c
parent057b2367ffff8eaad7bfdfb6504b5d3612b3e654 (diff)
be: Correct and simplify copy_attr().
Now add_pressure[] is copied.
Diffstat (limited to 'ir/be/benode.c')
-rw-r--r--ir/be/benode.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/ir/be/benode.c b/ir/be/benode.c
index e046dc2..dbef7bb 100644
--- a/ir/be/benode.c
+++ b/ir/be/benode.c
@@ -611,34 +611,22 @@ static void dump_node(FILE *f, const ir_node *irn, dump_reason_t reason)
* ir_op-Operation:
* Copies the backend specific attributes from old node to new node.
*/
-static void copy_attr(ir_graph *irg, const ir_node *old_node, ir_node *new_node)
+static void copy_attr(ir_graph *const irg, ir_node const *const old_node, ir_node *const new_node)
{
assert(is_be_node(old_node));
assert(is_be_node(new_node));
- const void *old_attr = get_irn_generic_attr_const(old_node);
- void *new_attr = get_irn_generic_attr(new_node);
- struct obstack *obst = be_get_be_obst(irg);
- backend_info_t *old_info = be_get_info(old_node);
- backend_info_t *new_info = be_get_info(new_node);
+ void const *const old_attr = get_irn_generic_attr_const(old_node);
+ void *const new_attr = get_irn_generic_attr(new_node);
memcpy(new_attr, old_attr, get_op_attr_size(get_irn_op(old_node)));
- new_info->flags = old_info->flags;
- new_info->out_infos = old_info->out_infos
- ? DUP_ARR_D(reg_out_info_t, obst, old_info->out_infos)
- : NULL;
-
- /* input infos */
- if (old_info->in_reqs != NULL) {
- unsigned n_ins = get_irn_arity(old_node);
- /* need dynamic in infos? */
- if (is_irn_dynamic(old_node)) {
- new_info->in_reqs = NEW_ARR_F(const arch_register_req_t*, n_ins);
- } else {
- new_info->in_reqs = be_allocate_in_reqs(irg, n_ins);
- }
- MEMCPY(new_info->in_reqs, old_info->in_reqs, n_ins);
- } else {
- new_info->in_reqs = NULL;
+
+ backend_info_t *const old_info = be_get_info(old_node);
+ backend_info_t *const new_info = be_get_info(new_node);
+ *new_info = *old_info;
+ memset(&new_info->sched_info, 0, sizeof(new_info->sched_info));
+ if (new_info->out_infos) {
+ struct obstack *const obst = be_get_be_obst(irg);
+ new_info->out_infos = DUP_ARR_D(reg_out_info_t, obst, new_info->out_infos);
}
}