xref: /illumos-gate/usr/src/tools/smatch/src/flow.h (revision 1b58875ad7966cf2c85ee8e92f3da04f0a3b2f7a)
1 #ifndef FLOW_H
2 #define FLOW_H
3 
4 #include "lib.h"
5 
6 extern unsigned long bb_generation;
7 
8 #define REPEAT_CSE		1
9 #define REPEAT_SYMBOL_CLEANUP	2
10 #define REPEAT_CFG_CLEANUP	3
11 
12 struct entrypoint;
13 struct instruction;
14 
15 extern int simplify_flow(struct entrypoint *ep);
16 
17 extern void simplify_symbol_usage(struct entrypoint *ep);
18 extern void simplify_memops(struct entrypoint *ep);
19 extern void pack_basic_blocks(struct entrypoint *ep);
20 
21 extern void convert_instruction_target(struct instruction *insn, pseudo_t src);
22 extern void cleanup_and_cse(struct entrypoint *ep);
23 extern int simplify_instruction(struct instruction *);
24 
25 extern void kill_bb(struct basic_block *);
26 extern void kill_use(pseudo_t *);
27 extern void kill_unreachable_bbs(struct entrypoint *ep);
28 
29 extern void kill_insn(struct instruction *, int force);
30 static inline void kill_instruction(struct instruction *insn)
31 {
32 	kill_insn(insn, 0);
33 }
34 static inline void kill_instruction_force(struct instruction *insn)
35 {
36 	kill_insn(insn, 1);
37 }
38 
39 void check_access(struct instruction *insn);
40 void convert_load_instruction(struct instruction *, pseudo_t);
41 void rewrite_load_instruction(struct instruction *, struct pseudo_list *);
42 int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local);
43 
44 extern void clear_liveness(struct entrypoint *ep);
45 extern void track_pseudo_liveness(struct entrypoint *ep);
46 extern void track_pseudo_death(struct entrypoint *ep);
47 extern void track_phi_uses(struct instruction *insn);
48 
49 extern void vrfy_flow(struct entrypoint *ep);
50 extern int pseudo_in_list(struct pseudo_list *list, pseudo_t pseudo);
51 
52 #endif
53