* Add a new module to list.
*/
void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
- void *module)
+ const void *module)
{
be_module_list_entry_t *entry = XMALLOC(be_module_list_entry_t);
entry->name = name;
typedef struct be_module_list_entry_t be_module_list_entry_t;
void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
- void *module);
+ const void *module);
void be_add_module_list_opt(lc_opt_entry_t *grp, const char *name,
const char *description,
#include "bemodule.h"
+/**
+ * A module list entry.
+ */
struct be_module_list_entry_t {
- const char *name;
- void *data;
- struct be_module_list_entry_t *next;
+ const char *name; /**< The name of the entry. */
+ const void *data; /**< Some data associated with this entry. */
+ struct be_module_list_entry_t *next; /**< Points to the next entry. */
};
#endif /* FIRM_BE_BEMODULE_T_H */
};
static be_module_list_entry_t *spillers = NULL;
-static be_spiller_t *selected_spiller = NULL;
+static const be_spiller_t *selected_spiller = NULL;
-void be_register_spiller(const char *name, be_spiller_t *spiller)
+void be_register_spiller(const char *name, const be_spiller_t *spiller)
{
- if(selected_spiller == NULL)
+ if (selected_spiller == NULL)
selected_spiller = spiller;
be_add_module_to_list(&spillers, name, spiller);
}
-void be_do_spill(be_irg_t *birg, const arch_register_class_t* cls)
+void be_do_spill(be_irg_t *birg, const arch_register_class_t *cls)
{
assert(selected_spiller != NULL);
- if(selected_spiller != NULL) {
+ if (selected_spiller != NULL) {
selected_spiller->spill(birg, cls);
}
}
extern int be_coalesce_spill_slots;
extern int be_do_remats;
+/**
+ * An entry in the list of spill-algorithms.
+ */
typedef struct be_spiller_t {
- void (*spill) (be_irg_t *birg, const arch_register_class_t *cls);
+ /**
+ * The spill function.
+ *
+ * @param birg the graph to spill on
+ * @param cls the register class to spill
+ */
+ void (*spill)(be_irg_t *birg, const arch_register_class_t *cls);
} be_spiller_t;
-void be_register_spiller(const char *name, be_spiller_t *spiller);
+/**
+ * Register a new spill algorithm.
+ *
+ * @param name the name of the spill algorithm,
+ * used to select it
+ * @param spiller a spill entry
+ */
+void be_register_spiller(const char *name, const be_spiller_t *spiller);
+
+/**
+ * Execute the selected spill algorithm
+ *
+ * @param birg the graph to spill on
+ * @param cls the register class to spill
+ */
void be_do_spill(be_irg_t *birg, const arch_register_class_t *cls);
#endif