Commit 093d930a authored by Matthias Braun's avatar Matthias Braun
Browse files

get rid of unnecessary be_spiller_t struct

parent 8bf06a8b
...@@ -206,10 +206,10 @@ static const lc_opt_table_entry_t be_spill_options[] = { ...@@ -206,10 +206,10 @@ static const lc_opt_table_entry_t be_spill_options[] = {
LC_OPT_LAST LC_OPT_LAST
}; };
static be_module_list_entry_t *spillers = NULL; static be_module_list_entry_t *spillers;
static const be_spiller_t *selected_spiller = NULL; static be_spill_func selected_spiller;
void be_register_spiller(const char *name, be_spiller_t *spiller) void be_register_spiller(const char *name, be_spill_func spiller)
{ {
if (selected_spiller == NULL) if (selected_spiller == NULL)
selected_spiller = spiller; selected_spiller = spiller;
...@@ -219,8 +219,7 @@ void be_register_spiller(const char *name, be_spiller_t *spiller) ...@@ -219,8 +219,7 @@ void be_register_spiller(const char *name, be_spiller_t *spiller)
void be_do_spill(ir_graph *irg, const arch_register_class_t *cls) void be_do_spill(ir_graph *irg, const arch_register_class_t *cls)
{ {
assert(selected_spiller != NULL); assert(selected_spiller != NULL);
selected_spiller(irg, cls);
selected_spiller->spill(irg, cls);
} }
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions) BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions)
......
...@@ -17,18 +17,7 @@ ...@@ -17,18 +17,7 @@
extern int be_coalesce_spill_slots; extern int be_coalesce_spill_slots;
extern int be_do_remats; extern int be_do_remats;
/** typedef void (*be_spill_func)(ir_graph *irg, const arch_register_class_t *cls);
* An entry in the list of spill-algorithms.
*/
typedef struct be_spiller_t {
/**
* The spill function.
*
* @param irg the graph to spill on
* @param cls the register class to spill
*/
void (*spill)(ir_graph *irg, const arch_register_class_t *cls);
} be_spiller_t;
/** /**
* Register a new spill algorithm. * Register a new spill algorithm.
...@@ -37,7 +26,7 @@ typedef struct be_spiller_t { ...@@ -37,7 +26,7 @@ typedef struct be_spiller_t {
* used to select it * used to select it
* @param spiller a spill entry * @param spiller a spill entry
*/ */
void be_register_spiller(const char *name, be_spiller_t *spiller); void be_register_spiller(const char *name, be_spill_func spiller);
/** /**
* Execute the selected spill algorithm * Execute the selected spill algorithm
......
...@@ -888,13 +888,10 @@ static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls) ...@@ -888,13 +888,10 @@ static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls)
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady) BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady)
void be_init_spillbelady(void) void be_init_spillbelady(void)
{ {
static be_spiller_t belady_spiller = {
be_spill_belady
};
lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be"); lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
lc_opt_entry_t *belady_group = lc_opt_get_grp(be_grp, "belady"); lc_opt_entry_t *belady_group = lc_opt_get_grp(be_grp, "belady");
lc_opt_add_table(belady_group, options); lc_opt_add_table(belady_group, options);
be_register_spiller("belady", &belady_spiller); be_register_spiller("belady", be_spill_belady);
FIRM_DBG_REGISTER(dbg, "firm.be.spill.belady"); FIRM_DBG_REGISTER(dbg, "firm.be.spill.belady");
} }
...@@ -344,10 +344,6 @@ static void be_spill_daemel(ir_graph *irg, const arch_register_class_t *new_cls) ...@@ -344,10 +344,6 @@ static void be_spill_daemel(ir_graph *irg, const arch_register_class_t *new_cls)
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_daemelspill) BE_REGISTER_MODULE_CONSTRUCTOR(be_init_daemelspill)
void be_init_daemelspill(void) void be_init_daemelspill(void)
{ {
static be_spiller_t daemel_spiller = { be_register_spiller("daemel", &be_spill_daemel);
be_spill_daemel
};
be_register_spiller("daemel", &daemel_spiller);
FIRM_DBG_REGISTER(dbg, "firm.be.spilldaemel"); FIRM_DBG_REGISTER(dbg, "firm.be.spilldaemel");
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment