SVF
ExternalPAG.h
Go to the documentation of this file.
1 //===- ExternalPAG.h -- Program assignment graph------------------------------//
2 
3 /*
4  * ExternalPAG.h
5  *
6  * Created on: Aug 20, 2018
7  * Author: Mohamad Barbar
8  */
9 
10 #ifndef EXTERNALPAG_H_
11 #define EXTERNALPAG_H_
12 
13 #include "Graphs/PAGNode.h"
14 
15 extern llvm::cl::list<std::string> DumpPAGFunctions;
16 
17 namespace SVF
18 {
19 
23 {
24 private:
30 
32  std::string functionName;
33 
43 
44  // Special nodes.
45 
51 
53  bool hasReturn;
54 
57  static std::vector<std::pair<std::string, std::string>>
58  parseExternalPAGs(llvm::cl::list<std::string> &extpagsArgs);
59 
76  void readFromFile(std::string filename);
77 
78 public:
79  ExternalPAG(std::string functionName) : functionName(functionName),
80  returnNode(-1), hasReturn(false) {}
81 
83 
86  static void initialise(SVFModule* svfModule);
87 
91  static bool connectCallsiteToExternalPAG(CallSite *cs);
92 
94  static bool hasExternalPAG(const SVFFunction* function);
95 
97  static void dumpFunctions(std::vector<std::string> functions);
98 
99  std::string getFunctionName() const
100  {
101  return functionName;
102  }
103 
105  {
106  return valueNodes;
107  }
109  {
110  return objectNodes;
111  }
113  {
114  return edges;
115  }
116 
118  {
119  return argNodes;
120  }
121 
123  {
124  return returnNode;
125  }
126  void setReturnNode(NodeID returnNode)
127  {
128  this->returnNode = returnNode;
129  hasReturn = true;
130  }
131 
133  bool hasReturnNode() const
134  {
135  return hasReturn;
136  }
137 
141  bool addExternalPAG(const SVFFunction* function);
142 
143 };
144 
145 } // End namespace SVF
146 
147 #endif /* EXTERNALPAG_H_ */
static Map< const SVFFunction *, Map< int, PAGNode * > > functionToExternalPAGEntries
Definition: ExternalPAG.h:28
std::set< Key, Compare, Allocator > OrderedSet
NodeID returnNode
Node from which return edges connect.
Definition: ExternalPAG.h:50
std::string functionName
Name of the function this external PAG represents.
Definition: ExternalPAG.h:32
Set< NodeID > NodeSet
llvm::cl::list< std::string > DumpPAGFunctions
u32_t NodeID
Definition: SVFBasicTypes.h:80
OrderedSet< std::tuple< NodeID, NodeID, std::string, int > > edges
Definition: ExternalPAG.h:42
bool hasReturnNode() const
Does this function have a return node?
Definition: ExternalPAG.h:133
NodeSet valueNodes
Definition: ExternalPAG.h:36
Map< int, NodeID > argNodes
Definition: ExternalPAG.h:48
NodeID getReturnNode() const
Definition: ExternalPAG.h:122
ExternalPAG(std::string functionName)
Definition: ExternalPAG.h:79
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition: SVFBasicTypes.h:98
NodeSet & getValueNodes()
Definition: ExternalPAG.h:104
static bool hasExternalPAG(const SVFFunction *function)
Whether an external PAG implementing function exists.
Map< int, NodeID > & getArgNodes()
Definition: ExternalPAG.h:117
void setReturnNode(NodeID returnNode)
Definition: ExternalPAG.h:126
static void initialise(SVFModule *svfModule)
Definition: ExternalPAG.cpp:54
static Map< const SVFFunction *, PAGNode * > functionToExternalPAGReturns
Definition: ExternalPAG.h:29
bool hasReturn
Whether this function has a return or not.
Definition: ExternalPAG.h:53
NodeSet & getObjectNodes()
Definition: ExternalPAG.h:108
std::string getFunctionName() const
Definition: ExternalPAG.h:99
NodeSet objectNodes
Definition: ExternalPAG.h:39
for isBitcode
Definition: ContextDDA.h:15
static void dumpFunctions(std::vector< std::string > functions)
Dump individual PAGs of specified functions. Currently to outs().
static std::vector< std::pair< std::string, std::string > > parseExternalPAGs(llvm::cl::list< std::string > &extpagsArgs)
Definition: ExternalPAG.cpp:36
void readFromFile(std::string filename)
OrderedSet< std::tuple< NodeID, NodeID, std::string, int > > & getEdges()
Definition: ExternalPAG.h:112
bool addExternalPAG(const SVFFunction *function)
static bool connectCallsiteToExternalPAG(CallSite *cs)
Definition: ExternalPAG.cpp:72