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_ilpsched(void);
31 void be_init_copyilp(void);
32 void be_init_javacoal(void);
33 void be_init_ra(void);
34 void be_init_spillbelady(void);
35 void be_init_spillmorgan(void);
36 void be_init_spillremat(void);
38 void be_quit_copystat(void);
40 void be_init_modules(void)
42 static int run_once = 0;
59 be_init_spillbelady();
60 be_init_spillmorgan();
78 void be_quit_modules(void)
83 //---------------------------------------------------------------------------
86 typedef struct module_opt_data_t {
88 be_module_list_entry_t * const *list_head;
91 static int set_opt_module(const char *name, lc_opt_type_t type, void *data,
94 module_opt_data_t *moddata = data;
97 const be_module_list_entry_t *module;
99 va_start(args, length);
100 opt = va_arg(args, const char*);
102 for(module = *(moddata->list_head); module != NULL; module = module->next) {
103 if(strcmp(module->name, opt) == 0) {
104 *(moddata->var) = module->data;
113 int dump_opt_module(char *buf, size_t buflen, const char *name,
114 lc_opt_type_t type, void *data, size_t length)
116 module_opt_data_t *moddata = data;
117 const be_module_list_entry_t *module;
119 for(module = *(moddata->list_head); module != NULL; module = module->next) {
120 if(module->data == *(moddata->var)) {
121 snprintf(buf, buflen, "%s", module->name);
126 snprintf(buf, buflen, "none");
130 int dump_opt_module_vals(char *buf, size_t buflen, const char *name,
131 lc_opt_type_t type, void *data, size_t len)
133 module_opt_data_t *moddata = data;
134 const be_module_list_entry_t *module;
137 for(module = *(moddata->list_head); module != NULL; module = module->next) {
138 size_t len = strlen(module->name);
140 if(module != *(moddata->list_head)) {
141 p = strncat(p, ", ", buflen - 1);
145 p = strncat(p, module->name, buflen - 1);
156 void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
159 be_module_list_entry_t *entry = xmalloc(sizeof(entry[0]));
161 entry->data = module;
162 entry->next = *list_head;
166 void be_add_module_list_opt(lc_opt_entry_t *grp, const char *name,
167 const char *description,
168 be_module_list_entry_t * const * list_head,
171 module_opt_data_t *moddata = xmalloc(sizeof(moddata[0]));
173 moddata->list_head = list_head;
175 lc_opt_add_opt(grp, name, description, lc_opt_type_enum,
176 moddata, sizeof(moddata[0]),
177 set_opt_module, dump_opt_module, dump_opt_module_vals,