2 * sparse/smatch_extra.h
4 * Copyright (C) 2009 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
14 DECLARE_PTR_LIST(range_list
, struct data_range
);
15 DECLARE_PTR_LIST(range_list_stack
, struct range_list
);
19 struct range_list
*value_ranges
;
21 DECLARE_ALLOCATOR(data_info
);
23 /* these are implimented in smatch_ranges.c */
24 struct data_range
*alloc_range_perm(long long min
, long long max
);
25 void add_range(struct range_list
**list
, long long min
, long long max
);
26 int true_comparison_range(struct data_range
*left
, int comparison
, struct data_range
*right
);
27 int possibly_true(int comparison
, struct data_info
*dinfo
, int num
, int left
);
28 int possibly_true_range_list(int comparison
, struct data_info
*dinfo
, struct range_list
*values
, int left
);
29 int possibly_false(int comparison
, struct data_info
*dinfo
, int num
, int left
);
30 int possibly_false_range_list(int comparison
, struct data_info
*dinfo
, struct range_list
*values
, int left
);
31 void free_data_info_allocs(void);
32 struct range_list
*clone_range_list(struct range_list
*list
);
33 char *show_ranges(struct range_list
*list
);
34 struct range_list
*remove_range(struct range_list
*list
, long long min
, long long max
);
36 /* used in smatch_slist. implemented in smatch_extra.c */
37 int implied_not_equal(struct expression
*expr
, long long val
);
38 struct sm_state
*__extra_pre_loop_hook_before(struct statement
*iterator_pre_statement
);
39 int __iterator_unchanged(struct sm_state
*sm
, struct statement
*iterator
);
40 void __extra_pre_loop_hook_after(struct sm_state
*sm
,
41 struct statement
*iterator
,
42 struct expression
*condition
);
44 /* also implemented in smatch_extra */
45 struct smatch_state
*alloc_extra_state(int val
);
46 struct smatch_state
*alloc_extra_state_range_list(struct range_list
*rl
);
47 struct smatch_state
*add_filter(struct smatch_state
*orig
, long long filter
);
48 struct smatch_state
*extra_undefined();
50 struct data_info
*alloc_dinfo_range(long long min
, long long max
);
51 struct data_info
*alloc_dinfo_range_list(struct range_list
*rl
);
52 struct range_list
*range_list_union(struct range_list
*one
, struct range_list
*two
);
53 long long get_dinfo_min(struct data_info
*dinfo
);
54 long long get_dinfo_max(struct data_info
*dinfo
);
55 int get_single_value_from_range(struct data_info
*dinfo
, long long *val
);
57 void function_comparison(int comparison
, struct expression
*expr
, long long value
, int left
);
59 int true_comparison_range_lr(int comparison
, struct data_range
*var
, struct data_range
*val
, int left
);
60 int false_comparison_range_lr(int comparison
, struct data_range
*var
, struct data_range
*val
, int left
);
61 struct data_range
*alloc_range(long long min
, long long max
);
62 void tack_on(struct range_list
**list
, struct data_range
*drange
);
63 int in_list_exact(struct range_list
*list
, struct data_range
*drange
);
65 struct smatch_state
*alloc_extra_state_range(long long min
, long long max
);
67 void push_range_list(struct range_list_stack
**rl_stack
, struct range_list
*rl
);
68 struct range_list
*pop_range_list(struct range_list_stack
**rl_stack
);
69 struct range_list
*top_range_list(struct range_list_stack
*rl_stack
);
70 void filter_top_range_list(struct range_list_stack
**rl_stack
, long long num
);