当前位置: 首页>>代码示例>>C++>>正文


C++ DSGraph::buildCompleteCallGraph方法代码示例

本文整理汇总了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;
}
开发者ID:Checkmate50,项目名称:smack,代码行数:80,代码来源:BottomUpClosure.cpp


注:本文中的DSGraph::buildCompleteCallGraph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。