9 /* Silly pseudo define. Do this right some day */
14 typedef struct pseudo
*pseudo_t
;
16 extern struct pseudo void_pseudo
;
18 #define VOID (&void_pseudo)
21 struct basic_block
*target
;
26 struct basic_block
*source
;
35 pseudo_t cond
; /* for branch and switch */
39 struct basic_block
*bb_true
, *bb_false
;
42 struct multijmp_list
*multijmp_list
;
44 struct /* phi_node */ {
45 struct phi_list
*phi_list
;
48 struct symbol
*orig_type
; /* casts */
54 struct /* multijump */ {
58 struct expression
*val
;
62 struct pseudo_list
*arguments
;
71 OP_RET
= OP_TERMINATOR
,
76 OP_TERMINATOR_END
= OP_UNWIND
,
87 OP_BINARY_END
= OP_SHR
,
94 OP_LOGICAL_END
= OP_XOR
,
96 /* Binary comparison */
98 OP_SET_EQ
= OP_BINCMP
,
108 OP_BINCMP_END
= OP_SET_AE
,
131 struct basic_block_list
;
132 struct instruction_list
;
135 * Basic block flags. Right now we only have one, which keeps
136 * track (at build time) whether the basic block has been branched
139 #define BB_REACHABLE 0x00000001
142 unsigned long flags
; /* BB status flags */
143 struct basic_block_list
*parents
; /* sources */
144 struct instruction_list
*insns
; /* Linear list of instructions */
147 static inline int is_branch_goto(struct instruction
*br
)
149 return br
&& br
->opcode
==OP_BR
&& (!br
->bb_true
|| !br
->bb_false
);
152 static inline void add_bb(struct basic_block_list
**list
, struct basic_block
*bb
)
154 add_ptr_list((struct ptr_list
**)list
, bb
);
157 static inline void add_instruction(struct instruction_list
**list
, struct instruction
*insn
)
159 add_ptr_list((struct ptr_list
**)list
, insn
);
162 static inline void add_multijmp(struct multijmp_list
**list
, struct multijmp
*multijmp
)
164 add_ptr_list((struct ptr_list
**)list
, multijmp
);
167 static inline void add_phi(struct phi_list
**list
, struct phi
*phi
)
169 add_ptr_list((struct ptr_list
**)list
, phi
);
172 static inline void add_pseudo(struct pseudo_list
**list
, struct pseudo
*pseudo
)
174 add_ptr_list((struct ptr_list
**)list
, pseudo
);
178 static inline int bb_terminated(struct basic_block
*bb
)
180 struct instruction
*insn
;
183 insn
= last_instruction(bb
->insns
);
184 return insn
&& insn
->opcode
>= OP_RET
&& insn
->opcode
<= OP_UNWIND
;
187 static inline int bb_reachable(struct basic_block
*bb
)
189 return bb
&& (bb
->parents
|| (bb
->flags
& BB_REACHABLE
));
194 struct symbol_list
*syms
;
195 struct basic_block_list
*bbs
;
196 struct basic_block
*active
;
199 struct entrypoint
*linearize_symbol(struct symbol
*sym
);
200 void show_entry(struct entrypoint
*ep
);
202 #endif /* LINEARIZE_H */