add correct compare functions for be nodes
[libfirm] / ir / be / beblocksched.c
index 9d744a7..74187b7 100644 (file)
@@ -1,12 +1,31 @@
 /*
- * Author:      Matthias Braun, Christoph Mallon
- * Date:               27.09.2006
- * Copyright:   (c) Universitaet Karlsruhe
- * License:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- * CVS-Id:      $Id$
+ * 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       Block-scheduling strategies.
+ * @author      Matthias Braun, Christoph Mallon
+ * @date        27.09.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
 #endif
 
 #include "beblocksched.h"
 
 #include "iredges.h"
 #include "irgwalk.h"
+#include "irnode_t.h"
 #include "irgraph_t.h"
 #include "irloop.h"
 #include "irprintf.h"
+#include "execfreq.h"
 #include "irdump_t.h"
 #include "irtools.h"
 #include "debug.h"
@@ -322,6 +343,7 @@ static blocksched_entry_t *finish_block_schedule(blocksched_env_t *env)
        ir_node            *startblock = get_irg_start_block(irg);
        blocksched_entry_t *entry      = get_irn_link(startblock);
 
+       set_using_visited(irg);
        inc_irg_visited(irg);
 
        env->worklist = new_pdeq();
@@ -329,6 +351,8 @@ static blocksched_entry_t *finish_block_schedule(blocksched_env_t *env)
        assert(pdeq_empty(env->worklist));
        del_pdeq(env->worklist);
 
+       clear_using_visited(irg);
+
        return entry;
 }
 
@@ -538,7 +562,7 @@ static void coalesce_blocks_ilp(blocksched_ilp_env_t *env)
                if (is_Bad(get_Block_cfgpred(block, 0)))
                        continue;
 
-               is_jump = lpp_get_var_sol(env->lpp, edge->ilpvar);
+               is_jump = (int)lpp_get_var_sol(env->lpp, edge->ilpvar);
                if (is_jump)
                        continue;
 
@@ -608,8 +632,7 @@ static void add_block(anchor *list, ir_node *block) {
        if (list->start == NULL) {
                list->start = block;
                list->end   = block;
-       }
-       else {
+       } else {
                set_irn_link(list->end, block);
                list->end = block;
        }
@@ -669,7 +692,11 @@ static ir_node **create_extbb_block_schedule(ir_graph *irg, ir_exec_freq *execfr
        list.start  = NULL;
        list.end    = NULL;
        list.n_blks = 0;
+
+       set_using_irn_link(irg);
+       set_using_visited(irg);
        inc_irg_block_visited(irg);
+
        create_block_list(get_irg_start_block(irg), &list);
 
        /** create an array, so we can go forward and backward */
@@ -680,6 +707,9 @@ static ir_node **create_extbb_block_schedule(ir_graph *irg, ir_exec_freq *execfr
                blk_list[i] = b;
        }
 
+       clear_using_irn_link(irg);
+       clear_using_visited(irg);
+
        return blk_list;
 }