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 Interface for interference graphs.
23 * @author Sebastian Hack
26 #ifndef FIRM_BE_BEIFG_H
27 #define FIRM_BE_BEIFG_H
32 #include "irnodeset.h"
34 #include "becopyopt.h"
38 const be_chordal_env_t *env;
41 typedef struct nodes_iter_t {
42 const be_chordal_env_t *env;
49 typedef struct neighbours_iter_t {
50 const be_chordal_env_t *env;
53 ir_nodeset_t neighbours;
54 ir_nodeset_iterator_t iter;
57 typedef struct cliques_iter_t {
59 const be_chordal_env_t *cenv;
63 struct list_head *bor;
67 void be_ifg_free(be_ifg_t *ifg);
68 int be_ifg_connected(const be_ifg_t *ifg, const ir_node *a,
70 ir_node *be_ifg_neighbours_begin(const be_ifg_t *ifg, neighbours_iter_t *iter,
72 ir_node *be_ifg_neighbours_next(neighbours_iter_t *iter);
73 void be_ifg_neighbours_break(neighbours_iter_t *iter);
74 ir_node *be_ifg_nodes_begin(const be_ifg_t *ifg, nodes_iter_t *iter);
75 ir_node *be_ifg_nodes_next(nodes_iter_t *iter);
76 void be_ifg_nodes_break(nodes_iter_t *iter);
77 int be_ifg_cliques_begin(const be_ifg_t *ifg, cliques_iter_t *iter,
79 int be_ifg_cliques_next(cliques_iter_t *iter);
80 void be_ifg_cliques_break(cliques_iter_t *iter);
81 int be_ifg_degree(const be_ifg_t *ifg, const ir_node *irn);
83 #define be_ifg_foreach_neighbour(ifg, iter, irn, pos) \
84 for(pos = be_ifg_neighbours_begin(ifg, iter, irn); pos != NULL; pos = be_ifg_neighbours_next(iter))
86 #define be_ifg_foreach_node(ifg, iter, pos) \
87 for(pos = be_ifg_nodes_begin(ifg, iter); pos != NULL; pos = be_ifg_nodes_next(iter))
89 #define be_ifg_foreach_clique(ifg, iter, buf, count) \
90 for(*(count) = be_ifg_cliques_begin(ifg, iter, buf); \
92 *(count) = be_ifg_cliques_next(iter))
100 void be_ifg_stat(ir_graph *irg, be_ifg_t *ifg, be_ifg_stat_t *stat);
102 be_ifg_t *be_create_ifg(const be_chordal_env_t *env);