X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbespilloptions.c;h=2a472098f9d40bfafe5d6ff2a9ef813a796faa9a;hb=590df14827a8ff5a5b53c506ac654876107bd8c9;hp=488323cc78f9b1599cae3fc7269f47972a4fe5ce;hpb=cf1e763f961a2d51d89df2497866902fbae4e366;p=libfirm diff --git a/ir/be/bespilloptions.c b/ir/be/bespilloptions.c index 488323cc7..2a472098f 100644 --- a/ir/be/bespilloptions.c +++ b/ir/be/bespilloptions.c @@ -1,42 +1,78 @@ /* - * Author: Daniel Grund, Sebastian Hack, Matthias Braun - * Date: 29.09.2005 - * Copyright: (c) Universitaet Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +/** + * @file + * @brief Option handling for spiller. + * @author Daniel Grund, Sebastian Hack, Matthias Braun + * @date 29.09.2005 + * @version $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "irtools.h" + #include "bespilloptions.h" +#include "bemodule.h" +#include "be.h" -#ifdef WITH_LIBCORE #include #include #include -#endif /* WITH_LIBCORE */ int be_coalesce_spill_slots = 1; int be_do_remats = 1; -#ifdef WITH_LIBCORE static const lc_opt_table_entry_t be_spill_options[] = { LC_OPT_ENT_BOOL ("coalesce_slots", "coalesce the spill slots", &be_coalesce_spill_slots), LC_OPT_ENT_BOOL ("remat", "try to rematerialize values instead of reloading", &be_do_remats), - { NULL } + LC_OPT_LAST }; -void be_spill_register_options(lc_opt_entry_t *grp) +static be_module_list_entry_t *spillers = NULL; +static be_spiller_t *selected_spiller = NULL; + +void be_register_spiller(const char *name, be_spiller_t *spiller) { - static int run_once = 0; - lc_opt_entry_t *spill_grp; + if(selected_spiller == NULL) + selected_spiller = spiller; + be_add_module_to_list(&spillers, name, spiller); +} - if (run_once) - return; +void be_do_spill(be_irg_t *birg, const arch_register_class_t* cls) +{ + assert(selected_spiller != NULL); + if(selected_spiller != NULL) { + selected_spiller->spill(birg, cls); + } +} - run_once = 1; - spill_grp = lc_opt_get_grp(grp, "spill"); +void be_init_spilloptions(void) +{ + lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be"); + lc_opt_entry_t *spill_grp = lc_opt_get_grp(be_grp, "spill"); lc_opt_add_table(spill_grp, be_spill_options); + be_add_module_list_opt(spill_grp, "spiller", "spill algorithm", + &spillers, (void**) &selected_spiller); } -#endif /* WITH_LIBCORE */ + +BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions);