38 using namespace SVFUtil;
49 icfg->
dump(
"icfg_initial");
50 icfg->dump(
"vfg_initial");
71 callGraphSolveBasedOnCHA(getIndirectCallsites(), newEdges);
77 for(CallSiteToFunPtrMap::const_iterator iter = callsites.begin(), eiter = callsites.end(); iter!=eiter; ++iter)
84 assert(vtbl !=
nullptr);
86 getVFnsFromCHA(cbn, vfns);
87 connectVCallToVFns(cbn, vfns, newEdges);
96 const CHGraph *chgraph = SVFUtil::dyn_cast<CHGraph>(getCHGraph());
97 if (chgraph ==
nullptr)
99 SVFUtil::errs() <<
"dumpCHAStats only implemented for standard CHGraph.\n";
103 u32_t pure_abstract_class_num = 0,
104 multi_inheritance_class_num = 0;
108 CHNode *node = it->second;
111 pure_abstract_class_num++;
113 multi_inheritance_class_num++;
116 outs() <<
"pure_abstract_class_num:\t" << pure_abstract_class_num <<
'\n';
117 outs() <<
"multi_inheritance_class_num:\t" << multi_inheritance_class_num <<
'\n';
130 set<const SVFFunction*> allVirtualFunctions;
134 CHNode *node = it->second;
138 u32_t vfuncs_size = 0;
140 for (vector<CHNode::FuncVector>::const_iterator vit = vecs.begin(),
141 veit = vecs.end(); vit != veit; ++vit)
143 vfuncs_size += (*vit).size();
144 for (vector<const SVFFunction*>::const_iterator fit = (*vit).begin(),
145 feit = (*vit).end(); fit != feit; ++fit)
148 allVirtualFunctions.insert(func);
154 if (vfuncs_size > vtbl_max)
156 vtbl_max = vfuncs_size;
160 vfunc_total = allVirtualFunctions.size();
162 outs() <<
"vtblnum:\t" << vtblnum <<
'\n';
163 outs() <<
"vtbl_average:\t" << (double)(vfunc_total)/vtblnum <<
'\n';
164 outs() <<
"vtbl_max:\t" << vtbl_max <<
'\n';
165 outs() <<
"pure_abstract:\t" << pure_abstract <<
'\n';
virtual void finalize() override
Finalize analysis.
virtual void initialize() override
Initialize analysis.
bool isMultiInheritance() const
bool isPureAbstract() const
const std::vector< FuncVector > & getVirtualFunctionVectors() const
std::string getName() const
const SVFVar * getVtablePtr() const
bool isVirtualCall() const
iterator begin()
Iterators.
IDToNodeMapTy::const_iterator const_iterator
u32_t getTotalNodeNum() const
Get total number of node/edge.
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
static const Option< bool > DumpICFG
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
Set< const SVFFunction * > VFunSet
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
void dumpCHAStats()
Statistics of CHA and callgraph.
virtual void finalize() override
Finalize analysis.
void initialize() override
Initialize analysis.
void analyze() override
Type analysis.
void callGraphSolveBasedOnCHA(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
Resolve callgraph based on CHA.
std::ostream & errs()
Overwrite llvm::errs()
std::ostream & outs()
Overwrite llvm::outs()