bejavacoal.c becopyheur3.c bespillcost.c bespillremat.c \
bespillslots.h bespillslots.c beprofile.c \
bestatevent.h bestatevent.c be_dbgout.h bestabs.c beschedrss.c \
- beblocksched.h beblocksched.c
+ beblocksched.h beblocksched.c bespilloptions.c bespilloptions.h
include $(topdir)/MakeRules
#include "bespillbelady.h"
#include "bespillmorgan.h"
#include "bespillslots.h"
+#include "bespilloptions.h"
#include "belower.h"
#ifdef WITH_ILP
BE_CH_VRFY_WARN,
};
-/* coalesce spill slots */
-static int coalesce_spill_slots = 1;
-
/** The name of the file where the statistics are put to. */
static char stat_file_name[2048];
static const lc_opt_table_entry_t be_chordal_options[] = {
LC_OPT_ENT_STR ("statfile", "the name of the statisctics file", stat_file_name, sizeof(stat_file_name)),
- LC_OPT_ENT_BOOL ("spill.coal", "coalesce the spill slots", &coalesce_spill_slots),
LC_OPT_ENT_ENUM_INT ("spill", "spill method", &spill_var),
LC_OPT_ENT_ENUM_PTR ("ifg", "interference graph flavour", &ifg_flavor_var),
LC_OPT_ENT_ENUM_PTR ("perm", "perm lowering options", &lower_perm_var),
#ifdef WITH_ILP
be_spill_remat_register_options(chordal_grp);
#endif
+ be_spill_register_options(chordal_grp);
}
}
#endif /* WITH_LIBCORE */
BE_TIMER_PUSH(ra_timer.t_spillslots);
- be_coalesce_spillslots(&chordal_env, coalesce_spill_slots);
+ be_coalesce_spillslots(&chordal_env);
dump(BE_CH_DUMP_SPILLSLOTS, irg, NULL, "-spillslots", dump_ir_block_graph_sched);
BE_TIMER_POP(ra_timer.t_spillslots);
#include "bechordal_t.h"
#include "bejavacoal.h"
#include "benodesets.h"
+#include "bespilloptions.h"
+#include "bestatevent.h"
// only rematerialise when costs are less than REMAT_COST_LIMIT
// TODO determine a good value here...
int be_get_reload_costs(spill_env_t *env, ir_node *to_spill, ir_node *before) {
spill_info_t *spill_info;
- // is the node rematerializable?
- int costs = check_remat_conditions_costs(env, to_spill, before, 0);
- if(costs < REMAT_COST_LIMIT)
- return costs;
+ if(be_do_remats) {
+ // is the node rematerializable?
+ int costs = check_remat_conditions_costs(env, to_spill, before, 0);
+ if(costs < REMAT_COST_LIMIT)
+ return costs;
+ }
// do we already have a spill?
spill_info = find_spillinfo(env, to_spill);
void be_insert_spills_reloads(spill_env_t *env) {
const arch_env_t *arch_env = env->arch_env;
spill_info_t *si;
+ int remats = 0;
+ int reloads = 0;
+ int spills = 0;
/* process each spilled node */
for(si = set_first(env->spills); si; si = set_next(env->spills)) {
for(rld = si->reloaders; rld; rld = rld->next) {
ir_node *new_val;
- if (check_remat_conditions(env, si->spilled_node, rld->reloader)) {
+ if (be_do_remats && check_remat_conditions(env, si->spilled_node, rld->reloader)) {
new_val = do_remat(env, si->spilled_node, rld->reloader);
+ remats++;
} else {
/* make sure we have a spill */
- spill_node(env, si);
+ if(si->spill == NULL) {
+ spill_node(env, si);
+ spills++;
+ }
- /* do a reload */
+ /* create a reload */
new_val = be_reload(arch_env, env->cls, rld->reloader, mode, si->spill);
+ reloads++;
}
DBG((env->dbg, LEVEL_1, " %+F of %+F before %+F\n", new_val, si->spilled_node, rld->reloader));
si->reloaders = NULL;
}
+ if(be_stat_ev_is_active()) {
+ be_stat_ev("spill_spills", spills);
+ be_stat_ev("spill_reloads", reloads);
+ be_stat_ev("spill_remats", remats);
+ }
+
be_remove_dead_nodes_from_schedule(env->chordal_env->irg);
be_liveness_recompute(env->chordal_env->lv);
}
--- /dev/null
+/*
+ * Author: Daniel Grund, Sebastian Hack, Matthias Braun
+ * Date: 29.09.2005
+ * Copyright: (c) Universitaet Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "bespilloptions.h"
+
+#ifdef WITH_LIBCORE
+#include <libcore/lc_opts.h>
+#include <libcore/lc_opts_enum.h>
+#include <libcore/lc_timing.h>
+#endif /* WITH_LIBCORE */
+
+int be_coalesce_spill_slots = 1;
+int be_do_remats = 1;
+
+#ifdef WITH_LIBCORE
+static const lc_opt_table_entry_t be_spill_options[] = {
+ LC_OPT_ENT_BOOL ("coalesce_slots", "coalesce the spill slots", &be_coalesce_spill_slots),
+ LC_OPT_ENT_BOOL ("remat", "try to rematerialize values instead of reloading", &be_do_remats),
+ { NULL }
+};
+
+void be_spill_register_options(lc_opt_entry_t *grp)
+{
+ static int run_once = 0;
+ lc_opt_entry_t *spill_grp;
+
+ if (run_once)
+ return;
+
+ run_once = 1;
+ spill_grp = lc_opt_get_grp(grp, "spill");
+
+ lc_opt_add_table(spill_grp, be_spill_options);
+}
+#endif /* WITH_LIBCORE */
--- /dev/null
+/*
+ * Author: Matthias Braun
+ * Date: 12.10.2006
+ * Copyright: (c) Universitaet Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
+#ifndef BESPILL_OPTIONS_H_
+#define BESPILL_OPTIONS_H_
+
+extern int be_coalesce_spill_slots;
+extern int be_do_remats;
+
+#ifdef WITH_LIBCORE
+#include <libcore/lc_opts.h>
+void be_spill_register_options(lc_opt_entry_t *grp);
+#endif
+
+#endif
#include "bejavacoal.h"
#include "benodesets.h"
#include "bestatevent.h"
-
+#include "bespilloptions.h"
#define DBG_COALESCING 1
#define DBG_INTERFERENCES 2
return slotcount;
}
-void be_coalesce_spillslots(const be_chordal_env_t *chordal_env, int coalesce_spillslots) {
+void be_coalesce_spillslots(const be_chordal_env_t *chordal_env) {
ss_env_t env;
obstack_init(&env.obst);
be_stat_ev("spillslots", set_count(env.spills));
- if(coalesce_spillslots) {
+ if(be_coalesce_spill_slots) {
do_greedy_coalescing(&env);
if(be_stat_ev_is_active()) {
be_stat_ev("spillslots_after_coalescing", count_spillslots(&env));
/**
* Computes the spill offsets for all spill nodes in the irg
*/
-void be_coalesce_spillslots(const be_chordal_env_t *chordal_env, int coalesce_spillslots);
+void be_coalesce_spillslots(const be_chordal_env_t *chordal_env);
#endif