xref: /illumos-gate/usr/src/tools/smatch/src/flow.h (revision c85f09cc)
11f5207b7SJohn Levon #ifndef FLOW_H
21f5207b7SJohn Levon #define FLOW_H
31f5207b7SJohn Levon 
41f5207b7SJohn Levon #include "lib.h"
51f5207b7SJohn Levon 
61f5207b7SJohn Levon extern unsigned long bb_generation;
71f5207b7SJohn Levon 
8*c85f09ccSJohn Levon #define REPEAT_CSE		(1 << 0)
9*c85f09ccSJohn Levon #define REPEAT_SYMBOL_CLEANUP	(1 << 1)
10*c85f09ccSJohn Levon #define REPEAT_CFG_CLEANUP	(1 << 2)
111f5207b7SJohn Levon 
121f5207b7SJohn Levon struct entrypoint;
131f5207b7SJohn Levon struct instruction;
141f5207b7SJohn Levon 
151f5207b7SJohn Levon extern int simplify_flow(struct entrypoint *ep);
161f5207b7SJohn Levon 
17*c85f09ccSJohn Levon extern void kill_dead_stores(struct entrypoint *ep, pseudo_t addr, int local);
181f5207b7SJohn Levon extern void simplify_symbol_usage(struct entrypoint *ep);
191f5207b7SJohn Levon extern void simplify_memops(struct entrypoint *ep);
201f5207b7SJohn Levon extern void pack_basic_blocks(struct entrypoint *ep);
211f5207b7SJohn Levon 
221f5207b7SJohn Levon extern void convert_instruction_target(struct instruction *insn, pseudo_t src);
23*c85f09ccSJohn Levon extern void remove_dead_insns(struct entrypoint *);
241f5207b7SJohn Levon extern int simplify_instruction(struct instruction *);
251f5207b7SJohn Levon 
261f5207b7SJohn Levon extern void kill_bb(struct basic_block *);
271f5207b7SJohn Levon extern void kill_use(pseudo_t *);
28*c85f09ccSJohn Levon extern void remove_use(pseudo_t *);
291f5207b7SJohn Levon extern void kill_unreachable_bbs(struct entrypoint *ep);
301f5207b7SJohn Levon 
31*c85f09ccSJohn Levon extern int kill_insn(struct instruction *, int force);
kill_instruction(struct instruction * insn)32*c85f09ccSJohn Levon static inline int kill_instruction(struct instruction *insn)
331f5207b7SJohn Levon {
34*c85f09ccSJohn Levon 	return kill_insn(insn, 0);
351f5207b7SJohn Levon }
kill_instruction_force(struct instruction * insn)36*c85f09ccSJohn Levon static inline int kill_instruction_force(struct instruction *insn)
371f5207b7SJohn Levon {
38*c85f09ccSJohn Levon 	return kill_insn(insn, 1);
391f5207b7SJohn Levon }
401f5207b7SJohn Levon 
411f5207b7SJohn Levon void check_access(struct instruction *insn);
421f5207b7SJohn Levon void convert_load_instruction(struct instruction *, pseudo_t);
431f5207b7SJohn Levon void rewrite_load_instruction(struct instruction *, struct pseudo_list *);
441f5207b7SJohn Levon int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local);
451f5207b7SJohn Levon 
461f5207b7SJohn Levon extern void vrfy_flow(struct entrypoint *ep);
471f5207b7SJohn Levon extern int pseudo_in_list(struct pseudo_list *list, pseudo_t pseudo);
481f5207b7SJohn Levon 
491f5207b7SJohn Levon #endif
50