X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbesched.h;h=e02d940239a21eb037b4cf268ecd8ae620d3fd32;hb=eba5516120eb38bcae5464e628aa0d2cb8708866;hp=1549e870f60175405a8eefbeba047ef0ac4ed40e;hpb=9b060a71a2667ced8d103023eda0ff710e799867;p=libfirm diff --git a/ir/be/besched.h b/ir/be/besched.h index 1549e870f..e02d94023 100644 --- a/ir/be/besched.h +++ b/ir/be/besched.h @@ -1,19 +1,67 @@ +/* + * 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. + */ -#ifndef _BESCHED_H -#define _BESCHED_H +/** + * @file + * @brief Scheduling utilities for nodes in Blocks and Blocks. + * @author Sebastian Hack + * @version $Id$ + */ +#ifndef FIRM_BE_BESCHED_H +#define FIRM_BE_BESCHED_H #include -void be_sched_dump(FILE *f, const ir_graph *irg); +#include "irgraph.h" +#include "irnode.h" +#include "beirg.h" -int (sched_get_time_step)(const ir_node *irn); -int (sched_has_succ)(const ir_node *irn); -int (sched_has_prev)(const ir_node *irn); -const ir_node *(sched_succ)(const ir_node *irn); -const ir_node *(sched_prev)(const ir_node *irn); -const ir_node *(sched_first)(const ir_node *block); -const ir_node *(sched_last)(const ir_node *block); -const ir_node *(sched_add)(ir_node *block, const ir_node *irn); +void be_sched_dump(FILE *f, ir_graph *irg); + +/** + * returns the time step of a node. Each node in a block has a timestep + * unique to that block. a node schedule before another node has a lower + * timestep than this node. + */ +int have_sched_info(const ir_graph *irg); +int sched_get_time_step(const ir_node *irn); +int sched_has_next(const ir_node *irn); +int sched_has_prev(const ir_node *irn); +int sched_is_scheduled(const ir_node *irn); +ir_node *sched_next(const ir_node *irn); +ir_node *sched_prev(const ir_node *irn); +ir_node *sched_first(const ir_node *block); +ir_node *sched_last(const ir_node *block); +void sched_add_before(const ir_node *before, const ir_node *irn); +void sched_add_after(const ir_node *after, const ir_node *irn); +void sched_init_block(const ir_node *block); +void sched_reset(const ir_node *node); +void sched_remove(const ir_node *irn); + +#define sched_is_end(irn) is_Block(irn) +#define sched_is_begin(irn) is_Block(irn) + +#define sched_foreach_from(from, irn) \ + for(irn = from; !sched_is_end(irn); irn = sched_next(irn)) + +#define sched_foreach_reverse_from(from, irn) \ + for(irn = from; !sched_is_begin(irn); irn = sched_prev(irn)) /** * A shorthand macro for iterating over a schedule. @@ -21,7 +69,7 @@ const ir_node *(sched_add)(ir_node *block, const ir_node *irn); * @param irn A ir node pointer used as an iterator. */ #define sched_foreach(block,irn) \ - for(irn = sched_first(block); irn; irn = sched_succ(irn)) + sched_foreach_from(sched_first(block), irn) /** * A shorthand macro for reversely iterating over a schedule. @@ -29,6 +77,15 @@ const ir_node *(sched_add)(ir_node *block, const ir_node *irn); * @param irn A ir node pointer used as an iterator. */ #define sched_foreach_reverse(block,irn) \ - for(irn = sched_last(block); irn; irn = sched_prev(irn)) + sched_foreach_reverse_from(sched_last(block), irn) + +/** + * Removes dead nodes from schedule + * @param irg the graph + */ +void be_remove_dead_nodes_from_schedule(be_irg_t *birg); + +void be_sched_init_phase(ir_graph *irg); +void be_sched_free_phase(ir_graph *irg); -#endif +#endif /* FIRM_BE_BESCHED_H */