3 * Copyright (C) 2002-2009, Parrot Foundation.
9 /* Two-way linked list of predecessors and successors */
10 #ifndef PARROT_CFG_H_GUARD
11 #define PARROT_CFG_H_GUARD
13 typedef struct _edge
{
14 struct _basic_block
*from
;
15 struct _basic_block
*to
;
16 struct _edge
*pred_next
;
17 struct _edge
*succ_next
;
21 typedef struct _basic_block
{
22 Instruction
*start
; /* First instruction in basic block */
23 Instruction
*end
; /* Last instruction in basic block */
27 unsigned int index
; /* on bb_list*/
31 enum block_enum_flags_t
{
36 typedef struct _loop_info
{
37 Set
*loop
; /* loop set containing bb's */
38 Set
*exits
; /* blocks that exit the loop */
39 int depth
; /* depth of this loop */
40 unsigned int n_entries
; /* nr of entries to this loop */
41 unsigned int header
; /* header block of loop */
42 unsigned int preheader
; /* preheader block of loop, if 1 entry point */
43 unsigned int size
; /* no of blocks in loop */
49 /* HEADERIZER BEGIN: compilers/imcc/cfg.c */
50 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
52 PARROT_WARN_UNUSED_RESULT
53 int blocks_are_connected(
54 ARGIN(const Basic_block
*from
),
55 ARGIN(const Basic_block
*to
))
56 __attribute__nonnull__(1)
57 __attribute__nonnull__(2);
59 void build_cfg(PARROT_INTERP
, ARGMOD(IMC_Unit
*unit
))
60 __attribute__nonnull__(1)
61 __attribute__nonnull__(2)
64 void clear_basic_blocks(ARGMOD(IMC_Unit
*unit
))
65 __attribute__nonnull__(1)
68 void compute_dominance_frontiers(PARROT_INTERP
, ARGMOD(IMC_Unit
*unit
))
69 __attribute__nonnull__(1)
70 __attribute__nonnull__(2)
73 void compute_dominators(PARROT_INTERP
, ARGMOD(IMC_Unit
*unit
))
74 __attribute__nonnull__(1)
75 __attribute__nonnull__(2)
78 PARROT_WARN_UNUSED_RESULT
79 int edge_count(ARGIN(const IMC_Unit
*unit
))
80 __attribute__nonnull__(1);
82 void find_basic_blocks(PARROT_INTERP
, ARGMOD(IMC_Unit
*unit
), int first
)
83 __attribute__nonnull__(1)
84 __attribute__nonnull__(2)
87 void find_loops(PARROT_INTERP
, ARGMOD(IMC_Unit
*unit
))
88 __attribute__nonnull__(1)
89 __attribute__nonnull__(2)
92 void free_life_info(ARGIN(const IMC_Unit
*unit
), ARGMOD(SymReg
*r
))
93 __attribute__nonnull__(1)
94 __attribute__nonnull__(2)
97 void life_analysis(PARROT_INTERP
, ARGIN(const IMC_Unit
*unit
))
98 __attribute__nonnull__(1)
99 __attribute__nonnull__(2);
102 PARROT_CANNOT_RETURN_NULL
103 Life_range
* make_life_range(PARROT_INTERP
, ARGMOD(SymReg
*r
), int idx
)
104 __attribute__nonnull__(1)
105 __attribute__nonnull__(2)
108 PARROT_WARN_UNUSED_RESULT
109 int natural_preheader(
110 ARGIN(const IMC_Unit
*unit
),
111 ARGIN(const Loop_info
*loop_info
))
112 __attribute__nonnull__(1)
113 __attribute__nonnull__(2);
115 void search_predecessors_not_in(
116 ARGIN(const Basic_block
*node
),
118 __attribute__nonnull__(1)
119 __attribute__nonnull__(2)
122 #define ASSERT_ARGS_blocks_are_connected __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
123 PARROT_ASSERT_ARG(from) \
124 , PARROT_ASSERT_ARG(to))
125 #define ASSERT_ARGS_build_cfg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
126 PARROT_ASSERT_ARG(interp) \
127 , PARROT_ASSERT_ARG(unit))
128 #define ASSERT_ARGS_clear_basic_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
129 PARROT_ASSERT_ARG(unit))
130 #define ASSERT_ARGS_compute_dominance_frontiers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
131 PARROT_ASSERT_ARG(interp) \
132 , PARROT_ASSERT_ARG(unit))
133 #define ASSERT_ARGS_compute_dominators __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
134 PARROT_ASSERT_ARG(interp) \
135 , PARROT_ASSERT_ARG(unit))
136 #define ASSERT_ARGS_edge_count __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
137 PARROT_ASSERT_ARG(unit))
138 #define ASSERT_ARGS_find_basic_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
139 PARROT_ASSERT_ARG(interp) \
140 , PARROT_ASSERT_ARG(unit))
141 #define ASSERT_ARGS_find_loops __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
142 PARROT_ASSERT_ARG(interp) \
143 , PARROT_ASSERT_ARG(unit))
144 #define ASSERT_ARGS_free_life_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
145 PARROT_ASSERT_ARG(unit) \
146 , PARROT_ASSERT_ARG(r))
147 #define ASSERT_ARGS_life_analysis __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
148 PARROT_ASSERT_ARG(interp) \
149 , PARROT_ASSERT_ARG(unit))
150 #define ASSERT_ARGS_make_life_range __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
151 PARROT_ASSERT_ARG(interp) \
152 , PARROT_ASSERT_ARG(r))
153 #define ASSERT_ARGS_natural_preheader __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
154 PARROT_ASSERT_ARG(unit) \
155 , PARROT_ASSERT_ARG(loop_info))
156 #define ASSERT_ARGS_search_predecessors_not_in __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
157 PARROT_ASSERT_ARG(node) \
158 , PARROT_ASSERT_ARG(s))
159 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
160 /* HEADERIZER END: compilers/imcc/cfg.c */
162 #endif /* PARROT_CFG_H_GUARD */
167 * c-file-style: "parrot"
169 * vim: expandtab shiftwidth=4: