xref: /illumos-gate/usr/src/tools/smatch/src/flow.h (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
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 << 0)
9 #define REPEAT_SYMBOL_CLEANUP	(1 << 1)
10 #define REPEAT_CFG_CLEANUP	(1 << 2)
11 
12 struct entrypoint;
13 struct instruction;
14 
15 extern int simplify_flow(struct entrypoint *ep);
16 
17 extern void kill_dead_stores(struct entrypoint *ep, pseudo_t addr, int local);
18 extern void simplify_symbol_usage(struct entrypoint *ep);
19 extern void simplify_memops(struct entrypoint *ep);
20 extern void pack_basic_blocks(struct entrypoint *ep);
21 
22 extern void convert_instruction_target(struct instruction *insn, pseudo_t src);
23 extern void remove_dead_insns(struct entrypoint *);
24 extern int simplify_instruction(struct instruction *);
25 
26 extern void kill_bb(struct basic_block *);
27 extern void kill_use(pseudo_t *);
28 extern void remove_use(pseudo_t *);
29 extern void kill_unreachable_bbs(struct entrypoint *ep);
30 
31 extern int kill_insn(struct instruction *, int force);
kill_instruction(struct instruction * insn)32 static inline int kill_instruction(struct instruction *insn)
33 {
34 	return kill_insn(insn, 0);
35 }
kill_instruction_force(struct instruction * insn)36 static inline int kill_instruction_force(struct instruction *insn)
37 {
38 	return kill_insn(insn, 1);
39 }
40 
41 void check_access(struct instruction *insn);
42 void convert_load_instruction(struct instruction *, pseudo_t);
43 void rewrite_load_instruction(struct instruction *, struct pseudo_list *);
44 int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local);
45 
46 extern void vrfy_flow(struct entrypoint *ep);
47 extern int pseudo_in_list(struct pseudo_list *list, pseudo_t pseudo);
48 
49 #endif
50