2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Option handling for spiller.
23 * @author Daniel Grund, Sebastian Hack, Matthias Braun
33 #include "bespilloptions.h"
38 #include "lc_opts_enum.h"
40 int be_coalesce_spill_slots = 1;
43 static const lc_opt_table_entry_t be_spill_options[] = {
44 LC_OPT_ENT_BOOL ("coalesce_slots", "coalesce the spill slots", &be_coalesce_spill_slots),
45 LC_OPT_ENT_BOOL ("remat", "try to rematerialize values instead of reloading", &be_do_remats),
49 static be_module_list_entry_t *spillers = NULL;
50 static be_spiller_t *selected_spiller = NULL;
52 void be_register_spiller(const char *name, be_spiller_t *spiller)
54 if(selected_spiller == NULL)
55 selected_spiller = spiller;
56 be_add_module_to_list(&spillers, name, spiller);
59 void be_do_spill(be_irg_t *birg, const arch_register_class_t* cls)
61 assert(selected_spiller != NULL);
62 if(selected_spiller != NULL) {
63 selected_spiller->spill(birg, cls);
67 void be_init_spilloptions(void)
69 lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
70 lc_opt_entry_t *spill_grp = lc_opt_get_grp(be_grp, "spill");
72 lc_opt_add_table(spill_grp, be_spill_options);
73 be_add_module_list_opt(spill_grp, "spiller", "spill algorithm",
74 &spillers, (void**) &selected_spiller);
77 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions);