40using namespace SVFUtil;
 
   58        else assert(
false && 
"BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!");
 
   65        else assert(
false && 
"BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!");
 
   73            else assert(
false && 
"BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!");
 
   79            else assert(
false && 
"BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!");
 
   86        else assert(
false && 
"BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!");
 
   88    else assert(
false && 
"no points-to data available");
 
 
  102        if (
names.size() > 1)
 
  108            subtitle = 
"Andersen's analysis bitvector";
 
  110            subtitle = 
"flow-sensitive analysis bitvector";
 
  112            subtitle = 
"CFL analysis bitvector";
 
  114            subtitle = 
"Type analysis bitvector";
 
  121        SVFUtil::outs() << 
"################ (program : " << moduleName << 
")###############\n";
 
  123        ptCache.printStats(
"bitvector");
 
  124        SVFUtil::outs() << 
"#######################################################" << std::endl;
 
 
  166    std::fstream 
f(
filename.c_str(), std::ios_base::out);
 
  169        outs() << 
"  error opening file for writing!\n";
 
 
  207        f << 
var << 
" -> { ";
 
 
  236        f << 
it->second << 
"\n";
 
 
  249    outs() << 
"Storing pointer analysis results to '" << 
filename << 
"'...";
 
  252    std::fstream 
f(
filename.c_str(), std::ios_base::app);
 
  255        outs() << 
"  error opening file for writing!\n";
 
 
  305        if (
line.at(0) == 
'[' || 
line == 
"---VERSIONED---") 
continue;
 
  306        if (
line == 
"------")     
break;
 
  308        if (
pos == string::npos)    
break;
 
  309        if (
line.back() != 
'}')     
break;
 
 
  351        if (
line == 
"------")     
break;
 
  376                assert(
false && 
"new gep obj node kind?");
 
 
  414    outs() << 
"Loading pointer analysis results from '" << 
filename << 
"'...";
 
  419        outs() << 
"  error opening file for reading!\n";
 
 
  450        if (
getPAG()->isValidTopLevelPtr(node))
 
  453            outs() << 
"\nNodeID " << node->
getId() << 
" ";
 
  457                outs() << 
"\t\tPointsTo: {empty}\n\n";
 
  461                outs() << 
"\t\tPointsTo: { ";
 
 
  487        outs() << 
"----------------------------------------------\n";
 
  491    outs() << 
"----------------------------------------------\n";
 
 
  529        for(CallSiteSet::const_iterator 
it = 
tdCallGraph->forksitesBegin(),
 
  533            if(SVFUtil::dyn_cast<FunValVar>(
pVar) == 
nullptr)
 
  542                        if(
obj->isFunction())
 
 
  565    for (
auto t: memToFieldsMap)
 
  569        assert(
obj && 
"Invalid baseObj in memToFieldsMap");
 
  570        assert(
obj->isFieldInsensitive() == 
obj->isFieldInsensitive());
 
  571        if (
obj->isFieldInsensitive())
 
  573            for (
NodeID id : t.second)
 
  580                    assert(
id == base && 
"Not a GepObj Node or a baseObj Node?");
 
  608        GepObjVarMap.erase(std::make_pair(base, apOffset));
 
  609        memToFieldsMap[base].reset(
n);
 
 
virtual void normalizePointsTo()
virtual void writeToFile(const std::string &filename)
Interface for analysis result storage on filesystem.
virtual bool readFromFile(const std::string &filename)
virtual void writeObjVarToFile(const std::string &filename)
virtual void clearPts(NodeID id, NodeID element)
Remove element from the points-to set of id.
virtual void readAndSetObjFieldSensitivity(std::ifstream &f, const std::string &delimiterStr)
AliasResult alias(const SVFVar *V1, const SVFVar *V2) override
Interface expose to users of our pointer analysis, given Value infos.
virtual void writeGepObjVarMapToFile(std::fstream &f)
void finalize() override
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
virtual void writePtsResultToFile(std::fstream &f)
virtual void expandFIObjs(const PointsTo &pts, PointsTo &expandedPts)
Expand FI objects.
void dumpAllPts() override
void remapPointsToSets(void)
Remap all points-to sets to use the current mapping.
virtual void onTheFlyThreadCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newForkEdges)
On the fly thread call graph construction respecting forksite.
PersistentPointsToCache< PointsTo > ptCache
virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
On the fly call graph construction.
virtual bool updateCallGraph(const CallSiteToFunPtrMap &)
Update callgraph. This should be implemented by its subclass.
BVDataPTAImpl(SVFIR *pag, PointerAnalysis::PTATY type, bool alias_check=true)
Constructor.
std::unique_ptr< PTDataTy > ptD
Points-to data.
PersistentPointsToCache< PointsTo > & getPtCache()
PTData< NodeID, NodeSet, NodeID, PointsTo > PTDataTy
void dumpTopLevelPtsTo() override
const PointsTo & getPts(NodeID id) override
virtual void readPtsResultFromFile(std::ifstream &f)
PTDataTy * getPTDataTy() const
Get points-to data structure.
virtual bool addPts(NodeID id, NodeID ptd)
virtual void readGepObjVarMapFromFile(std::ifstream &f)
const SVFVar * getVtablePtr() const
bool isVirtualCall() const
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
iterator begin()
Iterators.
void removeGNode(NodeType *node)
Delete a node.
IDToNodeMapTy::iterator iterator
Node Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
static NodeIDAllocator * get(void)
Return (singleton) allocator.
void increaseNumOfObjAndNodes()
static const Option< bool > INCDFPTData
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
static const OptionMap< BVDataPTAImpl::PTBackingType > ptDataBacking
PTData type.
PTATY
Pointer analysis type list.
@ Cxt_DDA
context sensitive DDA
@ CFLFICI_WPA
Flow-, context-, insensitive CFL-reachability-based analysis.
@ VFS_WPA
Versioned sparse flow-sensitive WPA.
@ FSCS_WPA
Flow-, context- sensitive WPA.
@ FSDATAFLOW_WPA
Traditional Dataflow-based flow sensitive WPA.
@ AndersenSCD_WPA
Selective cycle detection andersen-style WPA.
@ Andersen_BASE
Base Andersen PTA.
@ FlowS_DDA
Flow sensitive DDA.
@ Andersen_WPA
Andersen PTA.
@ CFLFSCS_WPA
Flow-, context-, CFL-reachability-based analysis.
@ FieldS_DDA
Field sensitive DDA.
@ AndersenWaveDiff_WPA
Diff wave propagation andersen-style WPA.
@ TypeCPP_WPA
Type-based analysis for C++.
@ AndersenSFR_WPA
Stride-based field representation.
@ Steensgaard_WPA
Steensgaard PTA.
@ FSSPARSE_WPA
Sparse flow sensitive WPA.
bool isFieldInsensitive(NodeID id) const
virtual void finalize()
Finalization of a pointer analysis, including checking alias correctness.
virtual void dumpPts(NodeID ptr, const PointsTo &pts)
bool print_stat
User input flags.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
bool containBlackHoleNode(const PointsTo &pts)
Determine whether a points-to contains a black hole or constant node.
PTAImplTy ptaImplTy
PTA implementation type.
OrderedNodeSet & getAllValidPtrs()
Get all Valid Pointers for resolution.
virtual void resolveIndCalls(const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
Resolve indirect call edges.
CallGraph * callgraph
Call graph used for pointer analysis.
virtual void resolveCPPIndCalls(const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
Resolve cpp indirect call edges.
@ BVDataImpl
Represents BVDataPTAImpl.
void setObjFieldInsensitive(NodeID id)
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
PTATY ptaTy
Pointer analysis Type.
NodeBS toNodeBS() const
Returns this points-to set as a NodeBS.
NodeID addGepObjNode(const BaseObjVar *baseObj, const APOffset &apOffset, const NodeID gepId)
Add a field obj node, this method can only invoked by getGepObjVar.
std::pair< NodeID, APOffset > NodeOffset
const BaseObjVar * getBaseObject(NodeID id) const
NodeID getBaseObjVar(NodeID id) const
Base and Offset methods for Value and Object node.
NodeBS & getAllFieldsObjVars(const BaseObjVar *obj)
Get all fields of an object.
NodeOffsetMap & getGepObjNodeMap()
Return GepObjVarMap.
const CallSiteToFunPtrMap & getIndirectCallsites() const
Add/get indirect callsites.
Map< NodeID, NodeBS > MemObjToFieldsMap
const std::string & getModuleIdentifier() const
Map< NodeOffset, NodeID > NodeOffsetMap
MemObjToFieldsMap & getMemToFieldsMap()
Return memToFieldsMap.
NodeID getId() const
Get ID.
std::ostream & outs()
Overwrite llvm::outs()
std::vector< std::string > split(const std::string &s, char separator)
Split into two substrings around the first occurrence of a separator string.
OrderedSet< NodeID > OrderedNodeSet
llvm::IRBuilder IRBuilder