#include "irtools.h"
#include "debug.h"
#include "beirgmod.h"
+#include "bemodule.h"
+#include "be.h"
-#ifdef WITH_LIBCORE
#include <libcore/lc_opts.h>
#include <libcore/lc_opts_enum.h>
#include <libcore/lc_timing.h>
-#endif /* WITH_LIBCORE */
#ifdef WITH_ILP
#include <lpp/lpp.h>
*/
static void collect_egde_frequency(ir_node *block, void *data)
{
- blocksched_env_t *env = data;
- ir_graph *irg = env->irg;
- ir_node *startblock = get_irg_start_block(irg);
+ blocksched_env_t *env = data;
int arity;
edge_t edge;
blocksched_entry_t *entry;
entry->prev = NULL;
set_irn_link(block, entry);
- if (block == startblock)
+ if (block == get_irg_start_block(env->irg))
return;
arity = get_irn_arity(block);
ARR_APP1(edge_t, env->edges, edge);
} else {
int i;
- double highest_execfreq = -1;
+ double highest_execfreq = -1.0;
int highest_edge_num = -1;
edge.block = block;
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;
// sort interblock edges by execution frequency
qsort(env.edges, ARR_LEN(env.edges), sizeof(env.edges[0]), cmp_edges);
- be_remove_empty_blocks(irg);
+ (void)be_remove_empty_blocks(irg);
if (algo != BLOCKSCHED_NAIV)
coalesce_blocks(&env);
irg_block_walk_graph(irg, collect_egde_frequency_ilp, NULL, &env);
- be_remove_empty_blocks(irg);
+ (void)be_remove_empty_blocks(irg);
coalesce_blocks_ilp(&env);
start_entry = finish_block_schedule(&env.env);
* |_| |_|\__,_|_|_| |_|
*
*/
-
-#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)
{