From c4196781714a41cb0ac509bf0ae1f320d6e23d8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Wed, 13 Dec 2006 15:05:17 +0000 Subject: [PATCH] added copy attribute function (out_flags is a variable array on irg obstack) --- ir/be/ia32/bearch_ia32.c | 1 + ir/be/ia32/ia32_new_nodes.c | 13 ++++++------- ir/be/ia32/ia32_new_nodes.h | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 9476e74cf..8a64c53a7 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -1466,6 +1466,7 @@ static void *ia32_init(FILE *file_handle) { ia32_register_init(isa); ia32_create_opcodes(); + ia32_register_copy_attr_func(); if ((ARCH_INTEL(isa->arch) && isa->arch < arch_pentium_4) || (ARCH_AMD(isa->arch) && isa->arch < arch_athlon)) diff --git a/ir/be/ia32/ia32_new_nodes.c b/ir/be/ia32/ia32_new_nodes.c index fe8656af4..1f404d80e 100644 --- a/ir/be/ia32/ia32_new_nodes.c +++ b/ir/be/ia32/ia32_new_nodes.c @@ -1401,16 +1401,16 @@ int ia32_compare_conv_attr(ia32_attr_t *a, ia32_attr_t *b) { return !equ; } -/* Copy attribute function not needed any more, but might be of use later. */ -#if 0 /* copies the ia32 attributes */ static void ia32_copy_attr(const ir_node *old_node, ir_node *new_node) { - ia32_attr_t *attr_old = get_ia32_attr(old_node); - ia32_attr_t *attr_new = get_ia32_attr(new_node); - int n_res = get_ia32_n_res(old_node); + ia32_attr_t *attr_old = get_ia32_attr(old_node); + ia32_attr_t *attr_new = get_ia32_attr(new_node); /* copy the attributes */ - memcpy(attr_new, attr_old, sizeof(*attr_new)); + memcpy(attr_new, attr_old, get_op_attr_size(get_irn_op(old_node))); + + /* copy out flags */ + DUP_ARR_D(int, get_irg_obstack(get_irn_irg(new_node)), attr_old->out_flags); } /** @@ -1424,7 +1424,6 @@ void ia32_register_copy_attr_func(void) { op->ops.copy_attr = ia32_copy_attr; } } -#endif /* Include the generated constructor functions */ #include "gen_ia32_new_nodes.c.inl" diff --git a/ir/be/ia32/ia32_new_nodes.h b/ir/be/ia32/ia32_new_nodes.h index 510ac7093..f48a66e14 100644 --- a/ir/be/ia32/ia32_new_nodes.h +++ b/ir/be/ia32/ia32_new_nodes.h @@ -506,6 +506,11 @@ int is_ia32_Cnst(const ir_node *node); void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \ const ia32_register_req_t **out_reqs, const be_execution_unit_t ***execution_units, int n_res, unsigned latency); +/** + * Registers the ia32_copy_attr function for all ia32 opcodes. + */ +void ia32_register_copy_attr_func(void); + /* Include the generated headers */ #include "gen_ia32_new_nodes.h" -- 2.20.1