From d08aec54ed5dd583e9ac0d87fd24b1bf900a1aa9 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 18 Oct 2006 09:06:27 +0000 Subject: [PATCH] Change the if conversion backend hook [r8357] --- ir/opt/ifconv.c | 10 ++++++---- ir/opt/ifconv.h | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ir/opt/ifconv.c b/ir/opt/ifconv.c index 8be31fbf2..58f90348e 100644 --- a/ir/opt/ifconv.c +++ b/ir/opt/ifconv.c @@ -43,7 +43,8 @@ DEBUG_ONLY(firm_dbg_module_t *dbg); /** allow every Psi to be created. */ -static int default_allow_mux(ir_node *sel, ir_node *false_res, ir_node *true_res) { +static int default_allow_ifconv(ir_node *sel, ir_node* phi_list, int i, int j) +{ return 1; } @@ -52,7 +53,7 @@ static int default_allow_mux(ir_node *sel, ir_node *false_res, ir_node *true_res */ static const opt_if_conv_info_t default_info = { 0, /* doesn't matter for Psi */ - default_allow_mux + default_allow_ifconv }; /** @@ -275,7 +276,6 @@ restart: /* We only handle boolean decisions, no switches */ if (get_irn_mode(get_Cond_selector(cond)) != mode_b) continue; - if (! opt_info->allow_mux(get_Cond_selector(cond), NULL, NULL)) continue; for (j = i + 1; j < arity; ++j) { ir_node* projx1; @@ -293,6 +293,9 @@ restart: if (projx1 == NULL) continue; + phi = get_block_blockinfo(block)->phi; + if (!opt_info->allow_ifconv(get_Cond_selector(cond), phi, i, j)) continue; + DB((dbg, LEVEL_1, "Found Cond %+F with proj %+F and %+F\n", cond, projx0, projx1 )); @@ -304,7 +307,6 @@ restart: conds[0] = get_Cond_selector(cond); psi_block = get_nodes_block(cond); - phi = get_block_blockinfo(block)->phi; do { ir_node* val_i = get_irn_n(phi, i); ir_node* val_j = get_irn_n(phi, j); diff --git a/ir/opt/ifconv.h b/ir/opt/ifconv.h index 04e9672bd..3672da4a3 100644 --- a/ir/opt/ifconv.h +++ b/ir/opt/ifconv.h @@ -26,10 +26,11 @@ * If it returns non-zero, a mux is created, else the code * is not modified. * @param sel A selector of a Cond. - * @param false_res Selected value if condition is false. - * @param true_res Selected value if condition is true. + * @param phi_list First phi in a list linked via link field + * @param i First data predecessor involved in if conversion + * @param j Second data predecessor involved in if conversion */ -typedef int (*arch_allow_mux_func)(ir_node *sel, ir_node *false_res, ir_node *true_res); +typedef int (*arch_allow_ifconv_func)(ir_node *sel, ir_node* phi_list, int i, int j); /** * The parameters structure. @@ -38,7 +39,7 @@ typedef struct _opt_if_conv_info_t { int max_depth; /**< The maximum depth up to which expressions are examined when it has to be decided if they can be placed into another block. */ - arch_allow_mux_func allow_mux; /**< Evaluator function, if not set all possible Mux + arch_allow_ifconv_func allow_ifconv; /**< Evaluator function, if not set all possible Psi nodes will be created. */ } opt_if_conv_info_t; -- 2.20.1