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
27 #ifndef FIRM_BE_BEIFG_H
28 #define FIRM_BE_BEIFG_H
34 #include "becopyopt.h"
37 typedef struct _be_ifg_impl_t be_ifg_impl_t;
38 typedef struct _be_ifg_t be_ifg_t;
40 #define be_ifg_nodes_iter_alloca(self) (alloca(be_ifg_nodes_iter_size(self)))
41 #define be_ifg_neighbours_iter_alloca(self) (alloca(be_ifg_neighbours_iter_size(self)))
42 #define be_ifg_cliques_iter_alloca(self) (alloca(be_ifg_cliques_iter_size(self)))
44 size_t (be_ifg_nodes_iter_size)(const be_ifg_t *self);
45 size_t (be_ifg_neighbours_iter_size)(const be_ifg_t *self);
46 size_t (be_ifg_cliques_iter_size)(const be_ifg_t *self);
47 void (be_ifg_free)(be_ifg_t *self);
48 int (be_ifg_connected)(const be_ifg_t *self, const ir_node *a, const ir_node *b);
49 ir_node *(be_ifg_neighbours_begin)(const be_ifg_t *self, void *iter, const ir_node *irn);
50 ir_node *(be_ifg_neighbours_next)(const be_ifg_t *self, void *iter);
51 void (be_ifg_neighbours_break)(const be_ifg_t *self, void *iter);
52 ir_node *(be_ifg_nodes_begin)(const be_ifg_t *self, void *iter);
53 ir_node *(be_ifg_nodes_next)(const be_ifg_t *self, void *iter);
54 void (be_ifg_nodes_break)(const be_ifg_t *self, void *iter);
55 int (be_ifg_cliques_begin)(const be_ifg_t *self, void *iter, ir_node **buf);
56 int (be_ifg_cliques_next)(const be_ifg_t *self, void *iter);
57 void (be_ifg_cliques_break)(const be_ifg_t *self, void *iter);
58 int (be_ifg_degree)(const be_ifg_t *self, const ir_node *irn);
60 #define be_ifg_foreach_neighbour(self, iter, irn, pos) \
61 for(pos = be_ifg_neighbours_begin(self, iter, irn); (pos); pos = be_ifg_neighbours_next(self, iter))
63 #define be_ifg_foreach_node(self, iter, pos) \
64 for(pos = be_ifg_nodes_begin(self, iter); (pos); pos = be_ifg_nodes_next(self, iter))
66 #define be_ifg_foreach_clique(self, iter, buf, count) \
67 for(*(count) = be_ifg_cliques_begin(self, iter, buf); \
69 *(count) = be_ifg_cliques_next(self, iter))
77 void be_ifg_stat(be_irg_t *birg, be_ifg_t *ifg, be_ifg_stat_t *stat);
79 be_ifg_t *be_create_ifg(const be_chordal_env_t *env);
83 | _ \ _ _ _ __ ___ _ __ (_)_ __ __ _
84 | | | | | | | '_ ` _ \| '_ \| | '_ \ / _` |
85 | |_| | |_| | | | | | | |_) | | | | | (_| |
86 |____/ \__,_|_| |_| |_| .__/|_|_| |_|\__, |
90 typedef struct _be_ifg_dump_dot_cb_t {
91 int (*is_dump_node)(void *self, ir_node *irn);
92 void (*graph_attr)(FILE *f, void *self);
93 void (*node_attr)(FILE *f, void *self, ir_node *irn);
94 void (*edge_attr)(FILE *f, void *self, ir_node *from, ir_node *to);
95 void (*at_begin)(FILE *file, void *self);
96 void (*at_end)(FILE *file, void *self);
97 } be_ifg_dump_dot_cb_t;
99 void be_ifg_dump_dot(be_ifg_t *ifg, ir_graph *irg, FILE *file, const be_ifg_dump_dot_cb_t *cb, void *self);
100 void be_ifg_check_sorted(const be_ifg_t *ifg);
101 void be_ifg_check_sorted_to_file(const be_ifg_t *ifg, FILE *f);
102 void be_ifg_check_performance(be_chordal_env_t *chordal_env);
105 #endif /* FIRM_BE_BEIFG_H */