PIPS
points-to-local.h
Go to the documentation of this file.
1 /*
2 
3  $Id: points-to-local.h 23412 2017-08-09 15:07:09Z irigoin $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #include "points_to_private.h"
25 #include "effects.h"
26 #define SEQUENTIAL_POINTS_TO_SETS_SUFFIX ".pt"
27 #define USER_POINTS_TO_SETS_SUFFIX ".upt"
28 
29 // FI: just in case another data structure would be more suitable or
30 // more efficient
31 // For instance, set of points-to could be a type declared in
32 // points_to_private.tex
33 
34 #if 0
35 
36 typedef set pt_map;
37 #define pt_map_undefined set_undefined
38 #define pt_map_undefined_p(pt) ((pt)==set_undefined)
39 #define new_pt_map() set_generic_make(set_private, points_to_equal_p, points_to_rank)
40 #define assign_pt_map(x,y) set_assign(x, y)
41 #define clear_pt_map(pt) set_clear(pt)
42 #define free_pt_map(pt) set_free(pt)
43 #define print_pt_map(pt) print_points_to_set("",pt);
44 // FI: varargs; probably OK with gcc preprocessor
45 #define free_pt_maps sets_free
46 #define union_of_pt_maps(pt1, pt2, pt3) set_union(pt1, pt2, pt3)
47 #define difference_of_pt_maps(pt1, pt2, pt3) set_difference(pt1, pt2, pt3)
48 
49 #define empty_pt_map_p(s) set_empty_p(s)
50 #define consistent_pt_map_p(s) consistent_points_to_set(s)
51 // FI: Not so sure we do not need a new name
52 #define source_in_pt_map_p(cell,set) source_in_set_p(cell,set)
53 // FI: replaced by a function
54 //#define add_arc_to_pt_map(a, s) set_add_element((set) s, (set) s, (void *) a)
55 
56 // FI: useful to have a function for debugging
57 //#define remove_arc_from_pt_map(a, s) set_del_element((set) s, (set) s, (void *) a)
58 
59 // A reminder:
60 // full_copy_pt_map(pt_map m)
61 
62 #else
63 
65 #define pt_map_undefined points_to_graph_undefined
66 #define pt_map_undefined_p(pt) ((pt)==points_to_graph_undefined)
67 #define new_pt_map() make_points_to_graph(false, set_generic_make(set_private, points_to_equal_p, points_to_rank))
68 #define new_simple_pt_map() set_generic_make(set_private, points_to_equal_p, points_to_rank)
69 #define assign_pt_map(x,y) ((void) set_assign(points_to_graph_set(x), points_to_graph_set(y)), (x))
70 #define clear_pt_map(pt) set_clear(points_to_graph_set(pt))
71 // FI: free_set() is a shallow free, free_points_to_graph() is a deep free
72 #define free_pt_map(pt) free_points_to_graph(pt)
73 #define print_pt_map(pt) print_points_to_set("", points_to_graph_set(pt));
74 // FI: varargs; probably OK with gcc preprocessor
75 #define free_pt_maps free_points_to_graph_sets
76 
77 #define union_of_pt_maps(pt1, pt2, pt3) set_union(points_to_graph_set(pt1), \
78  points_to_graph_set(pt2), \
79  points_to_graph_set(pt3))
80 #define difference_of_pt_maps(pt1, pt2, pt3) \
81  set_difference(points_to_graph_set(pt1), \
82  points_to_graph_set(pt2), \
83  points_to_graph_set(pt3))
84 
85 #define empty_pt_map_p(s) set_empty_p(points_to_graph_set(s))
86 //#define consistent_pt_map_p(s) consistent_points_to_set(points_to_graph_set(s))
87 #define consistent_pt_map_p(s) consistent_points_to_graph_p(s)
88 // FI: Not so sure we do not need a new name
89 #define source_in_pt_map_p(cell,set) source_in_set_p(cell,points_to_graph_set(set))
90 // Returns pt_map s after update via side-effect
91 // FI: replaced by a function to add check on arc before insertion
92 // #define add_arc_to_pt_map(a, s) (set_add_element((set) points_to_graph_set(s), (set) points_to_graph_set(s), (void *) a))
93 //#define add_arc_to_pt_map_(a, s) (add_arc_to_pt_map(a, s), (s))
94 //#define add_arc_to_simple_pt_map(a, s) set_add_element((set) s, (set) s, (void *) a)
95 
96 // FI: useful to have a function for debugging
97 #define remove_arc_from_pt_map(a, s) (set_del_element((set) points_to_graph_set(s), (set) points_to_graph_set(s), (void *) a))
98 #define remove_arc_from_pt_map_(a, s) (remove_arc_from_pt_map(a, s), (s))
99 //#define remove_arc_from_simple_pt_map(a, s) set_del_element((set) s, (set) s, (void *) a)
100 
101 // A reminder:
102 // full_copy_pt_map(pt_map m)
103 #endif
points_to_graph pt_map
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59