2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Base routines for register allocation.
9 * @author Sebastian Hack
30 /** The list of register allocators */
31 static be_module_list_entry_t *register_allocators = NULL;
32 static be_ra_t *selected_allocator = NULL;
34 void be_register_allocator(const char *name, be_ra_t *allocator)
36 if (selected_allocator == NULL)
37 selected_allocator = allocator;
38 be_add_module_to_list(®ister_allocators, name, allocator);
41 void be_allocate_registers(ir_graph *irg)
43 assert(selected_allocator != NULL);
44 if (selected_allocator != NULL) {
45 selected_allocator->allocate(irg);
49 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_ra)
52 lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
54 be_add_module_list_opt(be_grp, "regalloc", "register allocator",
55 ®ister_allocators, (void**) &selected_allocator);