+#include <libcore/lc_opts.h>
+#include <libcore/lc_opts_enum.h>
+
+#define DUMP_PROBLEM 1
+#define DUMP_MPS 2
+#define DUMP_SOLUTION 4
+#define DUMP_STATS 8
+#define DUMP_PRESSURE 16
+
+#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 unsigned opt_dump_flags = 0;
+static int opt_log = 0;
+static unsigned 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 unsigned opt_remats = REMATS_ALL;
+static int opt_repair_schedule = 0;
+static int opt_no_enlarge_liveness = 0;
+static int opt_remat_while_live = 1;
+static int opt_timeout = 300;
+static double opt_cost_reload = 8.0;
+static double opt_cost_memoperand = 7.0;
+static double opt_cost_spill = 15.0;
+static double opt_cost_remat = 1.0;
+
+
+static const lc_opt_enum_mask_items_t dump_items[] = {
+ { "problem", DUMP_PROBLEM },
+ { "mps", DUMP_MPS },
+ { "solution", DUMP_SOLUTION },
+ { "stats", DUMP_STATS },
+ { "pressure", DUMP_PRESSURE },
+ { 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 inserted nodes", &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", &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_BOOL ("remat_while_live", "only remat where rematted value was live", &opt_remat_while_live),
+
+ LC_OPT_ENT_ENUM_MASK("dump", "dump problem, solution or statistical data", &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 }
+};
+
+//#define EXECFREQ_LOOPDEPH /* compute execution frequency from loop depth only */
+//#define SCHEDULE_PHIM /* insert phim nodes into schedule */