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
,
104 OP_BINCMP_END
= OP_SET_GT
,
127 struct basic_block_list
;
128 struct instruction_list
;
131 * Basic block flags. Right now we only have one, which keeps
132 * track (at build time) whether the basic block has been branched
135 #define BB_REACHABLE 0x00000001
138 unsigned long flags
; /* BB status flags */
139 struct basic_block_list
*parents
; /* sources */
140 struct instruction_list
*insns
; /* Linear list of instructions */
143 static inline int is_branch_goto(struct instruction
*br
)
145 return br
&& br
->opcode
==OP_BR
&& (!br
->bb_true
|| !br
->bb_false
);
148 static inline void add_bb(struct basic_block_list
**list
, struct basic_block
*bb
)
150 add_ptr_list((struct ptr_list
**)list
, bb
);
153 static inline void add_instruction(struct instruction_list
**list
, struct instruction
*insn
)
155 add_ptr_list((struct ptr_list
**)list
, insn
);
158 static inline void add_multijmp(struct multijmp_list
**list
, struct multijmp
*multijmp
)
160 add_ptr_list((struct ptr_list
**)list
, multijmp
);
163 static inline void add_phi(struct phi_list
**list
, struct phi
*phi
)
165 add_ptr_list((struct ptr_list
**)list
, phi
);
168 static inline void add_pseudo(struct pseudo_list
**list
, struct pseudo
*pseudo
)
170 add_ptr_list((struct ptr_list
**)list
, pseudo
);
174 static inline int bb_terminated(struct basic_block
*bb
)
176 struct instruction
*insn
;
179 insn
= last_instruction(bb
->insns
);
180 return insn
&& insn
->opcode
>= OP_RET
&& insn
->opcode
<= OP_UNWIND
;
183 static inline int bb_reachable(struct basic_block
*bb
)
185 return bb
&& (bb
->parents
|| (bb
->flags
& BB_REACHABLE
));
190 struct symbol_list
*syms
;
191 struct basic_block_list
*bbs
;
192 struct basic_block
*active
;
195 struct entrypoint
*linearize_symbol(struct symbol
*sym
);
196 void show_entry(struct entrypoint
*ep
);
198 #endif /* LINEARIZE_H */