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


C++ CallGraphSCC::size方法代码示例

本文整理汇总了C++中CallGraphSCC::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CallGraphSCC::size方法的具体用法?C++ CallGraphSCC::size怎么用?C++ CallGraphSCC::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CallGraphSCC的用法示例。


在下文中一共展示了CallGraphSCC::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RefreshCallGraph

/// Scan the functions in the specified CFG and resync the
/// callgraph with the call sites found in it.  This is used after
/// FunctionPasses have potentially munged the callgraph, and can be used after
/// CallGraphSCC passes to verify that they correctly updated the callgraph.
///
/// This function returns true if it devirtualized an existing function call,
/// meaning it turned an indirect call into a direct call.  This happens when
/// a function pass like GVN optimizes away stuff feeding the indirect call.
/// This never happens in checking mode.
bool CGPassManager::RefreshCallGraph(const CallGraphSCC &CurSCC, CallGraph &CG,
                                     bool CheckingMode) {
  DenseMap<Value*, CallGraphNode*> CallSites;

  LLVM_DEBUG(dbgs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size()
                    << " nodes:\n";
             for (CallGraphNode *CGN
                  : CurSCC) CGN->dump(););
开发者ID:Lucretia,项目名称:llvm,代码行数:17,代码来源:CallGraphSCCPass.cpp

示例2: RefreshCallGraph

/// RefreshCallGraph - Scan the functions in the specified CFG and resync the
/// callgraph with the call sites found in it.  This is used after
/// FunctionPasses have potentially munged the callgraph, and can be used after
/// CallGraphSCC passes to verify that they correctly updated the callgraph.
///
/// This function returns true if it devirtualized an existing function call,
/// meaning it turned an indirect call into a direct call.  This happens when
/// a function pass like GVN optimizes away stuff feeding the indirect call.
/// This never happens in checking mode.
///
bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC,
                                     CallGraph &CG, bool CheckingMode) {
  DenseMap<Value*, CallGraphNode*> CallSites;
  
  DEBUG(dbgs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size()
               << " nodes:\n";
        for (CallGraphSCC::iterator I = CurSCC.begin(), E = CurSCC.end();
             I != E; ++I)
          (*I)->dump();
        );
开发者ID:CPFL,项目名称:guc,代码行数:20,代码来源:CallGraphSCCPass.cpp

示例3: runOnSCC

bool BottomUpPass::runOnSCC(CallGraphSCC &SCC)
{
   // NumCalls =0;
  //  CallGraph CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
    //DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
    //const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
    //const TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();

    SmallPtrSet<Function*, 8> SCCFunctions;
    DEBUG(dbgs() << "\nInliner visiting SCC:");
    for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
      Function *F = (*I)->getFunction();
      if (F) {SCCFunctions.insert(F); NumFuncitons++; }
      DEBUG(dbgs() << " " << (F ? F->getName() : "INDIRECTNODE"));
    }
  //  NumCalls = SCCFunctions.size();


    DEBUG(dbgs() << "\nSizeof the SCC: "<<SCC.size());
    //Collect all the call sites.
    SmallVector<std::pair<CallSite, int>, 16> CallSites;


    for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
      Function *F = (*I)->getFunction();
      if (!F)
      {
          //Check waht kind of call it is:
        //  errs()<<"\nCallGRaph node dump -- ";
    //      (*I)->dump();
          continue;
      }

      for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
        for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
          CallSite CS(cast<Value>(I));
          // If this isn't a call, or it is a call to an intrinsic, it can
          // never be inlined.
          if (!CS || isa<IntrinsicInst>(I))
            continue;

          // If this is a direct call to an external function, we can never inline
          // it.  If it is an indirect call, inlining may resolve it to be a
          // direct call, so we keep it.
          if (CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration())
            continue;

          CallSites.push_back(std::make_pair(CS, -1));
        }
    }

    DEBUG(dbgs() << ": " << CallSites.size() << " call sites.\n");
    NumCalls +=CallSites.size();
}
开发者ID:jamella,项目名称:TaintFlowAnalysis,代码行数:54,代码来源:CallGraphWrapper.cpp


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