X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fbesched.c;h=c156d73e1c31d82e9e822d2401814c2340c14b38;hb=34e3b8d50bce639e760da7233524a4db85c80290;hp=922dccbf9c275ea4e7ba9b68bffbc1e70f9a3dc2;hpb=a09efb2ccc91c6d720aa6aa8c5f7e3c562528b2a;p=libfirm diff --git a/ir/be/besched.c b/ir/be/besched.c index 922dccbf9..c156d73e1 100644 --- a/ir/be/besched.c +++ b/ir/be/besched.c @@ -1,39 +1,20 @@ /* - * Copyright (C) 1995-2008 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. + * Copyright (C) 2012 University of Karlsruhe. */ /** * @file * @brief Scheduling utilities for nodes in Blocks and Blocks. * @author Sebastian Hack - * @version $Id$ */ #include "config.h" #include -#include "irprintf.h" -#include "irgwalk.h" #include "firm_types.h" -#include "irgraph_t.h" #include "iredges_t.h" #include "ircons.h" -#include "irextbb.h" #include "irgmod.h" #include "debug.h" @@ -50,9 +31,8 @@ #define SCHED_INITIAL_GRANULARITY (1 << 14) -static void sched_renumber(const ir_node *block) +static void sched_renumber(ir_node *const block) { - ir_node *irn; sched_info_t *inf; sched_timestep_t step = SCHED_INITIAL_GRANULARITY; @@ -149,7 +129,23 @@ void sched_remove(ir_node *irn) info->prev = NULL; } +void sched_replace(ir_node *const old, ir_node *const irn) +{ + assert(sched_is_scheduled(old)); + assert(!sched_is_scheduled(irn)); + + sched_info_t *const old_info = get_irn_sched_info(old); + sched_info_t *const irn_info = get_irn_sched_info(irn); + *irn_info = *old_info; + old_info->prev = NULL; + old_info->next = NULL; + + ir_node *const prev = irn_info->prev; + ir_node *const next = irn_info->next; + get_irn_sched_info(prev)->next = irn; + get_irn_sched_info(next)->prev = irn; +} static be_module_list_entry_t *schedulers; static schedule_func scheduler; @@ -158,7 +154,7 @@ void be_register_scheduler(const char *name, schedule_func func) { if (scheduler == NULL) scheduler = func; - be_add_module_to_list(&schedulers, name, func); + be_add_module_to_list(&schedulers, name, (void*)func); } void be_schedule_graph(ir_graph *irg) @@ -166,7 +162,7 @@ void be_schedule_graph(ir_graph *irg) scheduler(irg); } -BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched); +BE_REGISTER_MODULE_CONSTRUCTOR(be_init_sched) void be_init_sched(void) { lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");