be_abi_put_ignore_regs returns now number of ignore registers as unsigned
[libfirm] / ir / be / bespillremat.c
index 0ad39f5..5aa573b 100644 (file)
@@ -1,12 +1,28 @@
-/** vim: set sw=4 ts=4:
- * @file   bespillremat.c
- * @date   2006-04-06
- * @author Adam M. Szalkowski & Sebastian Hack
+/*
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
  *
- * ILP based spilling & rematerialization
+ * This file is part of libFirm.
  *
- * Copyright (C) 2006 Universitaet Karlsruhe
- * Released under the GPL
+ * 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       ILP based spilling & rematerialization
+ * @author      Adam M. Szalkowski
+ * @date        06.04.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -31,7 +47,7 @@
 #include "irloop_t.h"
 #include "irnodeset.h"
 #include "phiclass.h"
-#include "iredges.h"
+#include "iredges_t.h"
 #include "execfreq.h"
 #include "irvrfy.h"
 #include "irbackedge_t.h"
 #include <lpp/lpp_cplex.h>
 
 #include "be_t.h"
+#include "beirg_t.h"
 #include "belive_t.h"
 #include "besched_t.h"
 #include "bessaconstr.h"
-#include "bearch.h"
+#include "bearch_t.h"
+#include "beintlive_t.h"
 #include "beabi.h"
 #include "benode_t.h"
 #include "beutil.h"
@@ -54,8 +72,8 @@
 #include "bepressurestat.h"
 #include "beprofile.h"
 #include "bespilloptions.h"
-
 #include "bechordal_t.h"
+#include "bemodule.h"
 
 #include <libcore/lc_opts.h>
 #include <libcore/lc_opts_enum.h>
@@ -2894,19 +2912,19 @@ set_insert_interference(spill_ilp_t * si, set * set, ir_node * a, ir_node * b, i
        return result;
 }
 
-static int
-values_interfere_in_block(const spill_ilp_t * si, const ir_node * bb, const ir_node * a, const ir_node * b)
+static
+int values_interfere_in_block(const spill_ilp_t *si, const ir_node *bb, const ir_node *a, const ir_node *b)
 {
        const ir_edge_t *edge;
 
-       if(get_nodes_block(a) != bb && get_nodes_block(b) != bb) {
+       if (get_nodes_block(a) != bb && get_nodes_block(b) != bb) {
                /* both values are live in, so they interfere */
                return 1;
        }
 
        /* ensure a dominates b */
-       if(value_dominates(b,a)) {
-               const ir_node * t;
+       if (value_dominates(b, a)) {
+               const ir_node *t;
                t = b;
                b = a;
                a = t;
@@ -2915,15 +2933,15 @@ values_interfere_in_block(const spill_ilp_t * si, const ir_node * bb, const ir_n
 
 
        /* the following code is stolen from bera.c */
-       if(be_is_live_end(si->lv, bb, a))
+       if (be_is_live_end(si->lv, bb, a))
                return 1;
 
        foreach_out_edge(a, edge) {
                const ir_node *user = edge->src;
-               if(get_nodes_block(user) == bb
-                               && !is_Phi(user)
+               if (get_nodes_block(user) == bb
+                               && ! is_Phi(user)
                                && b != user
-                               && !pset_find_ptr(si->inverse_ops, user)
+                               && ! pset_find_ptr(si->inverse_ops, user)
                                && value_dominates(b, user))
                        return 1;
        }
@@ -4184,7 +4202,6 @@ rewire_uses(spill_ilp_t * si)
 
        /* first fix uses of remats and reloads */
        set_foreach(si->values, defs) {
-               pset           *nodes;
                const ir_node  *next = defs->remats;
                int             orig_kept = 0;
 
@@ -4193,8 +4210,6 @@ rewire_uses(spill_ilp_t * si)
 
                        be_ssa_construction_init(&senv, si->birg);
 
-                       DBG((si->dbg, LEVEL_4, "\t    %d new definitions for value %+F\n", pset_count(nodes)-orig_kept, defs->value));
-
                        if(sched_is_scheduled(defs->value)) {
                                be_ssa_construction_add_copy(&senv, (ir_node*) defs->value);
                                orig_kept = 1;
@@ -4228,8 +4243,6 @@ rewire_uses(spill_ilp_t * si)
                        }
 
                        be_ssa_construction_destroy(&senv);
-
-                       del_pset(nodes);
                }
        }