static std::string getEdgeAttributes(PAGNode *node, EdgeIter EI, PAG *pag) { const PAGEdge* edge = *(EI.getCurrent()); assert(edge && "No edge found!!"); if (isa<AddrPE>(edge)) { return "color=green"; } else if (isa<CopyPE>(edge)) { return "color=black"; } else if (isa<GepPE>(edge)) { return "color=purple"; } else if (isa<StorePE>(edge)) { return "color=blue"; } else if (isa<LoadPE>(edge)) { return "color=red"; } else if (isa<TDForkPE>(edge)) { return "color=Turquoise"; } else if (isa<TDJoinPE>(edge)) { return "color=Turquoise"; } else if (isa<CallPE>(edge)) { return "color=black,style=dashed"; } else if (isa<RetPE>(edge)) { return "color=black,style=dotted"; } else { assert(0 && "No such kind edge!!"); } }
static std::string getEdgeSourceLabel(PAGNode *node, EdgeIter EI) { const PAGEdge* edge = *(EI.getCurrent()); assert(edge && "No edge found!!"); if(const CallPE* calledge = dyn_cast<CallPE>(edge)) { const llvm::Instruction* callInst= calledge->getCallInst(); return analysisUtil::getSourceLoc(callInst); } else if(const RetPE* retedge = dyn_cast<RetPE>(edge)) { const llvm::Instruction* callInst= retedge->getCallInst(); return analysisUtil::getSourceLoc(callInst); } return ""; }
static std::string getEdgeAttributes(PTACallGraphNode *node, EdgeIter EI, PTACallGraph *PTACallGraph) { //TODO: mark indirect call of Fork with different color PTACallGraphEdge* edge = *(EI.getCurrent()); assert(edge && "No edge found!!"); std::string color; if (edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge) { color = "color=green"; } else if (edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge) { color = "color=blue"; } else { color = "color=black"; } if (0 != edge->getIndirectCalls().size()) { color = "color=red"; } return color; }