X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeschedregpress.c;h=a77640935599dcf98c9dee696eb9a3ee9cfd721f;hb=9181bbbb24cd351c0e21c538bcf0341674e0c3fc;hp=0c8afed1c85c69aa73a6d88c18a7b493543bdc0b;hpb=e9237e148a4cd289c02e4800f094cd64445fd2fd;p=libfirm diff --git a/ir/be/beschedregpress.c b/ir/be/beschedregpress.c index 0c8afed1c..a77640935 100644 --- a/ir/be/beschedregpress.c +++ b/ir/be/beschedregpress.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. */ /** @@ -54,34 +40,6 @@ typedef struct { } reg_pressure_selector_env_t; -#if 0 -/* -* Ugly global variable for the compare function -* since qsort(3) does not pass an extra pointer. -*/ -static ir_node *curr_bl = NULL; - -static int cmp_usage(const void *a, const void *b) -{ - struct trivial_sched_env *env; - const ir_node *p = a; - const ir_node *q = b; - int res = 0; - - res = is_live_end(env->curr_bl, a) - is_live_end(env->curr_bl, b); - - /* - * One of them is live at the end of the block. - * Then, that one shall be scheduled at after the other - */ - if (res != 0) - return res; - - - return res; -} -#endif - static inline usage_stats_t *get_or_set_usage_stats(reg_pressure_selector_env_t *env, ir_node *irn) { usage_stats_t *us = (usage_stats_t*)get_irn_link(irn); @@ -152,8 +110,6 @@ static int compute_max_hops(reg_pressure_selector_env_t *env, ir_node *irn) ir_graph *irg = get_irn_irg(bl); int res = 0; - const ir_edge_t *edge; - foreach_out_edge(irn, edge) { ir_node *user = get_edge_src_irn(edge); unsigned visited_nr = get_irg_visited(irg) + 1; @@ -176,7 +132,6 @@ static void *reg_pressure_graph_init(ir_graph *irg) static void *reg_pressure_block_init(void *graph_env, ir_node *bl) { - ir_node *irn; reg_pressure_selector_env_t *env = XMALLOC(reg_pressure_selector_env_t); (void) graph_env; @@ -188,19 +143,9 @@ static void *reg_pressure_block_init(void *graph_env, ir_node *bl) * Collect usage statistics. */ sched_foreach(bl, irn) { - int i, n; - if (is_Proj(irn) - || (arch_get_irn_flags(irn) & arch_irn_flags_not_scheduled)) - continue; - - for (i = 0, n = get_irn_arity(irn); i < n; ++i) { + for (int i = 0, n = get_irn_arity(irn); i < n; ++i) { usage_stats_t *us = get_or_set_usage_stats(env, irn); -#if 0 /* Liveness is not computed here! */ - if (is_live_end(bl, op)) - us->uses_in_block = 99999; - else -#endif - us->uses_in_block++; + us->uses_in_block++; } } @@ -224,8 +169,6 @@ static int get_result_hops_sum(reg_pressure_selector_env_t *env, ir_node *irn) { int res = 0; if (get_irn_mode(irn) == mode_T) { - const ir_edge_t *edge; - foreach_out_edge(irn, edge) res += get_result_hops_sum(env, get_edge_src_irn(edge)); } @@ -259,10 +202,9 @@ static inline int reg_pr_costs(reg_pressure_selector_env_t *env, ir_node *irn) static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set) { - ir_nodeset_iterator_t iter; reg_pressure_selector_env_t *env = (reg_pressure_selector_env_t*)block_env; - ir_node *irn, *res = NULL; - int curr_cost = INT_MAX; + ir_node *res = NULL; + int curr_cost = INT_MAX; assert(ir_nodeset_size(ready_set) > 0);