X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Firextbb2.c;h=2e01d01913e6a755b4777aeb69c8868af72060de;hb=00894f1e0b6e74ca6c12d253dd30f7d873808977;hp=6a1d936ba018e2817f1debb4fba6c491ba9609fb;hpb=00602b2a19331e614ba5e9d56a07ca68f884cded;p=libfirm diff --git a/ir/ana/irextbb2.c b/ir/ana/irextbb2.c index 6a1d936ba..2e01d0191 100644 --- a/ir/ana/irextbb2.c +++ b/ir/ana/irextbb2.c @@ -1,22 +1,36 @@ /* - * Project: libFIRM - * File name: ir/ana/irextbb2.c - * Purpose: Alternate extended basic block computation - * Author: Matthias Braun - * Created: 5.2005 - * CVS-ID: $Id$ - * Copyright: (c) 2002-2005 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * 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. */ /** - * @file irextbb2.c - * + * @file + * @brief Alternative extended basic block computation + * @author Matthias Braun + * @date 5.2005 + * @version $Id$ + * @summary * Alternative algorithm for computing extended basic blocks (using out edges * and execution frequencies) - * - * @author Matthias Braun */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "irextbb_t.h" #include "irgwalk.h" #include "irnode_t.h" @@ -30,7 +44,7 @@ typedef struct _env { struct obstack *obst; /**< the obstack where allocations took place */ ir_extblk *head; /**< head of the list of all extended blocks */ - exec_freq_t *execfreqs; + ir_exec_freq *execfreqs; } env_t; /** @@ -95,11 +109,10 @@ static void create_extblk(ir_node *block, env_t *env) { ir_extblk *extblk; - if (irn_visited(block)) + if (irn_visited_else_mark(block)) return; extblk = allocate_extblk(block, env); - mark_irn_visited(block); pick_successor(block, extblk, env); } @@ -168,7 +181,7 @@ static void pick_successor(ir_node *block, ir_extblk *extblk, env_t *env) /* * Compute the extended basic blocks for a graph */ -void compute_extbb_execfreqs(ir_graph *irg, exec_freq_t *execfreqs) { +void compute_extbb_execfreqs(ir_graph *irg, ir_exec_freq *execfreqs) { env_t env; ir_extblk *extbb, *next; ir_node *endblock; @@ -177,7 +190,7 @@ void compute_extbb_execfreqs(ir_graph *irg, exec_freq_t *execfreqs) { obstack_free(irg->extbb_obst, NULL); } else { - irg->extbb_obst = xmalloc(sizeof(*irg->extbb_obst)); + irg->extbb_obst = XMALLOC(struct obstack); } obstack_init(irg->extbb_obst); @@ -193,9 +206,7 @@ void compute_extbb_execfreqs(ir_graph *irg, exec_freq_t *execfreqs) { /* the end block needs a extbb assigned (even for endless loops) */ endblock = get_irg_end_block(irg); - if (! irn_visited(endblock)) { - create_extblk(endblock, &env); - } + create_extblk(endblock, &env); /* Ok, we have now the list of all extended blocks starting with env.head