X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fgvn_pre.c;h=87b072521187e734c23c2f1424871395ffa4e98f;hb=c7dc950ac0cdd7d24acffb798b5867d0db5dd7c8;hp=eca77db2680f08630572b7a8c2c01fe394ad7949;hpb=eb08138c6b80c169945568e4414f491a9bc20388;p=libfirm diff --git a/ir/opt/gvn_pre.c b/ir/opt/gvn_pre.c index eca77db26..87b072521 100644 --- a/ir/opt/gvn_pre.c +++ b/ir/opt/gvn_pre.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -17,21 +17,23 @@ * PURPOSE. */ -/* - * Project: libFIRM - * File name: ir/opt/gvn_pre.c - * Purpose: Global Value Numbering Partial Redundancy Elimination - * (VanDrunen Hosking 2004) - * Author: Michael Beck, Rubino Geiss - * Created: - * CVS-ID: $Id$ - * Copyright: (c) 1998-2006 Universität Karlsruhe +/** + * @file + * @brief Global Value Numbering Partial Redundancy Elimination + * (VanDrunen Hosking 2004) + * @author Michael Beck, Rubino Geiss + * @version $Id$ + * @summary + * + * Currently completely broken because our sets do NOT preserve + * the topological sort! */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include "iroptimize.h" + #include #include "irgraph_t.h" @@ -47,7 +49,6 @@ #include "ircons.h" #include "irgmod.h" #include "debug.h" -#include "gvn_pre.h" #include "xmalloc.h" /** The debug module handle. */ @@ -180,6 +181,7 @@ static int value_cmp(const void *elt, const void *key, size_t size) { const value_entry *e1 = elt; const value_entry *e2 = key; + (void) size; return identities_cmp(e1->value, e2->value); } @@ -444,10 +446,12 @@ static ir_node *translate(ir_node *node, ir_node *block, int pos, pre_env *env) node might depend on that. */ copy_node_attr(node, nn); res = node_add(env->trans_set, nn); - if (nn != res) + if (nn != res) { obstack_free(env->obst, nn); - else + } else { DB((dbg, LEVEL_2, "--> Translate %+F in <%+F,%d> into %+F\n", node, block, pos, res)); + } + return res; } return node; @@ -791,8 +795,9 @@ static void insert_nodes(ir_node *block, void *ctx) value_set_foreach(entry, idom_info->new_set) { updated |= value_add_or_replace(curr_info->avail_out, entry->node, entry->value); } - if (updated) + if (updated) { dump_value_set(curr_info->avail_out, "Updated [Avail_out]", block); + } if (arity <= 1) return; @@ -975,7 +980,7 @@ static void eliminate_nodes(elim_pair *pairs) /* * Argh: Endless loops cause problems, because the - * insert algorithm did not terminate. We get tranalated nodes that + * insert algorithm did not terminate. We get translated nodes that * references the origin. These nodes are translated again and again... * * The current fix is to use post-dominance. This simple ignores @@ -989,6 +994,8 @@ void do_gvn_pre(ir_graph *irg) block_info *p; unsigned antic_iter, insert_iter; + assert(!"COMPLETELY BROKEN YET, DO NOT USE"); + /* register a debug mask */ FIRM_DBG_REGISTER(dbg, "firm.opt.gvn_pre"); firm_dbg_set_mask(dbg, SET_LEVEL_2);