X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fbeschednormal.c;h=e32ebef8509625fbe4e61285c81ac5ac1127aa5f;hb=6ee1fce95429dbf57fda4455ca5f2cf011ac8190;hp=cff3a87ca8fbc513729dd786bf2f19d556c8120f;hpb=e9237e148a4cd289c02e4800f094cd64445fd2fd;p=libfirm diff --git a/ir/be/beschednormal.c b/ir/be/beschednormal.c index cff3a87ca..e32ebef85 100644 --- a/ir/be/beschednormal.c +++ b/ir/be/beschednormal.c @@ -1,20 +1,6 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. - * * This file is part of libFirm. - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * Licensees holding valid libFirm Professional Edition licenses may use - * this file in accordance with the libFirm Commercial License. - * Agreement provided with the Software. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. + * Copyright (C) 2012 University of Karlsruhe. */ /** @@ -49,7 +35,7 @@ typedef struct instance_t { static int must_be_scheduled(const ir_node* const irn) { - return !is_Proj(irn) && !is_Sync(irn); + return !is_Proj(irn) && !arch_irn_is(irn, not_scheduled); } @@ -116,7 +102,8 @@ static int count_result(const ir_node* irn) if (mode == mode_T) return 1; - if (arch_get_irn_register_req(irn)->type & arch_register_req_type_ignore) + arch_register_req_t const *const req = arch_get_irn_register_req(irn); + if (arch_register_req_is(req, ignore)) return 0; return 1; @@ -157,7 +144,7 @@ static int normal_tree_cost(ir_node* irn, instance_t *inst) for (i = 0; i < arity; ++i) { ir_node* pred = get_irn_n(irn, i); - if (is_Phi(irn) || get_irn_mode(pred) == mode_M || is_Block(pred)) { + if (is_Phi(irn) || get_irn_mode(pred) == mode_M) { cost = 0; } else if (get_nodes_block(pred) != block) { cost = 1; @@ -194,9 +181,7 @@ static int normal_tree_cost(ir_node* irn, instance_t *inst) mode = get_irn_mode(op); if (mode == mode_M) continue; - if (arch_get_irn_flags(op) & arch_irn_flags_not_scheduled) - continue; - if (mode != mode_T && arch_irn_is_ignore(op)) + if (arch_irn_is_ignore(op)) continue; cost = MAX(fc->costs[i].cost + n_op_res, cost); last = op; @@ -220,7 +205,11 @@ static void normal_cost_walker(ir_node* irn, void* env) #if defined NORMAL_DBG ir_fprintf(stderr, "cost walking node %+F\n", irn); #endif - if (is_Block(irn)) return; + if (is_Block(irn)) { + ir_node **const roots = NEW_ARR_F(ir_node*, 0); + set_irn_link(irn, roots); + return; + } if (!must_be_scheduled(irn)) return; normal_tree_cost(irn, inst); } @@ -232,7 +221,6 @@ static void collect_roots(ir_node* irn, void* env) (void)env; - if (is_Block(irn)) return; if (!must_be_scheduled(irn)) return; is_root = be_is_Keep(irn) || !get_irn_fc(irn)->no_root; @@ -244,9 +232,6 @@ static void collect_roots(ir_node* irn, void* env) if (is_root) { ir_node* block = get_nodes_block(irn); ir_node** roots = (ir_node**)get_irn_link(block); - if (roots == NULL) { - roots = NEW_ARR_F(ir_node*, 0); - } ARR_APP1(ir_node*, roots, irn); set_irn_link(block, roots); } @@ -256,7 +241,6 @@ static void collect_roots(ir_node* irn, void* env) static ir_node** sched_node(ir_node** sched, ir_node* irn) { if (irn_visited_else_mark(irn)) return sched; - if (is_End(irn)) return sched; if (!is_Phi(irn) && !be_is_Keep(irn)) { ir_node* block = get_nodes_block(irn); @@ -310,7 +294,6 @@ static void normal_sched_block(ir_node* block, void* env) { ir_node** roots = (ir_node**)get_irn_link(block); ir_heights_t* heights = (ir_heights_t*)env; - int root_count; irn_cost_pair* root_costs; int i; ir_node** sched; @@ -319,14 +302,14 @@ static void normal_sched_block(ir_node* block, void* env) ir_fprintf(stderr, "sched walking block %+F\n", block); #endif - if (roots == NULL) { + int const root_count = ARR_LEN(roots); + if (root_count == 0) { #if defined NORMAL_DBG fprintf(stderr, "has no roots\n"); #endif return; } - root_count = ARR_LEN(roots); NEW_ARR_A(irn_cost_pair, root_costs, root_count); for (i = 0; i < root_count; ++i) { root_costs[i].irn = roots[i];