/*
- * Project: libFIRM
- * File name: ir/opt/cfopt.c
- * Purpose: control flow optimizations
- * Author:
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2004 Universität Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * 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.
+ *
+ * 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
+ * @brief Control flow optimizations.
+ * @author Goetz Lindenmaier, Michael Beck, Sebastian Hack
+ * @version $Id$
+ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#include <assert.h>
#include "plist.h"
/* Use block visited flag to mark non-empty blocks. */
inc_irg_block_visited(irg);
+ set_using_block_visited(irg);
+ set_using_irn_link(irg);
list = plist_new();
irg_walk(end, merge_blocks, collect_nodes, list);
+ clear_using_block_visited(irg);
+ clear_using_irn_link(irg);
+
/* handle all collected switch-Conds */
foreach_plist(list, el) {
cond = plist_element_get_value(el);
if (n > 0)
NEW_ARR_A(ir_node *, in, n);
inc_irg_visited(irg);
+ set_using_visited(irg);
/* fix the keep alive */
for (i = j = 0; i < n; i++) {
}
if (j != n)
set_End_keepalives(end, j, in);
+
+ clear_using_visited(irg);
+
/* the verifier doesn't work yet with floating nodes */
if (get_irg_pinned(irg) == op_pin_state_pinned) {
/* after optimize_cf(), only Bad data flow may remain. */