81 outs() <<
" {Type: " << *at <<
"}\n"
88 outs() <<
" {Type: " << *st <<
"}\n";
93 outs() <<
" \tField_idx = " << ++field_idx
94 <<
", field type: " << *
type <<
"\n";
100 outs() << *pt <<
"\n";
105 outs() <<
" {Type: " << *fu <<
"}\n\n";
109 outs() <<
" {Type: "<< *ot <<
"(SVFOtherType)}\n\n";
113 assert(
type->isSingleValueType() &&
"not a single value type, then what else!!");
116 outs() <<
" {Type: " << *
type <<
"}\n"
117 <<
"\t [object size = " << eSize <<
"]\n"
132 assert (flatten_idx < so.size() && !so.empty() &&
"element index out of bounds or struct opaque type, can't get element type!");
133 return so[flatten_idx];
138 assert (flatten_idx < so.size() && !so.empty() &&
"element index out of bounds or struct opaque type, can't get element type!");
139 return so[flatten_idx];
153 assert ((
unsigned)origId < so.size() && !so.empty() &&
"element index out of bounds, can't get flattened index!");
161 assert ((
unsigned)origId < so.size() && !so.empty() &&
"Struct index out of bounds, can't get flattened index!");
178 SVFUtil::errs() <<
"getFlattenedElemIdx: type is neither struct nor array: "
180 assert(
false &&
"getFlattenedElemIdx: type is neither struct nor array (see printed type above)");
214 writeWrnMsg(
"try to create a gep node with negative offset.");
262 SVFTypeSet::const_iterator it =
svfTypes.find(T);
263 assert(it !=
svfTypes.end() &&
"type info not found? collect them first during PAG Building");
264 return (*it)->getTypeInfo();
274 outs() <<
"add edge from " << src->
getId() <<
" kind :"
287 SVFStmt edge(src,dst,kind,
false);
351 for (
const auto&
item: *
this)
364 for (
const auto&
item: *
this)
409 std::stringstream rawstr(str);
425 return "shape=hexagon";
427 return "shape=diamond";
434 return "shape=doubleoctagon";
436 return "shape=box3d";
440 return "shape=component";
444 return "shape=Mrecord";
448 return "shape=octagon";
452 assert(0 &&
"no such kind!!");
457 template<
class EdgeIter>
461 std::stringstream rawstr(str);
463 rawstr <<
"shape=record";
465 const SVFStmt* edge = *(EI.getCurrent());
466 assert(edge &&
"No edge found!!");
469 rawstr <<
",color=green";
473 rawstr <<
",color=black";
477 rawstr <<
",color=\"purple:purple\"";
481 rawstr <<
",color=blue";
485 rawstr <<
",color=red";
489 rawstr <<
",color=grey";
493 rawstr <<
",color=grey";
497 rawstr <<
",color=grey";
501 rawstr <<
",color=grey";
505 rawstr <<
",color=grey";
509 rawstr <<
",color=grey";
513 rawstr <<
",color=Turquoise";
517 rawstr <<
",color=Turquoise";
521 rawstr <<
",color=black,style=dashed";
525 rawstr <<
",color=black,style=dotted";
529 assert(
false &&
"No such kind edge!!");
535 template<
class EdgeIter>
538 const SVFStmt* edge = *(EI.getCurrent());
539 assert(edge &&
"No edge found!!");
542 return calledge->getFunEntryICFGNode()->getSourceLoc();
546 return retedge->getCallSite()->getSourceLoc();
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.
GEdgeSetTy::iterator iterator
static void WriteGraphToFile(SVF::OutStream &O, const std::string &GraphName, const GraphType >, bool simple=false)
void setFlag(MEMTYPE mask)
Flag for this object type.
static Option< bool > ModelArrays
static const Option< bool > CyclicFldIdx
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
static const Option< bool > ShowHiddenNode
const SVFType * getOriginalElemType(const SVFType *baseType, u32_t origId) const
SVFStmt * hasLabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind, const ICFGNode *cs)
NodeID getVarargNode(const FunObjVar *func) const
getVarargNode - Return the unique node representing the variadic argument of a variadic function.
IDToTypeInfoMapTy objTypeInfoMap
map a memory sym id to its obj
SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap
PAG edge map containing all PAGEdges.
void printFlattenFields(const SVFType *type)
Debug method.
FunObjVarToIDMapTy returnFunObjSymMap
return map
const ObjTypeInfo * createDummyObjTypeInfo(NodeID symId, const SVFType *type)
void dump(std::string name)
Dump PAG.
ObjTypeInfo * createObjTypeInfo(const SVFType *type)
Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy ...
NodeID getReturnNode(const FunObjVar *func) const
GetReturnNode - Return the unique node representing the return value of a function.
u32_t getFlattenedElemIdx(const SVFType *T, u32_t origId)
Flattened element idx of an array or struct by considering stride.
const std::vector< const SVFType * > & getFlattenFieldTypes(const SVFStructType *T)
Return the flattened field type for struct type only.
SVFStmt * hasEdge(SVFStmt *edge, SVFStmt::PEDGEK kind)
const SVFType * getFlatternedElemType(const SVFType *baseType, u32_t flatten_idx)
Return the type of a flattened element given a flattened index.
const StInfo * getTypeInfo(const SVFType *T) const
Get struct info.
std::string getGraphName() const
Return graph name.
virtual APOffset getModulusOffset(const BaseObjVar *baseObj, const APOffset &apOffset)
Given an offset from a Gep Instruction, return it modulus offset by considering memory layout.
u32_t getNumOfFlattenElements(const SVFType *T)
bool addEdge(SVFVar *src, SVFVar *dst, SVFStmt *edge)
Add an edge into the graph.
FunObjVarToIDMapTy varargFunObjSymMap
vararg map
Set< const StInfo * > stInfos
(owned) All StInfo
void view()
View graph from the debugger.
SVFStmt * hasNonlabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind)
static GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar *var)
static GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k, const ICFGNode *cs)
std::string toString() const
NodeID getId() const
Get ID.
GNodeK getNodeKind() const
Get node kind.
virtual const std::string & getName() const
void addOutEdge(SVFStmt *outEdge)
void addInEdge(SVFStmt *inEdge)
Edge management methods.
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
virtual bool isIsolatedNode() const
Check if this node is isolated (no edges) in the PAG graph.
virtual const std::string toString() const
Get string representation.
const SVFType * getOriginalElemType(u32_t fldIdx) const
std::vector< const SVFType * > & getFlattenElementTypes()
std::vector< u32_t > & getFlattenedElemIdxVec()
u32_t getNumOfFlattenElements() const
Return number of elements after flattening (including array elements).
std::vector< const SVFType * > & getFlattenFieldTypes()
std::vector< u32_t > & getFlattenedFieldIdxVec()
u32_t getNumOfFlattenFields() const
Return the number of fields after flattening (ignoring array elements).
LLVM_NODISCARD bool isa(const Y &Val)
std::ostream & errs()
Overwrite llvm::errs().
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
std::ostream & outs()
Overwrite llvm::outs().
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
void ViewGraph(const GraphType &G, const std::string &name, bool ShortNames=false, GraphProgram::Name Program=GraphProgram::DOT)
static std::string getEdgeAttributes(SVFVar *, EdgeIter EI, PAGBase *)
DOTGraphTraits(bool isSimple=false)
static bool isNodeHidden(SVFVar *node, PAGBase *)
NodeType::iterator ChildIteratorType
static std::string getNodeLabel(SVFVar *node, PAGBase *)
static std::string getNodeAttributes(SVFVar *node, PAGBase *)
static std::string getGraphName(PAGBase *graph)
Return name of the graph.
static std::string getEdgeSourceLabel(SVFVar *, EdgeIter EI)
DefaultDOTGraphTraits(bool simple=false)