X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeuses.c;h=f4d802c6d64d1ddd21ac3068d825a5e964903447;hb=9276447aec4972df060349e162f583c4898dfec8;hp=942499a6ed6f03414ddc635440d231bbb4b5d84f;hpb=0c92b911be3d9d02b4a49b2a142dab8d7ba978a6;p=libfirm diff --git a/ir/be/beuses.c b/ir/be/beuses.c index 942499a6e..f4d802c6d 100644 --- a/ir/be/beuses.c +++ b/ir/be/beuses.c @@ -1,12 +1,28 @@ -/** - * @file beuse.c - * @date 27.06.2005 - * @author Sebastian Hack, Matthias Braun +/* + * Copyright (C) 1995-2007 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. * - * Methods to compute when a value will be used again. + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. * - * Copyright (C) 2005 Universitaet Karlsruhe - * Released under the GPL + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +/** + * @file + * @brief Methods to compute when a value will be used again. + * @author Sebastian Hack, Matthias Braun + * @date 27.06.2005 + * @version $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -33,8 +49,8 @@ #include "benode_t.h" #include "besched_t.h" #include "beirgmod.h" -#include "bearch.h" -#include "beuses_t.h" +#include "bearch_t.h" +#include "beuses.h" #include "benodesets.h" #define SCAN_INTERBLOCK_USES @@ -105,7 +121,7 @@ static const be_use_t *get_or_set_use_block(be_uses_t *env, static int be_is_phi_argument(const be_lv_t *lv, const ir_node *block, const ir_node *def) { ir_node *node; - ir_node *succ_block; + ir_node *succ_block = NULL; const ir_edge_t *edge; int arity, i; @@ -170,17 +186,18 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, const ir_node *operand = get_irn_n(node, i); if (operand == def) { + be_next_use_t result; + DBG((env->dbg, LEVEL_3, "found use of %+F at %+F\n", operand, node)); /** * Spills/Reloads are a special case, they're not really a * usage of a value, continue searching */ - if(be_is_Spill(node) || be_is_Reload(node)) { + if (be_is_Spill(node) || be_is_Reload(node)) { return be_get_next_use(env, node, step, node, 1); } - be_next_use_t result; result.time = step; result.outermost_loop = get_loop_depth(get_irn_loop(block)); return result; @@ -218,7 +235,7 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, const be_use_t *use; const ir_node *succ_block = get_edge_src_irn(edge); ir_loop *succ_loop; - int use_dist; + unsigned use_dist; if(succ_block == startblock) continue; @@ -245,7 +262,7 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, succ_loop = get_irn_loop(succ_block); if(get_loop_depth(succ_loop) < loopdepth) { - int factor = (loopdepth - get_loop_depth(succ_loop)) * 5000; + unsigned factor = (loopdepth - get_loop_depth(succ_loop)) * 5000; DBG((env->dbg, LEVEL_5, "Increase usestep because of loop out edge %d -> %d (%u)\n", factor)); // TODO we should use the number of nodes in the loop or so... use_dist += factor;