beifg.h 2.98 KB
Newer Older
1
/**
Sebastian Hack's avatar
Sebastian Hack committed
2
3
 * @file   beifg.h
 * @date   18.11.2005
4
 * @author Sebastian Hack
Sebastian Hack's avatar
Sebastian Hack committed
5
6
7
 *
 * Copyright (C) 2005 Universitaet Karlsruhe
 * Released under the GPL
8
9
 */

Sebastian Hack's avatar
Sebastian Hack committed
10
11
#ifndef _BEIFG_H
#define _BEIFG_H
12

13
14
15
16
17
18
19
20
#include "becopyopt.h"

#ifdef WITH_LIBCORE
#include <libcore/lc_opts.h>
#include <libcore/lc_opts_enum.h>
#include <libcore/lc_timing.h>
#endif /* WITH_LIBCORE */

Michael Beck's avatar
Michael Beck committed
21
#include "firm_types.h"
22

Sebastian Hack's avatar
Sebastian Hack committed
23
24
typedef struct _be_ifg_impl_t   be_ifg_impl_t;
typedef struct _be_ifg_t        be_ifg_t;
25

Sebastian Hack's avatar
Sebastian Hack committed
26
#define be_ifg_nodes_iter_alloca(self)          (alloca(be_ifg_nodes_iter_size(self)))
Sebastian Hack's avatar
Sebastian Hack committed
27
#define be_ifg_neighbours_iter_alloca(self)     (alloca(be_ifg_neighbours_iter_size(self)))
Daniel Grund's avatar
Daniel Grund committed
28
#define be_ifg_cliques_iter_alloca(self)        (alloca(be_ifg_cliques_iter_size(self)))
Sebastian Hack's avatar
Sebastian Hack committed
29

Sebastian Hack's avatar
Sebastian Hack committed
30
31
size_t   (be_ifg_nodes_iter_size)(const void *self);
size_t   (be_ifg_neighbours_iter_size)(const void *self);
Daniel Grund's avatar
Daniel Grund committed
32
size_t   (be_ifg_cliques_iter_size)(const void *self);
Sebastian Hack's avatar
Sebastian Hack committed
33
34
35
36
37
38
39
40
void     (be_ifg_free)(void *self);
int      (be_ifg_connected)(const void *self, const ir_node *a, const ir_node *b);
ir_node *(be_ifg_neighbours_begin)(const void *self, void *iter, const ir_node *irn);
ir_node *(be_ifg_neighbours_next)(const void *self, void *iter);
void     (be_ifg_neighbours_break)(const void *self, void *iter);
ir_node *(be_ifg_nodes_begin)(const void *self, void *iter);
ir_node *(be_ifg_nodes_next)(const void *self, void *iter);
void     (be_ifg_nodes_break)(const void *self, void *iter);
Daniel Grund's avatar
Daniel Grund committed
41
42
43
int      (be_ifg_cliques_begin)(const void *self, void *iter, ir_node **buf);
int      (be_ifg_cliques_next)(const void *self, void *iter);
void     (be_ifg_cliques_break)(const void *self, void *iter);
Sebastian Hack's avatar
Sebastian Hack committed
44
int      (be_ifg_degree)(const void *self, const ir_node *irn);
45

Sebastian Hack's avatar
Sebastian Hack committed
46
47
#define be_ifg_foreach_neighbour(self, iter, irn, pos) \
	for(pos = be_ifg_neighbours_begin(self, iter, irn); (pos); pos = be_ifg_neighbours_next(self, iter))
48

Sebastian Hack's avatar
Sebastian Hack committed
49
50
#define be_ifg_foreach_node(self, iter, pos) \
	for(pos = be_ifg_nodes_begin(self, iter); (pos); pos = be_ifg_nodes_next(self, iter))
51

Daniel Grund's avatar
Daniel Grund committed
52
53
54
55
56
#define be_ifg_foreach_clique(self, iter, buf, count) \
	for(*(count) = be_ifg_cliques_begin(self, iter, buf); \
        *(count) != -1 ; \
        *(count) = be_ifg_cliques_next(self, iter))

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
	 ____                        _
	|  _ \ _   _ _ __ ___  _ __ (_)_ __   __ _
	| | | | | | | '_ ` _ \| '_ \| | '_ \ / _` |
	| |_| | |_| | | | | | | |_) | | | | | (_| |
	|____/ \__,_|_| |_| |_| .__/|_|_| |_|\__, |
                          |_|            |___/
*/

typedef struct _be_ifg_dump_dot_cb_t {
	int  (*is_dump_node)(void *self, ir_node *irn);
	void (*graph_attr)(FILE *f, void *self);
	void (*node_attr)(FILE *f, void *self, ir_node *irn);
	void (*edge_attr)(FILE *f, void *self, ir_node *from, ir_node *to);
	void (*at_begin)(FILE *file, void *self);
	void (*at_end)(FILE *file, void *self);
} be_ifg_dump_dot_cb_t;

void be_ifg_dump_dot(be_ifg_t *ifg, ir_graph *irg, FILE *file, const be_ifg_dump_dot_cb_t *cb, void *self);
76
void be_ifg_check_sorted(const be_ifg_t *ifg, FILE *f);
77
78
void be_ifg_check_performance(be_chordal_env_t *chordal_env);

79

Sebastian Hack's avatar
Sebastian Hack committed
80
#endif /* _BEIFG_H */