#include "besched.h"
#include "beirgmod.h"
#include "belive_t.h"
-#include "benode_t.h"
+#include "benode.h"
#include "bechordal_t.h"
#include "bespill.h"
#include "beloopana.h"
static spill_env_t *senv; /**< see bespill.h */
static ir_node **blocklist;
-static bool move_spills = true;
-static bool respectloopdepth = true;
-static bool improve_known_preds = true;
+static int move_spills = true;
+static int respectloopdepth = true;
+static int improve_known_preds = true;
/* factor to weight the different costs of reloading/rematerializing a node
(see bespill.h be_get_reload_costs_no_weight) */
static int remat_bonus = 10;
*/
static workset_t *new_workset(void)
{
- workset_t *res;
- size_t size = sizeof(*res) + n_regs * sizeof(res->vals[0]);
-
- res = obstack_alloc(&obst, size);
- memset(res, 0, size);
- return res;
+ return OALLOCFZ(&obst, workset_t, vals, n_regs);
}
/**
*/
static workset_t *workset_clone(workset_t *workset)
{
- workset_t *res;
- size_t size = sizeof(*res) + n_regs * sizeof(res->vals[0]);
- res = obstack_alloc(&obst, size);
- memcpy(res, workset, size);
+ workset_t *res = OALLOCF(&obst, workset_t, vals, n_regs);
+ memcpy(res, workset, sizeof(*res) + n_regs * sizeof(res->vals[0]));
return res;
}
} block_info_t;
-static void *new_block_info(void)
+static block_info_t *new_block_info(void)
{
- block_info_t *res = obstack_alloc(&obst, sizeof(res[0]));
- memset(res, 0, sizeof(res[0]));
-
- return res;
+ return OALLOCZ(&obst, block_info_t);
}
#define get_block_info(block) ((block_info_t *)get_irn_link(block))
return USES_INFINITY;
/* We have to keep nonspillable nodes in the workingset */
- if (arch_irn_get_flags(def) & arch_irn_flags_dont_spill)
+ if (arch_irn_get_flags(skip_Proj_const(def)) & arch_irn_flags_dont_spill)
return 0;
/* give some bonus to rematerialisable nodes */
}
/* We have to keep nonspillable nodes in the workingset */
- if (arch_irn_get_flags(node) & arch_irn_flags_dont_spill) {
+ if (arch_irn_get_flags(skip_Proj_const(node)) & arch_irn_flags_dont_spill) {
loc.time = 0;
DB((dbg, DBG_START, " %+F taken (dontspill node)\n", node, loc.time));
return loc;
}
}
-static void add_block(ir_node *block, void *data)
-{
- (void) data;
- ARR_APP1(ir_node*, blocklist, block);
-}
-
static void be_spill_belady(be_irg_t *birg, const arch_register_class_t *rcls)
{
int i;
uses = be_begin_uses(irg, lv);
loop_ana = be_new_loop_pressure(birg, cls);
senv = be_new_spill_env(birg);
- blocklist = NEW_ARR_F(ir_node*, 0);
- irg_block_edges_walk(get_irg_start_block(irg), NULL, add_block, NULL);
+ blocklist = be_get_cfgpostorder(irg);
stat_ev_tim_pop("belady_time_init");
stat_ev_tim_push();