#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
-#ifdef WITH_LIBCORE
#include <libcore/lc_opts.h>
#include <libcore/lc_opts_enum.h>
-#endif
#include "set.h"
#include "pset.h"
#include "irdom_t.h"
#include "phiclass.h"
+#include "bemodule.h"
#include "beraextern.h"
#include "beabi.h"
#include "bearch.h"
/**
* Default values for options
*/
-static set* (*ssa_destr)(ir_graph*,const arch_env_t*) = be_ssa_destr_simple;
static char callee[128] = "\"E:/user/kimohoff/public/register allocator\"";
//static char callee[128] = "/ben/kimohoff/ipd-registerallocator/register_allocator";
* Read in results and apply them
*
*/
-static be_ra_timer_t *be_ra_extern_main(be_irg_t *birg) {
+static void be_ra_extern_main(be_irg_t *birg) {
be_main_env_t *env = birg->main_env;
ir_graph *irg = birg->irg;
free_ssa_destr_simple(raenv.vars);
be_invalidate_liveness(birg);
-
- return NULL;
}
/******************************************************************************
|_|
*****************************************************************************/
-#ifdef WITH_LIBCORE
-
-
static const lc_opt_enum_func_ptr_items_t ssa_destr_items[] = {
{ "simple", (int (*)(void)) be_ssa_destr_simple }, /* TODO make (void*) casts nicer */
{ NULL, NULL }
};
+static set* (*ssa_destr)(ir_graph*,const arch_env_t*) = be_ssa_destr_simple;
+
static lc_opt_enum_func_ptr_var_t ssa_destr_var = {
(int (**)(void)) &ssa_destr, ssa_destr_items
};
{ NULL }
};
-static void be_ra_extern_register_options(lc_opt_entry_t *root) {
- lc_opt_entry_t *grp = lc_opt_get_grp(root, "ext");
+static be_ra_t be_ra_external_allocator = {
+ be_ra_extern_main
+};
- lc_opt_add_table(grp, be_ra_extern_options);
-}
+void be_init_raextern(void) {
+ lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
+ lc_opt_entry_t *blocksched_grp = lc_opt_get_grp(be_grp, "ra");
+ lc_opt_entry_t *ext_grp = lc_opt_get_grp(blocksched_grp, "ext");
-#endif /* WITH_LIBCORE */
+ lc_opt_add_table(ext_grp, be_ra_extern_options);
-const be_ra_t be_ra_external_allocator = {
-#ifdef WITH_LIBCORE
- be_ra_extern_register_options,
-#endif
- be_ra_extern_main
-};
+ be_register_allocator("ext", &be_ra_external_allocator);
+}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_raextern);