* @date 29.09.2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <stdlib.h>
#include <stdbool.h>
#include "belive_t.h"
#include "benode_t.h"
#include "bechordal_t.h"
-#include "bejavacoal.h"
#include "bespilloptions.h"
#include "bestatevent.h"
#include "bessaconstr.h"
{
const arch_env_t *arch_env = birg->main_env->arch_env;
- spill_env_t *env = xmalloc(sizeof(env[0]));
+ spill_env_t *env = XMALLOC(spill_env_t);
env->spills = new_set(cmp_spillinfo, 1024);
env->irg = be_get_birg_irg(birg);
env->birg = birg;
spill_t *s;
spill_t *last;
- assert(! arch_irn_is(env->arch_env, to_spill, dont_spill));
+ assert(!arch_irn_is(to_spill, dont_spill));
DB((dbg, LEVEL_1, "Add spill of %+F after %+F\n", to_spill, after));
/* Just for safety make sure that we do not insert the spill in front of a phi */
spill_info_t *info;
reloader_t *rel;
- assert(! arch_irn_is(env->arch_env, to_spill, dont_spill));
+ assert(!arch_irn_is(to_spill, dont_spill));
info = get_spillinfo(env, to_spill);
after = skip_keeps_phis(after);
- spill->spill = be_spill(env->arch_env, block, to_spill);
+ spill->spill = be_spill(block, to_spill);
sched_add_after(after, spill->spill);
DB((dbg, LEVEL_1, "\t%+F after %+F\n", spill->spill, after));
#ifdef FIRM_STATISTICS
/*
* Ignore registers are always available
*/
- if(arch_irn_is(env->arch_env, arg, ignore)) {
+ if (arch_irn_is(arg, ignore)) {
return 1;
}
/**
* Checks whether the node can principally be rematerialized
*/
-static int is_remat_node(spill_env_t *env, const ir_node *node)
+static int is_remat_node(const ir_node *node)
{
- const arch_env_t *arch_env = env->arch_env;
-
assert(!be_is_Spill(node));
- if(arch_irn_is(arch_env, node, rematerializable))
+ if (arch_irn_is(node, rematerializable))
return 1;
return 0;
int argremats;
int costs = 0;
- if(!is_remat_node(env, spilled))
+ if (!is_remat_node(spilled))
return REMAT_COST_INFINITE;
if(be_is_Reload(spilled)) {
costs += 2;
} else {
- costs += arch_get_op_estimated_cost(env->arch_env, spilled);
+ costs += arch_get_op_estimated_cost(spilled);
}
if(parentcosts + costs >= env->reload_cost + env->spill_cost) {
return REMAT_COST_INFINITE;
}
- if(arch_irn_is(env->arch_env, spilled, modify_flags)) {
+ if (arch_irn_is(spilled, modify_flags)) {
return REMAT_COST_INFINITE;
}
get_irn_op(spilled), get_irn_mode(spilled),
get_irn_arity(spilled), ins);
copy_node_attr(spilled, res);
+ arch_env_mark_remat(env->arch_env, res);
new_backedge_info(res);
DBG((dbg, LEVEL_1, "Insert remat %+F of %+F before reloader %+F\n", res, spilled, reloader));
if(spillinfo->spill_costs >= 0)
return;
- assert(! arch_irn_is(env->arch_env, to_spill, dont_spill));
+ assert(!arch_irn_is(to_spill, dont_spill));
assert(!be_is_Reload(to_spill));
/* some backends have virtual noreg/unknown nodes that are not scheduled
void be_insert_spills_reloads(spill_env_t *env)
{
- const arch_env_t *arch_env = env->arch_env;
const ir_exec_freq *exec_freq = env->exec_freq;
spill_info_t *si;
ir_nodeset_iterator_t iter;
/* create a reload, use the first spill for now SSA
* reconstruction for memory comes below */
assert(si->spills != NULL);
- copy = be_reload(arch_env, si->reload_cls, rld->reloader, mode,
+ copy = be_reload(si->reload_cls, rld->reloader, mode,
si->spills->spill);
#ifdef FIRM_STATISTICS
env->reload_count++;