From c6e8578501b64a525e98b222894918e7a4512708 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 5 Oct 2008 17:34:39 +0000 Subject: [PATCH] Clean up need_constraint_copy(). [r22503] --- ir/be/ia32/ia32_finish.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/ir/be/ia32/ia32_finish.c b/ir/be/ia32/ia32_finish.c index 02afd1c0f..47b6f2907 100644 --- a/ir/be/ia32/ia32_finish.c +++ b/ir/be/ia32/ia32_finish.c @@ -208,18 +208,25 @@ static void ia32_transform_sub_to_neg_add(ir_node *irn, ia32_code_gen_t *cg) { DBG_OPT_SUB2NEGADD(irn, res); } -static INLINE int need_constraint_copy(ir_node *irn) { - /* the 3 operand form of IMul needs no constraint copy */ - if(is_ia32_IMul(irn)) { - ir_node *right = get_irn_n(irn, n_ia32_IMul_right); - if(is_ia32_Immediate(right)) +static INLINE int need_constraint_copy(ir_node *irn) +{ + /* TODO this should be determined from the node specification */ + switch (get_ia32_irn_opcode(irn)) { + case iro_ia32_IMul: { + /* the 3 operand form of IMul needs no constraint copy */ + ir_node *right = get_irn_n(irn, n_ia32_IMul_right); + return !is_ia32_Immediate(right); + } + + case iro_ia32_Lea: + case iro_ia32_Conv_I2I: + case iro_ia32_Conv_I2I8Bit: + case iro_ia32_CMov: return 0; - } - return ! is_ia32_Lea(irn) && - ! is_ia32_Conv_I2I(irn) && - ! is_ia32_Conv_I2I8Bit(irn) && - ! is_ia32_CMov(irn); + default: + return 1; + } } /** -- 2.20.1