fixed precedence constraint
[libfirm] / ir / be / beraextern.c
index fc6a5a1..b70cc2d 100644 (file)
@@ -68,10 +68,8 @@ alloc                ::= node-nr reg-nr .
 #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"
@@ -86,6 +84,7 @@ alloc         ::= node-nr reg-nr .
 #include "irdom_t.h"
 #include "phiclass.h"
 
+#include "bemodule.h"
 #include "beraextern.h"
 #include "beabi.h"
 #include "bearch.h"
@@ -704,7 +703,7 @@ static char callee[128] = "\"E:/user/kimohoff/public/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;
 
@@ -770,8 +769,6 @@ static be_ra_timer_t *be_ra_extern_main(be_irg_t *birg) {
        free_ssa_destr_simple(raenv.vars);
 
        be_invalidate_liveness(birg);
-
-       return NULL;
 }
 
 /******************************************************************************
@@ -785,9 +782,6 @@ static be_ra_timer_t *be_ra_extern_main(be_irg_t *birg) {
           |_|
  *****************************************************************************/
 
-#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 }
@@ -805,17 +799,17 @@ static const lc_opt_table_entry_t be_ra_extern_options[] = {
        { 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);