-
Notifications
You must be signed in to change notification settings - Fork 138
/
cfg.h
147 lines (122 loc) · 4.56 KB
/
cfg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
* Copyright (C) 2002-2011, Parrot Foundation.
*/
/* Data structures: */
/* Two-way linked list of predecessors and successors */
#ifndef PARROT_CFG_H_GUARD
#define PARROT_CFG_H_GUARD
typedef struct _edge {
struct _basic_block *from;
struct _basic_block *to;
struct _edge *pred_next;
struct _edge *succ_next;
struct _edge *next;
} Edge;
typedef struct _basic_block {
Instruction *start; /* First instruction in basic block */
Instruction *end; /* Last instruction in basic block */
Edge *pred_list;
Edge *succ_list;
int loop_depth;
unsigned int index; /* on bb_list*/
int flag;
} Basic_block;
enum block_enum_flags_t {
BB_IS_SUB = 1 << 0
};
typedef struct _loop_info {
Set *loop; /* loop set containing bb's */
Set *exits; /* blocks that exit the loop */
int depth; /* depth of this loop */
unsigned int n_entries; /* nr of entries to this loop */
unsigned int header; /* header block of loop */
unsigned int preheader; /* preheader block of loop, if 1 entry point */
unsigned int size; /* no of blocks in loop */
} Loop_info;
/* Functions: */
/* HEADERIZER BEGIN: compilers/imcc/cfg.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
void build_cfg(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc)
FUNC_MODIFIES(*unit);
void clear_basic_blocks(ARGMOD(IMC_Unit *unit))
__attribute__nonnull__(1)
FUNC_MODIFIES(*unit);
void compute_dominance_frontiers(
ARGMOD(imc_info_t *imcc),
ARGMOD(IMC_Unit *unit))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc)
FUNC_MODIFIES(*unit);
void compute_dominators(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc)
FUNC_MODIFIES(*unit);
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
int edge_count(ARGIN(const IMC_Unit *unit))
__attribute__nonnull__(1);
void find_basic_blocks(
ARGMOD(imc_info_t *imcc),
ARGMOD(IMC_Unit *unit),
int first)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc)
FUNC_MODIFIES(*unit);
void find_loops(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc)
FUNC_MODIFIES(*unit);
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
int natural_preheader(
ARGIN(const IMC_Unit *unit),
ARGIN(const Loop_info *loop_info))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
void search_predecessors_not_in(
ARGIN(const Basic_block *node),
ARGMOD(Set *s))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*s);
#define ASSERT_ARGS_build_cfg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_clear_basic_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_compute_dominance_frontiers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_compute_dominators __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_edge_count __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_find_basic_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_find_loops __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(unit))
#define ASSERT_ARGS_natural_preheader __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(unit) \
, PARROT_ASSERT_ARG(loop_info))
#define ASSERT_ARGS_search_predecessors_not_in __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(node) \
, PARROT_ASSERT_ARG(s))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: compilers/imcc/cfg.c */
#endif /* PARROT_CFG_H_GUARD */
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/