+#include "beabi.h"
+#include "belower.h"
+#include "beschedmris.h"
+#include "bestat.h"
+#include "beverify.h"
+#include "beprofile.h"
+#include "be_dbgout.h"
+
+#ifdef WITH_ILP
+#include "beilpsched.h"
+#endif /* WITH_ILP */
+
+/* options visible for anyone */
+static be_options_t be_options = {
+ DUMP_NONE, /* dump flags */
+ BE_TIME_OFF, /* no timing */
+ 0, /* no opt profile */
+ 1, /* try to omit frame pointer */
+ 0, /* always stabs debugging output */
+ BE_VRFY_WARN, /* verification level: warn */
+ BE_SCHED_LIST, /* scheduler: list scheduler */
+ "i44pc52.info.uni-karlsruhe.de", /* ilp server */
+ "cplex" /* ilp solver */
+};
+
+/* config file. */
+static char config_file[256] = { 0 };
+
+/* back end instruction set architecture to use */
+static const arch_isa_if_t *isa_if = NULL;
+
+#ifdef WITH_LIBCORE
+
+/* possible dumping options */
+static const lc_opt_enum_mask_items_t dump_items[] = {
+ { "none", DUMP_NONE },
+ { "initial", DUMP_INITIAL },
+ { "abi", DUMP_ABI },
+ { "sched", DUMP_SCHED },
+ { "prepared", DUMP_PREPARED },
+ { "regalloc", DUMP_RA },
+ { "final", DUMP_FINAL },
+ { "be", DUMP_BE },
+ { "all", 2 * DUMP_BE - 1 },
+ { NULL, 0 }
+};
+
+/* verify options. */
+static const lc_opt_enum_int_items_t vrfy_items[] = {
+ { "off", BE_VRFY_OFF },
+ { "warn", BE_VRFY_WARN },
+ { "assert", BE_VRFY_ASSERT },
+ { NULL, 0 }
+};
+
+/* scheduling options. */
+static const lc_opt_enum_int_items_t sched_items[] = {
+ { "list", BE_SCHED_LIST },
+#ifdef WITH_ILP
+ { "ilp", BE_SCHED_ILP },
+#endif /* WITH_ILP */
+ { NULL, 0 }
+};
+
+static lc_opt_enum_mask_var_t dump_var = {
+ &be_options.dump_flags, dump_items
+};
+
+static lc_opt_enum_int_var_t vrfy_var = {
+ &be_options.vrfy_option, vrfy_items
+};
+
+static lc_opt_enum_int_var_t sched_var = {
+ &be_options.scheduler, sched_items
+};
+
+static const lc_opt_table_entry_t be_main_options[] = {
+ LC_OPT_ENT_STR ("config", "read another config file containing backend options", config_file, sizeof(config_file)),
+ LC_OPT_ENT_ENUM_MASK("dump", "dump irg on several occasions", &dump_var),
+ LC_OPT_ENT_NEGBOOL ("noomitfp", "do not omit frame pointer", &be_options.omit_fp),
+ LC_OPT_ENT_BOOL ("stabs", "enable stabs debug support", &be_options.stabs_debug_support),
+ LC_OPT_ENT_ENUM_PTR ("vrfy", "verify the backend irg", &vrfy_var),
+ LC_OPT_ENT_BOOL ("time", "get backend timing statistics", &be_options.timing),
+ LC_OPT_ENT_BOOL ("profile", "instrument the code for execution count profiling", &be_options.opt_profile),
+ LC_OPT_ENT_ENUM_PTR ("sched", "select a scheduler", &sched_var),
+ LC_OPT_ENT_STR ("statfile", "append statistics to file statfile", &be_options.stat_file_name, sizeof(be_options.stat_file_name)),
+
+#ifdef WITH_ILP
+ LC_OPT_ENT_STR ("ilp.server", "the ilp server name", be_options.ilp_server, sizeof(be_options.ilp_server)),
+ LC_OPT_ENT_STR ("ilp.solver", "the ilp solver name", be_options.ilp_solver, sizeof(be_options.ilp_solver)),
+#endif /* WITH_ILP */
+ { NULL }
+};
+
+#endif /* WITH_LIBCORE */
+
+static be_module_list_entry_t *isa_ifs = NULL;
+
+void be_register_isa_if(const char *name, const arch_isa_if_t *isa)
+{
+ if(isa_if == NULL)
+ isa_if = isa;