Fixed initialization of option tables
[libfirm] / ir / be / belistsched.c
index e92a4fa..7238e9d 100644 (file)
@@ -1,9 +1,28 @@
+/*
+ * 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.
+ */
+
 /**
- * Scheduling algorithms.
- * Just a simple list scheduling algorithm is here.
- * @date   20.10.2004
- * @author Sebastian Hack
- * @cvs-id $Id$
+ * @file
+ * @brief       Primitive list scheduling with different node selectors.
+ * @author      Sebastian Hack
+ * @date        20.10.2004
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -38,8 +57,9 @@
 #include "belistsched.h"
 #include "beschedmris.h"
 #include "beschedrss.h"
-#include "bearch.h"
+#include "bearch_t.h"
 #include "bestat.h"
+#include "beirg_t.h"
 
 #include <libcore/lc_opts.h>
 #include <libcore/lc_opts_enum.h>
@@ -276,10 +296,11 @@ static int get_num_successors(ir_node *irn) {
                        ir_node *proj = get_edge_src_irn(edge);
                        ir_mode *mode = get_irn_mode(proj);
 
-                       if (mode == mode_T)
+                       if (mode == mode_T) {
                                sum += get_num_successors(proj);
-                       else if (mode_is_datab(mode))
+                       } else if (mode_is_datab(mode)) {
                                sum += get_irn_n_edges(proj);
+                       }
                }
        }
        else {
@@ -295,7 +316,7 @@ static int get_num_successors(ir_node *irn) {
 
 /**
  * Adds irn to @p live, updates all inputs that this user is scheduled
- * and counts all of it's non scheduled users.
+ * and counts all of its non scheduled users.
  */
 static void update_sched_liveness(block_sched_env_t *env, ir_node *irn) {
        int i;
@@ -308,8 +329,7 @@ static void update_sched_liveness(block_sched_env_t *env, ir_node *irn) {
                ir_node *in = get_irn_in_or_dep(irn, i);
 
                /* if in is a proj: update predecessor */
-               while (is_Proj(in))
-                       in = get_Proj_pred(in);
+               in = skip_Proj(in);
 
                /* if in is still in the live set: reduce number of users by one */
                if (ir_nodeset_contains(&env->live, in)) {
@@ -489,10 +509,9 @@ static void list_sched_block(ir_node *block, void *env_ptr)
                                if (get_nodes_block(operand) == block) {
                                        ready = 0;
                                        break;
-                               }
-                               else {
+                               } else {
                                        /* live in values increase register pressure */
-                                       update_sched_liveness(&be, operand);
+                                       ir_nodeset_insert(&be.live, operand);
                                }
                        }