From 302872956d772c0480f371bfa57fe88471cee02c Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 23 Jun 2010 11:24:56 +0000 Subject: [PATCH] remove the (mis-)feature of arch_get_irn_reg_req_out working on mode_T nodes and retruning no_reqs in this case [r27648] --- ir/be/beabi.c | 2 ++ ir/be/bearch.h | 10 +++++++--- ir/be/becopyopt.c | 10 ++++++++-- ir/be/beschednormal.c | 14 +++++++++++--- ir/be/bespillutil.c | 3 +++ ir/be/ia32/ia32_x87.c | 4 +--- 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 63f58b84d..8be3fb2a5 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -2412,6 +2412,8 @@ static void collect_stack_nodes_walker(ir_node *node, void *data) if (arch_irn_get_n_outs(insn) == 0) return; + if (get_irn_mode(node) == mode_T) + return; req = arch_get_register_req_out(node); if (! (req->type & arch_register_req_type_produces_sp)) diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 0b3d499e1..cfbb9059f 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -38,6 +38,7 @@ #include "beinfo.h" #include "be.h" #include "beirg.h" +#include "error.h" typedef enum arch_register_class_flags_t { arch_register_class_flag_none = 0, @@ -774,13 +775,16 @@ static inline const arch_register_req_t *arch_get_register_req_out( int pos = 0; backend_info_t *info; + /* you have to query the Proj nodes for the constraints (or use + * arch_get_out_register_req. Querying a mode_T node and expecting + * arch_no_register_req is a bug in your code! */ + assert(get_irn_mode(irn) != mode_T); + if (is_Proj(irn)) { pos = get_Proj_proj(irn); irn = get_Proj_pred(irn); - } else if (get_irn_mode(irn) == mode_T) { - /* TODO: find out who does this and fix the caller! */ - return arch_no_register_req; } + info = be_get_info(irn); if (info->out_infos == NULL) return arch_no_register_req; diff --git a/ir/be/becopyopt.c b/ir/be/becopyopt.c index 57cd046dd..b7afd3054 100644 --- a/ir/be/becopyopt.c +++ b/ir/be/becopyopt.c @@ -391,10 +391,13 @@ static int ou_max_ind_set_costs(unit_t *ou) static void co_collect_units(ir_node *irn, void *env) { - const arch_register_req_t *req = arch_get_register_req_out(irn); + const arch_register_req_t *req; copy_opt_t *co = env; unit_t *unit; + if (get_irn_mode(irn) == mode_T) + return; + req = arch_get_register_req_out(irn); if (req->cls != co->cls) return; if (!co_is_optimizable_root(irn)) @@ -796,11 +799,14 @@ static inline void add_edges(copy_opt_t *co, ir_node *n1, ir_node *n2, int costs static void build_graph_walker(ir_node *irn, void *env) { - const arch_register_req_t *req = arch_get_register_req_out(irn); + const arch_register_req_t *req; copy_opt_t *co = env; int pos, max; const arch_register_t *reg; + if (get_irn_mode(irn) == mode_T) + return; + req = arch_get_register_req_out(irn); if (req->cls != co->cls || arch_irn_is_ignore(irn)) return; diff --git a/ir/be/beschednormal.c b/ir/be/beschednormal.c index 40251e0ae..7b8003c5f 100644 --- a/ir/be/beschednormal.c +++ b/ir/be/beschednormal.c @@ -119,6 +119,9 @@ static int count_result(const ir_node* irn) if (mode == mode_M || mode == mode_X) return 0; + if (mode == mode_T) + return 1; + if (arch_get_register_req_out(irn)->type & arch_register_req_type_ignore) return 0; @@ -194,9 +197,14 @@ static int normal_tree_cost(ir_node* irn, instance_t *inst) last = 0; for (i = 0; i < arity; ++i) { ir_node* op = fc->costs[i].irn; - if (op == last) continue; - if (get_irn_mode(op) == mode_M) continue; - if (arch_irn_is_ignore(op)) continue; + ir_mode* mode; + if (op == last) + continue; + mode = get_irn_mode(op); + if (mode == mode_M) + continue; + if (mode != mode_T && arch_irn_is_ignore(op)) + continue; cost = MAX(fc->costs[i].cost + n_op_res, cost); last = op; ++n_op_res; diff --git a/ir/be/bespillutil.c b/ir/be/bespillutil.c index 6631132ea..fd5c47702 100644 --- a/ir/be/bespillutil.c +++ b/ir/be/bespillutil.c @@ -564,6 +564,9 @@ static int is_value_available(spill_env_t *env, const ir_node *arg, (void)reloader; + if (get_irn_mode(arg) == mode_T) + return 0; + /* * Ignore registers are always available */ diff --git a/ir/be/ia32/ia32_x87.c b/ir/be/ia32/ia32_x87.c index 2e6c57f27..7429188d3 100644 --- a/ir/be/ia32/ia32_x87.c +++ b/ir/be/ia32/ia32_x87.c @@ -755,9 +755,7 @@ static vfp_liveness vfp_liveness_transfer(ir_node *irn, vfp_liveness live) live &= ~(1 << arch_register_get_index(reg)); } } - } - - if (arch_irn_consider_in_reg_alloc(cls, irn)) { + } else if (arch_irn_consider_in_reg_alloc(cls, irn)) { const arch_register_t *reg = x87_get_irn_register(irn); live &= ~(1 << arch_register_get_index(reg)); } -- 2.20.1