2 * Author: Matthias Braun
4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
13 #include "bemodule_t.h"
16 void be_init_sched(void);
17 void be_init_blocksched(void);
18 void be_init_spill(void);
19 void be_init_listsched(void);
20 void be_init_schedrss(void);
21 void be_init_chordal(void);
22 void be_init_copycoal(void);
23 void be_init_copyheur2(void);
24 void be_init_raextern(void);
25 void be_init_copystat(void);
26 void be_init_arch_ia32(void);
27 void be_init_arch_ppc32(void);
28 void be_init_arch_mips(void);
29 void be_init_arch_arm(void);
30 void be_init_arch_sta(void);
31 void be_init_ilpsched(void);
32 void be_init_copyilp(void);
33 void be_init_javacoal(void);
34 void be_init_ra(void);
35 void be_init_spillbelady(void);
36 void be_init_spillmorgan(void);
37 void be_init_spillremat(void);
38 void be_init_ifg(void);
40 void be_quit_copystat(void);
42 void be_init_modules(void)
44 static int run_once = 0;
61 be_init_spillbelady();
62 be_init_spillmorgan();
85 void be_quit_modules(void)
90 //---------------------------------------------------------------------------
93 typedef struct module_opt_data_t {
95 be_module_list_entry_t * const *list_head;
99 * Beware: return value of 0 means error.
101 static int set_opt_module(const char *name, lc_opt_type_t type, void *data,
104 module_opt_data_t *moddata = data;
107 const be_module_list_entry_t *module;
110 va_start(args, length);
111 opt = va_arg(args, const char*);
113 for(module = *(moddata->list_head); module != NULL; module = module->next) {
114 if(strcmp(module->name, opt) == 0) {
115 *(moddata->var) = module->data;
125 int dump_opt_module(char *buf, size_t buflen, const char *name,
126 lc_opt_type_t type, void *data, size_t length)
128 module_opt_data_t *moddata = data;
129 const be_module_list_entry_t *module;
131 for(module = *(moddata->list_head); module != NULL; module = module->next) {
132 if(module->data == *(moddata->var)) {
133 snprintf(buf, buflen, "%s", module->name);
138 snprintf(buf, buflen, "none");
142 int dump_opt_module_vals(char *buf, size_t buflen, const char *name,
143 lc_opt_type_t type, void *data, size_t len)
145 module_opt_data_t *moddata = data;
146 const be_module_list_entry_t *module;
149 for(module = *(moddata->list_head); module != NULL; module = module->next) {
150 size_t len = strlen(module->name);
152 if(module != *(moddata->list_head)) {
153 p = strncat(p, ", ", buflen - 1);
157 p = strncat(p, module->name, buflen - 1);
168 void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
171 be_module_list_entry_t *entry = xmalloc(sizeof(entry[0]));
173 entry->data = module;
174 entry->next = *list_head;
178 void be_add_module_list_opt(lc_opt_entry_t *grp, const char *name,
179 const char *description,
180 be_module_list_entry_t * const * list_head,
183 module_opt_data_t *moddata = xmalloc(sizeof(moddata[0]));
185 moddata->list_head = list_head;
187 lc_opt_add_opt(grp, name, description, lc_opt_type_enum,
188 moddata, sizeof(moddata[0]),
189 set_opt_module, dump_opt_module, dump_opt_module_vals,