Added a new order for the blocks.
[libfirm] / ir / be / beblocksched.c
index 6761eaf..ee4669a 100644 (file)
@@ -1,9 +1,28 @@
 /*
- * 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 "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"
@@ -61,7 +82,7 @@ static lc_opt_enum_int_var_t algo_var = {
 
 static const lc_opt_table_entry_t be_blocksched_options[] = {
        LC_OPT_ENT_ENUM_INT ("algo", "the block scheduling algorithm", &algo_var),
-       { NULL }
+       LC_OPT_LAST
 };
 
 /*
@@ -83,7 +104,7 @@ typedef struct _edge_t {
        ir_node *block;             /**< source block */
        int     pos;                /**< number of cfg predecessor (target) */
        double  execfreq;           /**< the frequency */
-       int     highest_execfreq;   /**< flag that indicates wether this edge is the edge with the highest
+       int     highest_execfreq;   /**< flag that indicates whether this edge is the edge with the highest
                                                                     execfreq pointing away from this block */
 } edge_t;
 
@@ -116,7 +137,7 @@ static void collect_egde_frequency(ir_node *block, void *data)
        if (block == get_irg_start_block(env->irg))
                return;
 
-       arity = get_irn_arity(block);
+       arity = get_Block_n_cfgpreds(block);
 
        if (arity == 1) {
                edge.block            = block;
@@ -341,6 +362,7 @@ static ir_node **create_blocksched_array(blocksched_env_t *env, blocksched_entry
        int                i = 0;
        ir_node            **block_list;
        blocksched_entry_t *entry;
+       (void) env;
 
        block_list = NEW_ARR_D(ir_node *, obst, count);
        DBG((dbg, LEVEL_1, "Blockschedule:\n"));