From 73ae17c0daf7b7779d669eb78f6bad992ad68111 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 12 Oct 2008 00:28:29 +0000 Subject: [PATCH] - constify - add some doxygen comments [r22777] --- ir/be/bemodule.c | 2 +- ir/be/bemodule.h | 2 +- ir/be/bemodule_t.h | 9 ++++++--- ir/be/bespilloptions.c | 10 +++++----- ir/be/bespilloptions.h | 27 +++++++++++++++++++++++++-- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/ir/be/bemodule.c b/ir/be/bemodule.c index 01435383f..a00714a8d 100644 --- a/ir/be/bemodule.c +++ b/ir/be/bemodule.c @@ -241,7 +241,7 @@ int dump_opt_module_vals(char *buf, size_t buflen, const char *name, * 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; diff --git a/ir/be/bemodule.h b/ir/be/bemodule.h index 95e6911e1..c1cb23c77 100644 --- a/ir/be/bemodule.h +++ b/ir/be/bemodule.h @@ -57,7 +57,7 @@ void be_quit_modules(void); 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, diff --git a/ir/be/bemodule_t.h b/ir/be/bemodule_t.h index 912c4a5f3..15b89a782 100644 --- a/ir/be/bemodule_t.h +++ b/ir/be/bemodule_t.h @@ -29,10 +29,13 @@ #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 */ diff --git a/ir/be/bespilloptions.c b/ir/be/bespilloptions.c index 0befa7c9b..9f436d325 100644 --- a/ir/be/bespilloptions.c +++ b/ir/be/bespilloptions.c @@ -45,19 +45,19 @@ static const lc_opt_table_entry_t be_spill_options[] = { }; 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); } } diff --git a/ir/be/bespilloptions.h b/ir/be/bespilloptions.h index 576a1b97d..c5a77fd1e 100644 --- a/ir/be/bespilloptions.h +++ b/ir/be/bespilloptions.h @@ -33,11 +33,34 @@ 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 -- 2.20.1