summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bera.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2006-12-21 15:55:08 +0100
committerMatthias Braun <matze@braunis.de>2006-12-21 15:55:08 +0100
commitda48a7f7266cfe6274fc4d159d63bba245724222 (patch)
treebc526cd9b9457d6374857b4c07ab0d831df75f95 /ir/be/bera.c
parent6d2368b06b89d3d1bc34e04588e32b658f4c5f8d (diff)
- All backend modules use module constructors for registering their options now
- New register allocator modules can register themselfes in a list now, the same will be done for spillers, copy coalescers, architectures soon
Diffstat (limited to 'ir/be/bera.c')
-rw-r--r--ir/be/bera.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/ir/be/bera.c b/ir/be/bera.c
index 2178ec7e..3525d7f 100644
--- a/ir/be/bera.c
+++ b/ir/be/bera.c
@@ -7,6 +7,8 @@
#include "config.h"
#endif
+#include <stdlib.h>
+
#include "pset.h"
#include "impl.h"
@@ -14,9 +16,11 @@
#include "irmode.h"
#include "irdom.h"
+#include "bera.h"
#include "beutil.h"
#include "besched_t.h"
#include "belive_t.h"
+#include "bemodule.h"
static sched_timestep_t get_time_step(const ir_node *irn)
{
@@ -102,6 +106,27 @@ int values_interfere(const be_lv_t *lv, const ir_node *a, const ir_node *b)
if(get_nodes_block(user) == bb && !is_Phi(user) && b != user && value_dominates(b, user))
return 1;
}
- }
- return 0;
+ }
+
+ return 0;
+}
+
+/** The list of register allocators */
+static be_module_list_entry_t *register_allocators = NULL;
+static be_ra_t *selected_allocator = NULL;
+
+void be_register_allocator(const char *name, be_ra_t *allocator)
+{
+ if(selected_allocator == NULL)
+ selected_allocator = allocator;
+ be_add_module_to_list(&register_allocators, name, allocator);
+}
+
+void be_init_ra(void)
+{
+ lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
+
+ be_add_module_list_opt(be_grp, "regalloc", "register allocator",
+ &register_allocators, (void**) &selected_allocator);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(init_be_ra);