added some comments
[libfirm] / ir / be / beblocksched.c
index 4e10b6d..704d33d 100644 (file)
@@ -25,6 +25,8 @@
 #include "irtools.h"
 #include "debug.h"
 #include "beirgmod.h"
+#include "bemodule.h"
+#include "be.h"
 
 #ifdef WITH_LIBCORE
 #include <libcore/lc_opts.h>
@@ -43,6 +45,7 @@ typedef enum _blocksched_algos_t {
 
 static int algo = BLOCKSCHED_GREEDY;
 
+#ifdef WITH_LIBCORE
 static const lc_opt_enum_int_items_t blockschedalgo_items[] = {
        { "naiv",       BLOCKSCHED_NAIV },
        { "extbb",      BLOCKSCHED_EXTBB },
@@ -61,6 +64,7 @@ static const lc_opt_table_entry_t be_blocksched_options[] = {
        LC_OPT_ENT_ENUM_INT ("algo", "the block scheduling algorithm", &algo_var),
        { NULL }
 };
+#endif
 
 /*
  *   ____                   _
@@ -214,7 +218,7 @@ static void coalesce_blocks(blocksched_env_t *env)
                entry      = get_irn_link(block);
                pred_entry = get_irn_link(pred_block);
 
-               /* TODO: what's this check for? */
+               /* is 1 of the blocks already attached to another block? */
                if (pred_entry->next != NULL || entry->prev != NULL)
                        continue;
 
@@ -694,22 +698,15 @@ static ir_node **create_extbb_block_schedule(ir_graph *irg, ir_exec_freq *execfr
  * |_|  |_|\__,_|_|_| |_|
  *
  */
-
-#ifdef WITH_LIBCORE
-void be_block_schedule_register_options(lc_opt_entry_t *grp)
+void be_init_blocksched(void)
 {
-       static int     run_once = 0;
-       lc_opt_entry_t *blocksched_grp;
-
-       if (run_once)
-               return;
-
-       run_once       = 1;
-       blocksched_grp = lc_opt_get_grp(grp, "blocksched");
+       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, "blocksched");
 
        lc_opt_add_table(blocksched_grp, be_blocksched_options);
 }
-#endif /* WITH_LIBCORE */
+
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_blocksched);
 
 ir_node **be_create_block_schedule(ir_graph *irg, ir_exec_freq *execfreqs)
 {