+#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 DUMP_SOLUTION 4
+
+#define KEEPALIVE_REMATS 1
+#define KEEPALIVE_SPILLS 2
+#define KEEPALIVE_RELOADS 4
+
+#define VERIFY_MEMINTERF 1
+#define VERIFY_DOMINANCE 2
+
+#define REMATS_NONE 0
+#define REMATS_BRIGGS 1
+#define REMATS_NOINVERSE 2
+#define REMATS_ALL 3
+
+static int opt_dump_flags = 0;
+static int opt_log = 0;
+static int 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 int opt_repair_schedule = 0;
+static int opt_no_enlarge_liveness = 0;
+static int opt_timeout = 300;
+static double opt_cost_reload = 8.0;
+static double opt_cost_memoperand = 7.0;
+static double opt_cost_spill = 50.0;
+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 },
+ { "solution", DUMP_SOLUTION },
+ { NULL, 0 }
+};
+
+static lc_opt_enum_mask_var_t dump_var = {
+ &opt_dump_flags, dump_items
+};
+
+static const lc_opt_enum_mask_items_t keepalive_items[] = {
+ { "remats", KEEPALIVE_REMATS },
+ { "spills", KEEPALIVE_SPILLS },
+ { "reloads", KEEPALIVE_RELOADS },
+ { NULL, 0 }
+};
+
+static lc_opt_enum_mask_var_t keep_alive_var = {
+ &opt_keep_alive, keepalive_items
+};
+
+static const lc_opt_enum_mask_items_t remats_items[] = {
+ { "none", REMATS_NONE },
+ { "briggs", REMATS_BRIGGS },
+ { "noinverse", REMATS_NOINVERSE },
+ { "all", REMATS_ALL },
+ { NULL, 0 }
+};
+
+static lc_opt_enum_mask_var_t remats_var = {
+ &opt_remats, remats_items
+};
+
+static const lc_opt_table_entry_t options[] = {
+ LC_OPT_ENT_ENUM_MASK("keepalive", "keep alive remats, spills or reloads", &keep_alive_var),
+
+ LC_OPT_ENT_BOOL ("goodwin", "activate goodwin reduction", &opt_goodwin),
+ LC_OPT_ENT_BOOL ("memcopies", "activate memcopy handling", &opt_memcopies),
+ LC_OPT_ENT_BOOL ("memoperands", "activate memoperands", &opt_memoperands),
+ LC_OPT_ENT_ENUM_INT ("remats", "type of remats to insert (none, briggs, noinverse or all)",&remats_var),
+ LC_OPT_ENT_BOOL ("repair_schedule", "repair the schedule by rematting once used nodes",&opt_repair_schedule),
+ LC_OPT_ENT_BOOL ("no_enlage_liveness", "do not enlarge liveness of operands of remats",&opt_no_enlarge_liveness),
+
+ LC_OPT_ENT_ENUM_MASK("dump", "dump problem, mps or solution", &dump_var),
+ LC_OPT_ENT_BOOL ("log", "activate the lpp log", &opt_log),
+ LC_OPT_ENT_INT ("timeout", "ILP solver timeout", &opt_timeout),
+
+ LC_OPT_ENT_DBL ("cost_reload", "cost of a reload", &opt_cost_reload),
+ LC_OPT_ENT_DBL ("cost_memoperand", "cost of a memory operand", &opt_cost_memoperand),
+ LC_OPT_ENT_DBL ("cost_spill", "cost of a spill instruction", &opt_cost_spill),
+ LC_OPT_ENT_DBL ("cost_remat", "cost of a rematerialization", &opt_cost_remat),
+ { NULL }
+};
+
+void be_spill_remat_register_options(lc_opt_entry_t *grp)
+{
+ lc_opt_entry_t *my_grp = lc_opt_get_grp(grp, "remat");
+ lc_opt_add_table(my_grp, options);
+}
+#endif
+
+
+//#define EXECFREQ_LOOPDEPH /* compute execution frequency from loop depth only */
+//#define SCHEDULE_PHIM /* insert phim nodes into schedule */