2 * Author: Matthias Braun
4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
10 #endif /* HAVE_CONFIG_H */
14 #include "bemodule_t.h"
17 void be_init_sched(void);
18 void be_init_blocksched(void);
19 void be_init_spill(void);
20 void be_init_listsched(void);
21 void be_init_schedrss(void);
22 void be_init_chordal(void);
23 void be_init_chordal_main(void);
24 void be_init_copycoal(void);
25 void be_init_copyheur2(void);
26 void be_init_copyheur3(void);
27 void be_init_copystat(void);
28 void be_init_arch_ia32(void);
29 void be_init_arch_ppc32(void);
30 void be_init_arch_mips(void);
31 void be_init_arch_arm(void);
32 void be_init_arch_sta(void);
33 void be_init_ilpsched(void);
34 void be_init_copyilp(void);
35 void be_init_javacoal(void);
36 void be_init_ra(void);
37 void be_init_spillbelady(void);
38 void be_init_spillmorgan(void);
39 void be_init_spillremat(void);
40 void be_init_ssaconstr(void);
41 void be_init_ifg(void);
42 void be_init_irgmod(void);
43 void be_init_loopana(void);
44 void be_init_spillslots(void);
45 void be_init_live(void);
46 void be_init_state(void);
48 void be_quit_copystat(void);
51 * Driver for module intialization.
52 * Call your module initialization function here.
54 void be_init_modules(void)
56 static int run_once = 0;
71 be_init_chordal_main();
77 be_init_spillbelady();
78 be_init_spillmorgan();
101 #endif /* PLUGIN_IR_BE_STA */
104 void be_quit_modules(void)
109 //---------------------------------------------------------------------------
111 typedef struct module_opt_data_t {
113 be_module_list_entry_t * const *list_head;
117 * Searches in list for module option. If found, set option to given value and return true.
118 * Beware: return value of 0 means error.
120 static int set_opt_module(const char *name, lc_opt_type_t type, void *data,
123 module_opt_data_t *moddata = data;
127 const be_module_list_entry_t *module;
129 va_start(args, length);
130 opt = va_arg(args, const char*);
132 for (module = *(moddata->list_head); module != NULL; module = module->next) {
133 if (strcmp(module->name, opt) == 0) {
134 *(moddata->var) = module->data;
145 * Dump the names of all registered module options.
147 int dump_opt_module(char *buf, size_t buflen, const char *name,
148 lc_opt_type_t type, void *data, size_t length)
150 module_opt_data_t *moddata = data;
151 const be_module_list_entry_t *module;
153 for (module = *(moddata->list_head); module != NULL; module = module->next) {
154 if (module->data == *(moddata->var)) {
155 snprintf(buf, buflen, "%s", module->name);
160 snprintf(buf, buflen, "none");
165 * Dump the values of all register module options.
167 int dump_opt_module_vals(char *buf, size_t buflen, const char *name,
168 lc_opt_type_t type, void *data, size_t len)
170 module_opt_data_t *moddata = data;
172 const be_module_list_entry_t *module;
174 for (module = *(moddata->list_head); module != NULL; module = module->next) {
175 size_t len = strlen(module->name);
177 if (module != *(moddata->list_head)) {
178 p = strncat(p, ", ", buflen - 1);
182 p = strncat(p, module->name, buflen - 1);
194 * Add a new module to list.
196 void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
199 be_module_list_entry_t *entry;
201 entry = xmalloc(sizeof(entry[0]));
203 entry->data = module;
204 entry->next = *list_head;
209 * Add an option for a module.
211 void be_add_module_list_opt(lc_opt_entry_t *grp, const char *name,
212 const char *description,
213 be_module_list_entry_t * const * list_head,
216 module_opt_data_t *moddata;
218 moddata = xmalloc(sizeof(moddata[0]));
220 moddata->list_head = list_head;
222 lc_opt_add_opt(grp, name, description, lc_opt_type_enum,
223 moddata, sizeof(moddata[0]),
224 set_opt_module, dump_opt_module, dump_opt_module_vals,