10 struct pseudo_ptr_list
;
22 unsigned int usage
:24,
24 struct pseudo_ptr_list
*users
;
27 struct instruction
*def
;
32 extern struct pseudo void_pseudo
;
34 #define VOID (&void_pseudo)
37 struct basic_block
*target
;
42 struct basic_block
*source
;
48 struct basic_block
*bb
;
52 pseudo_t cond
; /* for branch and switch */
56 struct basic_block
*bb_true
, *bb_false
;
59 struct multijmp_list
*multijmp_list
;
61 struct /* phi_node */ {
62 struct phi_list
*phi_list
;
65 struct symbol
*orig_type
; /* casts */
67 unsigned int offset
; /* memops */
76 struct /* multijump */ {
80 struct expression
*val
;
81 struct symbol
*symbol
;
85 struct pseudo_list
*arguments
;
87 struct /* context */ {
97 OP_RET
= OP_TERMINATOR
,
103 OP_TERMINATOR_END
= OP_UNWIND
,
122 OP_BINARY_END
= OP_OR_BOOL
,
124 /* Binary comparison */
126 OP_SET_EQ
= OP_BINCMP
,
136 OP_BINCMP_END
= OP_SET_AE
,
142 /* Setcc - always in combination with a select or conditional branch */
164 /* Sparse tagging (line numbers, context, whatever) */
168 struct basic_block_list
;
169 struct instruction_list
;
173 unsigned long generation
;
175 struct basic_block_list
*parents
; /* sources */
176 struct basic_block_list
*children
; /* destinations */
177 struct phi_list
*phinodes
; /* phi-nodes that need this bb */
178 struct instruction_list
*insns
; /* Linear list of instructions */
181 static inline int is_branch_goto(struct instruction
*br
)
183 return br
&& br
->opcode
==OP_BR
&& (!br
->bb_true
|| !br
->bb_false
);
186 static inline void add_bb(struct basic_block_list
**list
, struct basic_block
*bb
)
188 add_ptr_list((struct ptr_list
**)list
, bb
);
191 static inline void add_instruction(struct instruction_list
**list
, struct instruction
*insn
)
193 add_ptr_list((struct ptr_list
**)list
, insn
);
196 static inline void add_multijmp(struct multijmp_list
**list
, struct multijmp
*multijmp
)
198 add_ptr_list((struct ptr_list
**)list
, multijmp
);
201 static inline void add_phi(struct phi_list
**list
, struct phi
*phi
)
203 add_ptr_list((struct ptr_list
**)list
, phi
);
206 static inline void *add_pseudo(struct pseudo_list
**list
, struct pseudo
*pseudo
)
208 return add_ptr_list((struct ptr_list
**)list
, pseudo
);
212 static inline int bb_terminated(struct basic_block
*bb
)
214 struct instruction
*insn
;
217 insn
= last_instruction(bb
->insns
);
218 return insn
&& insn
->opcode
>= OP_RET
&& insn
->opcode
<= OP_UNWIND
;
221 static inline int bb_reachable(struct basic_block
*bb
)
228 struct symbol_list
*syms
;
229 struct symbol_list
*accesses
;
230 struct instruction_list
*switches
;
231 struct basic_block_list
*bbs
;
232 struct basic_block
*active
;
233 struct basic_block
*entry
;
236 struct entrypoint
*linearize_symbol(struct symbol
*sym
);
237 void show_entry(struct entrypoint
*ep
);
239 #endif /* LINEARIZE_H */