no environment anymore for emitters
[libfirm] / ir / be / beschedmris.c
index 54463c0..371616a 100644 (file)
@@ -1,10 +1,33 @@
+/*
+ * 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       Implements a list scheduler for the MRIS algorithm.
+ * @author      Sebastian Hack
+ * @date        04.04.2006
+ * @version     $Id$
+ *
  * Implements a list scheduler for the MRIS algorithm in:
  * Govindarajan, Yang, Amaral, Zhang, Gao
  * Minimum Register Instruction Sequencing to Reduce Register Spills
  * in out-of-order issue superscalar architectures
- * @author Sebastian Hack
- * @date   04.04.2006
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "irgwalk.h"
 #include "irtools.h"
 #include "irbitset.h"
-
 #include "height.h"
 
 #include "benode_t.h"
 #include "besched_t.h"
 #include "beschedmris.h"
 #include "benodesets.h"
+#include "beirg.h"
 
 struct _mris_env_t {
-       phase_t            ph;
+       ir_phase          ph;
        heights_t         *heights;
        const arch_env_t  *aenv;
        ir_graph          *irg;
@@ -57,9 +80,10 @@ typedef struct _mris_irn_t {
 #define get_mris_irn(env, irn)   ((mris_irn_t *) phase_get_or_set_irn_data(&env->ph, irn))
 #define foreach_lineage(env, pos, tmp) list_for_each_entry_safe(mris_irn_t, pos, tmp, &(env)->lineage_head, lineage_list)
 
-static void *mris_irn_data_init(phase_t *ph, ir_node *irn, void *data)
+static void *mris_irn_data_init(ir_phase *ph, ir_node *irn, void *data)
 {
        mris_irn_t *mi = data ? data : phase_alloc(ph, sizeof(mi[0]));
+       (void) irn;
        memset(mi, 0, sizeof(mi[0]));
        INIT_LIST_HEAD(&mi->lineage_list);
        return mi;
@@ -487,17 +511,18 @@ void dump_ir_block_graph_mris(mris_env_t *env, const char *suffix) {
 mris_env_t *be_sched_mris_preprocess(const be_irg_t *birg)
 {
        mris_env_t *env = xmalloc(sizeof(env[0]));
+       ir_graph   *irg = be_get_birg_irg(birg);
 
-       phase_init(&env->ph, "mris", birg->irg, 2 * PHASE_DEFAULT_GROWTH, mris_irn_data_init);
-       env->aenv     = birg->main_env->arch_env;
-       env->irg      = birg->irg;
+       phase_init(&env->ph, "mris", irg, 2 * PHASE_DEFAULT_GROWTH, mris_irn_data_init, NULL);
+       env->aenv     = be_get_birg_arch_env(birg);
+       env->irg      = irg;
        env->visited  = 0;
-       env->heights  = heights_new(birg->irg);
+       env->heights  = heights_new(irg);
        INIT_LIST_HEAD(&env->lineage_head);
        FIRM_DBG_REGISTER(env->dbg, "firm.be.sched.mris");
        obstack_init(&env->obst);
-       irg_walk_graph(env->irg, firm_clear_link, NULL, NULL);
-       irg_block_walk_graph(birg->irg, block_walker, NULL, env);
+       irg_walk_graph(irg, firm_clear_link, NULL, NULL);
+       irg_block_walk_graph(irg, block_walker, NULL, env);
        obstack_free(&env->obst, NULL);
        // dump_ir_block_graph_mris(env, "-mris");
        return env;