- workset_t *ws; /**< the main workset used while processing a block. ob-allocated */
- be_uses_t *uses; /**< env for the next-use magic */
- ir_node *instr; /**< current instruction */
- unsigned instr_nr; /**< current instruction number (relative to block start) */
- pset *used; /**< holds the values used (so far) in the current BB */
-
- spill_env_t *senv; /**< see bespill.h */
-} belady_env_t;
-
-struct _workset_t {
- belady_env_t *bel;
- int len; /**< current length */
- loc_t vals[0]; /**< inlined array of the values/distances in this working set */
+/**
+ * An association between a node and a point in time.
+ */
+typedef struct loc_t {
+ ir_node *node;
+ unsigned time; /**< A use time (see beuses.h). */
+ bool spilled; /**< the value was already spilled on this path */
+} loc_t;
+
+typedef struct _workset_t {
+ int len; /**< current length */
+ loc_t vals[0]; /**< inlined array of the values/distances in this working set */
+} workset_t;
+
+static struct obstack obst;
+static const arch_env_t *arch_env;
+static const arch_register_class_t *cls;
+static const be_lv_t *lv;
+static be_loopana_t *loop_ana;
+static int n_regs;
+static workset_t *ws; /**< the main workset used while
+ processing a block. */
+static be_uses_t *uses; /**< env for the next-use magic */
+static ir_node *instr; /**< current instruction */
+static unsigned instr_nr; /**< current instruction number
+ (relative to block start) */
+static ir_nodeset_t used;
+static spill_env_t *senv; /**< see bespill.h */
+static pdeq *worklist;
+
+static bool move_spills = true;
+static bool respectloopdepth = true;
+static bool 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 const lc_opt_table_entry_t options[] = {
+ LC_OPT_ENT_BOOL ("movespills", "try to move spills out of loops", &move_spills),
+ LC_OPT_ENT_BOOL ("respectloopdepth", "exprimental (outermost loop cutting)", &respectloopdepth),
+ LC_OPT_ENT_BOOL ("improveknownpreds", "experimental (known preds cutting)", &improve_known_preds),
+ LC_OPT_ENT_INT ("rematbonus", "give bonus to rematerialisable nodes", &remat_bonus),
+ LC_OPT_LAST