#include "irnode_t.h"
#include "ircons_t.h"
#include "irloop_t.h"
-#include "phiclass_t.h"
+#include "irnodeset.h"
+#include "phiclass.h"
#include "iredges.h"
#include "execfreq.h"
#include "irvrfy.h"
#include <lpp/mps.h>
#include <lpp/lpp_net.h>
#include <lpp/lpp_cplex.h>
-//#include <lc_pset.h>
-//#include <libcore/lc_bitset.h>
#include "be_t.h"
+#include "beirg_t.h"
#include "belive_t.h"
#include "besched_t.h"
-#include "beirgmod.h"
-#include "bearch.h"
+#include "bessaconstr.h"
+#include "bearch_t.h"
#include "beabi.h"
#include "benode_t.h"
#include "beutil.h"
#include "bechordal_t.h"
-#ifdef WITH_LIBCORE
#include <libcore/lc_opts.h>
#include <libcore/lc_opts_enum.h>
-#endif /* WITH_LIBCORE */
#define DUMP_PROBLEM 1
#define DUMP_MPS 2
#define REMATS_NOINVERSE 2
#define REMATS_ALL 3
-static int opt_dump_flags = 0;
+static unsigned opt_dump_flags = 0;
static int opt_log = 0;
-static int opt_keep_alive = 0;
+static unsigned opt_keep_alive = 0;
static int opt_goodwin = 1;
static int opt_memcopies = 1;
static int opt_memoperands = 1;
static int opt_verify = VERIFY_MEMINTERF;
-static int opt_remats = REMATS_ALL;
+static unsigned opt_remats = REMATS_ALL;
static int opt_repair_schedule = 0;
static int opt_no_enlarge_liveness = 0;
static int opt_remat_while_live = 1;
static double opt_cost_remat = 1.0;
-#ifdef WITH_LIBCORE
static const lc_opt_enum_mask_items_t dump_items[] = {
{ "problem", DUMP_PROBLEM },
{ "mps", DUMP_MPS },
{ NULL }
};
-#endif
-
-
//#define EXECFREQ_LOOPDEPH /* compute execution frequency from loop depth only */
//#define SCHEDULE_PHIM /* insert phim nodes into schedule */
del_pset(use_end);
}
+#ifndef NDEBUG
/**
* Find a remat of value @p value in the epilog of @p pos
*/
return NULL;
}
+#endif
static spill_t *
add_to_spill_bb(spill_ilp_t * si, ir_node * bb, ir_node * irn)
pset *used;
pset *remat_defs;
keyval_t *keyval;
- ilp_cst_t one_memoperand;
+ ilp_cst_t one_memoperand = -1;
/* iterate only until first phi */
if(is_Phi(irn))
assert(has_reg_class(si, tmp));
}
+#ifndef NDEBUG
for (n=get_irn_arity(irn)-1; n>=0; --n) {
ir_node *arg = get_irn_n(irn, n);
assert(!find_post_remat(arg, irn) && "there should be no post remat for an argument of an op");
}
+#endif
del_pset(remat_defs);
del_pset(used);
}
set_foreach(si->interferences, interference) {
- const ir_node *a = interference->a;
- const ir_node *b = interference->b;
- if (get_phi_class(si->pc, a) == phiclass) {
+ const ir_node *a = interference->a;
+ const ir_node *b = interference->b;
+ if (get_phi_class(si->pc, (ir_node *)a) == phiclass) {
ir_fprintf(f, " %F%N -> %F%N [color=red,dir=none,style=bold]\n", a, a, b, b);
}
}
rewire_uses(spill_ilp_t * si)
{
defs_t *defs;
- pset *ignore = pset_new_ptr(1);
- be_dom_front_info_t *dom_front = si->birg->dom_front;
+ ir_nodeset_t ignore;
- pset_insert_ptr(ignore, get_irg_end(si->birg->irg));
+ ir_nodeset_init(&ignore);
+ ir_nodeset_insert(&ignore, get_irg_end(si->birg->irg));
/* then fix uses of spills */
set_foreach(si->values, defs) {
spills = get_spills_for_value(si, defs->value);
DBG((si->dbg, LEVEL_2, "\t %d remats, %d reloads, and %d spills for value %+F\n", remats, pset_count(reloads), pset_count(spills), defs->value));
if(pset_count(spills) > 1) {
+ be_ssa_construction_env_t senv;
+ ir_node *node;
//assert(pset_count(reloads) > 0);
// print_irn_pset(spills);
// print_irn_pset(reloads);
- be_ssa_constr_set_ignore(dom_front, si->lv, spills, ignore);
+ be_ssa_construction_init(&senv, si->birg);
+ be_ssa_construction_set_ignore_uses(&senv, &ignore);
+ pset_foreach(spills, node) {
+ be_ssa_construction_add_copy(&senv, node);
+ }
+ pset_foreach(spills, node) {
+ be_ssa_construction_fix_users(&senv, node);
+ }
+ be_ssa_construction_update_liveness_phis(&senv, si->lv);
+ pset_foreach(spills, node) {
+ be_liveness_update(si->lv, node);
+ }
+ be_ssa_construction_destroy(&senv);
}
del_pset(reloads);
/* first fix uses of remats and reloads */
set_foreach(si->values, defs) {
- pset *nodes;
const ir_node *next = defs->remats;
int orig_kept = 0;
if(next) {
- nodes = pset_new_ptr_default();
+ be_ssa_construction_env_t senv;
+
+ be_ssa_construction_init(&senv, si->birg);
+
if(sched_is_scheduled(defs->value)) {
- pset_insert_ptr(nodes, defs->value);
+ be_ssa_construction_add_copy(&senv, (ir_node*) defs->value);
orig_kept = 1;
}
+ next = defs->remats;
while(next) {
- pset_insert_ptr(nodes, next);
+ be_ssa_construction_add_copy(&senv, (ir_node*) next);
next = get_irn_link(next);
}
- DBG((si->dbg, LEVEL_4, "\t %d new definitions for value %+F\n", pset_count(nodes)-orig_kept, defs->value));
- be_ssa_constr_set(dom_front, si->lv, nodes);
+ if(sched_is_scheduled(defs->value)) {
+ be_ssa_construction_fix_users(&senv, (ir_node*) defs->value);
+ }
+
+ next = defs->remats;
+ while(next) {
+ be_ssa_construction_fix_users(&senv, (ir_node*) next);
+ next = get_irn_link(next);
+ }
+
+ be_ssa_construction_update_liveness_phis(&senv, si->lv);
+ if(sched_is_scheduled(defs->value)) {
+ be_liveness_update(si->lv, (ir_node*) defs->value);
+ }
+
+ next = defs->remats;
+ while(next) {
+ be_liveness_update(si->lv, (ir_node*) next);
+ next = get_irn_link(next);
+ }
- del_pset(nodes);
+ be_ssa_construction_destroy(&senv);
}
}
+ ir_nodeset_destroy(&ignore);
// remove_unused_defs(si);
}
{
/* analyze phi classes */
phi_class_free(si->pc);
- si->pc = phi_class_new_from_irg(si->birg->irg);
+ si->pc = phi_class_new_from_irg(si->birg->irg, 0);
DBG((si->dbg, LEVEL_2, "\t calling memory interference checker\n"));
irg_block_walk_graph(si->birg->irg, luke_meminterferencechecker, NULL, si);
DBG((si.dbg, LEVEL_2, "\t blockwalker\n"));
irg_block_walk_graph(irg, luke_blockwalker, NULL, &si);
- si.pc = phi_class_new_from_irg(birg->irg);
+ si.pc = phi_class_new_from_irg(birg->irg, 0);
if (opt_memcopies) {
DBG((si.dbg, LEVEL_2, "\t memcopyhandler\n"));
memcopyhandler(&si);