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 */
165 /* Sparse tagging (line numbers, context, whatever) */
169 struct basic_block_list
;
170 struct instruction_list
;
174 unsigned long generation
;
176 struct basic_block_list
*parents
; /* sources */
177 struct basic_block_list
*children
; /* destinations */
178 struct phi_list
*phinodes
; /* phi-nodes that need this bb */
179 struct instruction_list
*insns
; /* Linear list of instructions */
182 static inline int is_branch_goto(struct instruction
*br
)
184 return br
&& br
->opcode
==OP_BR
&& (!br
->bb_true
|| !br
->bb_false
);
187 static inline void add_bb(struct basic_block_list
**list
, struct basic_block
*bb
)
189 add_ptr_list((struct ptr_list
**)list
, bb
);
192 static inline void add_instruction(struct instruction_list
**list
, struct instruction
*insn
)
194 add_ptr_list((struct ptr_list
**)list
, insn
);
197 static inline void add_multijmp(struct multijmp_list
**list
, struct multijmp
*multijmp
)
199 add_ptr_list((struct ptr_list
**)list
, multijmp
);
202 static inline void add_phi(struct phi_list
**list
, struct phi
*phi
)
204 add_ptr_list((struct ptr_list
**)list
, phi
);
207 static inline void *add_pseudo(struct pseudo_list
**list
, struct pseudo
*pseudo
)
209 return add_ptr_list((struct ptr_list
**)list
, pseudo
);
213 static inline int bb_terminated(struct basic_block
*bb
)
215 struct instruction
*insn
;
218 insn
= last_instruction(bb
->insns
);
219 return insn
&& insn
->opcode
>= OP_RET
&& insn
->opcode
<= OP_UNWIND
;
222 static inline int bb_reachable(struct basic_block
*bb
)
229 struct symbol_list
*syms
;
230 struct symbol_list
*accesses
;
231 struct instruction_list
*switches
;
232 struct basic_block_list
*bbs
;
233 struct basic_block
*active
;
234 struct basic_block
*entry
;
237 struct phi
* alloc_phi(struct basic_block
*source
, pseudo_t pseudo
);
238 pseudo_t
alloc_pseudo(struct instruction
*def
);
239 pseudo_t
value_pseudo(long long val
);
241 struct entrypoint
*linearize_symbol(struct symbol
*sym
);
242 void show_entry(struct entrypoint
*ep
);
244 #endif /* LINEARIZE_H */