11f5207b7SJohn Levon struct stree; 21f5207b7SJohn Levon 31f5207b7SJohn Levon extern int unfree_stree; 41f5207b7SJohn Levon 51f5207b7SJohn Levon DECLARE_PTR_LIST(state_list, struct sm_state); 61f5207b7SJohn Levon DECLARE_PTR_LIST(state_list_stack, struct state_list); 71f5207b7SJohn Levon 81f5207b7SJohn Levon struct named_stree { 91f5207b7SJohn Levon char *name; 101f5207b7SJohn Levon struct symbol *sym; 111f5207b7SJohn Levon struct stree *stree; 121f5207b7SJohn Levon }; 131f5207b7SJohn Levon DECLARE_ALLOCATOR(named_stree); 141f5207b7SJohn Levon DECLARE_PTR_LIST(named_stree_stack, struct named_stree); 151f5207b7SJohn Levon 161f5207b7SJohn Levon 171f5207b7SJohn Levon extern struct state_list_stack *implied_pools; 181f5207b7SJohn Levon extern int __stree_id; 191f5207b7SJohn Levon extern int sm_state_counter; 201f5207b7SJohn Levon 211f5207b7SJohn Levon const char *show_sm(struct sm_state *sm); 221f5207b7SJohn Levon void __print_stree(struct stree *stree); 231f5207b7SJohn Levon void add_history(struct sm_state *sm); 241f5207b7SJohn Levon int cmp_tracker(const struct sm_state *a, const struct sm_state *b); 251f5207b7SJohn Levon char *alloc_sname(const char *str); 261f5207b7SJohn Levon struct sm_state *alloc_sm_state(int owner, const char *name, 271f5207b7SJohn Levon struct symbol *sym, struct smatch_state *state); 281f5207b7SJohn Levon 291f5207b7SJohn Levon void free_every_single_sm_state(void); 301f5207b7SJohn Levon struct sm_state *clone_sm(struct sm_state *s); 311f5207b7SJohn Levon int is_merged(struct sm_state *sm); 321f5207b7SJohn Levon int is_leaf(struct sm_state *sm); 331f5207b7SJohn Levon struct state_list *clone_slist(struct state_list *from_slist); 341f5207b7SJohn Levon 351f5207b7SJohn Levon int slist_has_state(struct state_list *slist, struct smatch_state *state); 361f5207b7SJohn Levon 371f5207b7SJohn Levon int too_many_possible(struct sm_state *sm); 381f5207b7SJohn Levon void add_possible_sm(struct sm_state *to, struct sm_state *new); 391f5207b7SJohn Levon struct sm_state *merge_sm_states(struct sm_state *one, struct sm_state *two); 401f5207b7SJohn Levon struct smatch_state *get_state_stree(struct stree *stree, int owner, const char *name, 411f5207b7SJohn Levon struct symbol *sym); 421f5207b7SJohn Levon 431f5207b7SJohn Levon struct sm_state *get_sm_state_stree(struct stree *stree, int owner, const char *name, 441f5207b7SJohn Levon struct symbol *sym); 451f5207b7SJohn Levon 461f5207b7SJohn Levon void overwrite_sm_state_stree(struct stree **stree, struct sm_state *sm); 471f5207b7SJohn Levon void overwrite_sm_state_stree_stack(struct stree_stack **stack, struct sm_state *sm); 481f5207b7SJohn Levon struct sm_state *set_state_stree(struct stree **stree, int owner, const char *name, 491f5207b7SJohn Levon struct symbol *sym, struct smatch_state *state); 501f5207b7SJohn Levon void set_state_stree_perm(struct stree **stree, int owner, const char *name, 511f5207b7SJohn Levon struct symbol *sym, struct smatch_state *state); 521f5207b7SJohn Levon void delete_state_stree(struct stree **stree, int owner, const char *name, 531f5207b7SJohn Levon struct symbol *sym); 541f5207b7SJohn Levon 551f5207b7SJohn Levon void delete_state_stree_stack(struct stree_stack **stack, int owner, const char *name, 561f5207b7SJohn Levon struct symbol *sym); 571f5207b7SJohn Levon 581f5207b7SJohn Levon void push_stree(struct stree_stack **list_stack, struct stree *stree); 591f5207b7SJohn Levon struct stree *pop_stree(struct stree_stack **list_stack); 601f5207b7SJohn Levon struct stree *top_stree(struct stree_stack *stack); 611f5207b7SJohn Levon 621f5207b7SJohn Levon void free_slist(struct state_list **slist); 631f5207b7SJohn Levon void free_stree_stack(struct stree_stack **stack); 641f5207b7SJohn Levon void free_stack_and_strees(struct stree_stack **stree_stack); 651f5207b7SJohn Levon unsigned long get_pool_count(void); 661f5207b7SJohn Levon 671f5207b7SJohn Levon struct sm_state *set_state_stree_stack(struct stree_stack **stack, int owner, const char *name, 681f5207b7SJohn Levon struct symbol *sym, struct smatch_state *state); 691f5207b7SJohn Levon 701f5207b7SJohn Levon struct sm_state *get_sm_state_stree_stack(struct stree_stack *stack, 711f5207b7SJohn Levon int owner, const char *name, 721f5207b7SJohn Levon struct symbol *sym); 731f5207b7SJohn Levon struct smatch_state *get_state_stree_stack(struct stree_stack *stack, int owner, 741f5207b7SJohn Levon const char *name, struct symbol *sym); 751f5207b7SJohn Levon 761f5207b7SJohn Levon int out_of_memory(void); 771f5207b7SJohn Levon int low_on_memory(void); 781f5207b7SJohn Levon void merge_stree(struct stree **to, struct stree *stree); 791f5207b7SJohn Levon void merge_stree_no_pools(struct stree **to, struct stree *stree); 801f5207b7SJohn Levon void merge_stree(struct stree **to, struct stree *right); 811f5207b7SJohn Levon void merge_fake_stree(struct stree **to, struct stree *stree); 821f5207b7SJohn Levon void filter_stree(struct stree **stree, struct stree *filter); 831f5207b7SJohn Levon void and_stree_stack(struct stree_stack **stree_stack); 841f5207b7SJohn Levon 851f5207b7SJohn Levon void or_stree_stack(struct stree_stack **pre_conds, 861f5207b7SJohn Levon struct stree *cur_stree, 871f5207b7SJohn Levon struct stree_stack **stack); 881f5207b7SJohn Levon 891f5207b7SJohn Levon struct stree **get_named_stree(struct named_stree_stack *stack, 901f5207b7SJohn Levon const char *name, 911f5207b7SJohn Levon struct symbol *sym); 921f5207b7SJohn Levon 931f5207b7SJohn Levon void overwrite_stree(struct stree *from, struct stree **to); 941f5207b7SJohn Levon 951f5207b7SJohn Levon /* add stuff smatch_returns.c here */ 961f5207b7SJohn Levon 971f5207b7SJohn Levon void all_return_states_hook(void (*callback)(void)); 981f5207b7SJohn Levon 99*efe51d0cSJohn Levon void allocate_dynamic_states_array(int num_checks); 100