本文整理汇总了C++中DSGraph::buildCompleteCallGraph方法的典型用法代码示例。如果您正苦于以下问题:C++ DSGraph::buildCompleteCallGraph方法的具体用法?C++ DSGraph::buildCompleteCallGraph怎么用?C++ DSGraph::buildCompleteCallGraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DSGraph
的用法示例。
在下文中一共展示了DSGraph::buildCompleteCallGraph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runOnModuleInternal
// BU:
// Construct the callgraph from the local graphs
// Find SCCs
// inline bottom up
//
bool BUDataStructures::runOnModuleInternal(Module& M) {
//
// Make sure we have a DSGraph for all declared functions in the Module.
// While we may not need them in this DSA pass, a later DSA pass may ask us
// for their DSGraphs, and we want to have them if asked.
//
for (Function &F : M) {
if (!(F.isDeclaration())){
getOrCreateGraph(&F);
}
}
//
// Do a post-order traversal of the SCC callgraph and do bottom-up inlining.
//
postOrderInline (M);
// At the end of the bottom-up pass, the globals graph becomes complete.
// FIXME: This is not the right way to do this, but it is sorta better than
// nothing! In particular, externally visible globals and unresolvable call
// nodes at the end of the BU phase should make things that they point to
// incomplete in the globals graph.
//
GlobalsGraph->removeTriviallyDeadNodes();
GlobalsGraph->maskIncompleteMarkers();
// Mark external globals incomplete.
GlobalsGraph->markIncompleteNodes(DSGraph::IgnoreGlobals);
GlobalsGraph->computeExternalFlags(DSGraph::DontMarkFormalsExternal);
GlobalsGraph->computeIntPtrFlags();
//
// Create equivalence classes for aliasing globals so that we only need to
// record one global per DSNode.
//
formGlobalECs();
// Merge the globals variables (not the calls) from the globals graph back
// into the individual function's graph so that changes made to globals during
// BU can be reflected. This is specifically needed for correct call graph
//
for (Function &F : M) {
if (!(F.isDeclaration())){
DSGraph *Graph = getOrCreateGraph(&F);
cloneGlobalsInto(Graph, DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
Graph->buildCallGraph(callgraph, GlobalFunctionList, filterCallees);
Graph->maskIncompleteMarkers();
Graph->markIncompleteNodes(DSGraph::MarkFormalArgs |
DSGraph::IgnoreGlobals);
Graph->computeExternalFlags(DSGraph::DontMarkFormalsExternal);
Graph->computeIntPtrFlags();
}
}
// Once the correct flags have been calculated. Update the callgraph.
for (Function &F : M) {
if (!(F.isDeclaration())){
DSGraph *Graph = getOrCreateGraph(&F);
Graph->buildCompleteCallGraph(callgraph,
GlobalFunctionList, filterCallees);
}
}
NumCallEdges += callgraph.size();
// Put the call graph in canonical form
callgraph.buildSCCs();
callgraph.buildRoots();
DEBUG(print(errs(), &M));
return false;
}