1818#define PHASAR_PHASARLLVM_POINTER_POINTSTOGRAPH_H_
1919
2020#include < iostream>
21+ #include < unordered_map>
22+ #include < unordered_set>
2123#include < vector>
2224
2325#include < boost/graph/adjacency_list.hpp>
@@ -48,18 +50,6 @@ static inline bool isInterestingPointer(llvm::Value *V) {
4850 !llvm::isa<llvm::ConstantPointerNull>(V);
4951}
5052
51- enum class PointerAnalysisType {
52- #define ANALYSIS_SETUP_POINTER_TYPE (NAME, CMDFLAG, TYPE ) TYPE,
53- #include < phasar/PhasarLLVM/Utils/AnalysisSetups.def>
54- Invalid
55- };
56-
57- std::string to_string (const PointerAnalysisType &PA);
58-
59- PointerAnalysisType to_PointerAnalysisType (const std::string &S);
60-
61- std::ostream &operator <<(std::ostream &os, const PointerAnalysisType &PA);
62-
6353// TODO: add a more high level description.
6454/* *
6555 * This class is a representation of a points-to graph. It is possible to
@@ -83,9 +73,9 @@ class PointsToGraph {
8373 * This might be an Instruction, an Operand of an Instruction, Global
8474 * Variable or a formal Argument.
8575 */
86- const llvm::Value *value = nullptr ;
76+ const llvm::Value *V = nullptr ;
8777 // / Holds the llvm IR code for that vertex.
88- std::string ir_code ;
78+ std::string IR ;
8979
9080 VertexProperties () = default ;
9181 VertexProperties (const llvm::Value *v);
@@ -96,9 +86,9 @@ class PointsToGraph {
9686 */
9787 struct EdgeProperties {
9888 // / This might be an Instruction, in particular a Call Instruction.
99- const llvm::Value *value = nullptr ;
89+ const llvm::Value *V = nullptr ;
10090 // / Holds the llvm IR code for that edge.
101- std::string ir_code ;
91+ std::string IR ;
10292
10393 EdgeProperties () = default ;
10494 EdgeProperties (const llvm::Value *v);
@@ -117,23 +107,22 @@ class PointsToGraph {
117107
118108 // / The type for a vertex iterator.
119109 typedef boost::graph_traits<graph_t >::vertex_iterator vertex_iterator_t ;
120- typedef boost::graph_traits<graph_t >::vertex_iterator vertex_iterator;
121- typedef boost::graph_traits<graph_t >::out_edge_iterator out_edge_iterator;
122- typedef boost::graph_traits<graph_t >::in_edge_iterator in_edge_iterator;
110+ typedef boost::graph_traits<graph_t >::out_edge_iterator out_edge_iterator_t ;
111+ typedef boost::graph_traits<graph_t >::in_edge_iterator in_edge_iterator_t ;
123112
124113 // / Set of functions that allocate heap memory, e.g. new, new[], malloc.
125114 inline const static std::set<std::string> HeapAllocationFunctions = {
126115 " _Znwm" , " _Znam" , " malloc" , " calloc" , " realloc" };
127116
128117private:
129- struct allocation_site_dfs_visitor ;
130- struct reachability_dfs_visitor ;
118+ struct AllocationSiteDFSVisitor ;
119+ struct ReachabilityDFSVisitor ;
131120
132121 // / The points to graph.
133- graph_t ptg ;
134- std::map <const llvm::Value *, vertex_t > value_vertex_map ;
122+ graph_t PAG ;
123+ std::unordered_map <const llvm::Value *, vertex_t > ValueVertexMap ;
135124 // / Keep track of what has already been merged into this points-to graph.
136- std::set <std::string> ContainedFunctions;
125+ std::unordered_set <std::string> ContainedFunctions;
137126
138127public:
139128 /* *
@@ -147,18 +136,7 @@ class PointsToGraph {
147136 * False, if May and Must Aliases should be
148137 * considered.
149138 */
150- PointsToGraph (llvm::Function *F, llvm::AAResults &AA,
151- bool onlyConsiderMustAlias = false );
152-
153- /* *
154- * It is used when a points-to graph is restored from the database.
155- *
156- * @brief This will create an empty points-to graph, except the functions
157- * names
158- * that are contained in the points-to graph.
159- * @param fnames Names of functions contained in the points-to graph.
160- */
161- PointsToGraph (std::vector<std::string> fnames);
139+ PointsToGraph (llvm::Function *F, llvm::AAResults &AA);
162140
163141 /* *
164142 * @brief This will create an empty points-to graph. It is used when points-to
0 commit comments