34 using namespace SVFUtil;
45 for (ConstraintEdge::ConstraintEdgeSetTy::iterator it = LoadCGEdgeSet.begin(), eit =
46 LoadCGEdgeSet.end(); it != eit; ++it)
52 addRefLoadEdge(src, dst);
55 for (ConstraintEdge::ConstraintEdgeSetTy::iterator it = StoreCGEdgeSet.begin(), eit =
56 StoreCGEdgeSet.end(); it != eit; ++it)
62 addRefStoreEdge(src, dst);
69 for (LoadEdges::iterator it = loads.begin(), eit = loads.end(); it != eit; ++it)
73 for (StoreEdges::iterator it = stores.begin(), eit = stores.end(); it != eit; ++it)
89 NodeID ref = nodeToRefMap[src];
90 return addCopyCGEdge(ref, dst);
100 NodeID ref = nodeToRefMap[dst];
101 return addCopyCGEdge(src, ref);
112 NodeID refId = pag->addDummyValNode();
114 addConstraintNode(node, refId);
115 refNodes.insert(refId);
116 nodeToRefMap[nodeId] = refId;
127 buildOfflineMap(oscc);
135 for (NodeToRepMap::const_iterator it = nodeToRefMap.begin(); it != nodeToRefMap.end(); ++it)
138 NodeID ref = getRef(node);
140 if (!isaRef(rep) && !isaRef(node))
141 setNorRep(node, rep);
154 for (NodeBS::iterator subIt = subNodes.begin(), subEit = subNodes.end(); subIt != subEit; ++subIt)
187 DOTGraphTraits<
PAG*>(isSimple)
194 return "Offline Constraint Graph";
206 bool briefDisplay =
true;
207 bool nameDisplay =
true;
212 if (SVFUtil::isa<ValPN>(node))
217 rawstr << node->
getId();
220 rawstr << node->
getId();
225 if (!SVFUtil::isa<DummyValPN>(node) && !SVFUtil::isa<DummyObjPN>(node))
250 return "shape=folder";
254 template<
class EdgeIter>
258 assert(edge &&
"No edge found!!");
261 return "color=green";
265 return "color=black";
270 return "color=purple";
282 assert(0 &&
"No such kind edge!!");
287 template<
class EdgeIter>
GEdgeKind getEdgeKind() const
const NodeBS & subNodes(NodeID n) const
get all subnodes in one scc, if size is empty insert itself into the set
bool addRefLoadEdge(NodeID src, NodeID dst)
NodeID getSrcID() const
get methods of the components
static const llvm::cl::opt< bool > OCGDotGraph
void solveOfflineSCC(OSCC *oscc)
DOTGraphTraits(bool isSimple=false)
static std::string getEdgeAttributes(NodeType *, EdgeIter EI, OfflineConsG *)
const Value * getValue() const
Get/has methods of the components.
virtual const std::string getValueName() const =0
Get name of the LLVM value.
static std::string getNodeLabel(NodeType *n, OfflineConsG *)
static PAG * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis. ...
Set< StoreCGEdge * > StoreEdges
NodeID repNode(NodeID n) const
get the rep node if not found return itself
PAGNode * getPAGNode(NodeID id) const
Get PAGNode ID.
llvm::raw_string_ostream raw_string_ostream
bool addRefStoreEdge(NodeID src, NodeID dst)
bool createRefNode(NodeID nodeId)
raw_ostream & outs()
Overwrite llvm::outs()
Set< LoadCGEdge * > LoadEdges
void buildOfflineMap(OSCC *oscc)
static std::string getNodeAttributes(NodeType *n, OfflineConsG *)
NodeID solveRep(OSCC *oscc, NodeID rep)
void dump(std::string name)
static std::string getEdgeSourceLabel(NodeType *, EdgeIter)
NodeID getId() const
Get ID.
llvm::SparseBitVector NodeBS
static std::string getGraphName(OfflineConsG *)
Return name of the graph.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
virtual const std::string getNodeAttrForDotDisplay() const
Get shape and/or color of node for .dot display.
static void WriteGraphToFile(llvm::raw_ostream &O, const std::string &GraphName, const GraphType >, bool simple=false)