LCOV - code coverage report
Current view: top level - include/llvm/Analysis - IndirectCallSiteVisitor.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 10 10 100.0 %
Date: 2017-09-14 15:23:50 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- IndirectCallSiteVisitor.h - indirect call-sites visitor -----------===//
       2             : //
       3             : //                      The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file implements defines a visitor class and a helper function that find
      11             : // all indirect call-sites in a function.
      12             : 
      13             : #include "llvm/IR/InstVisitor.h"
      14             : #include <vector>
      15             : 
      16             : namespace llvm {
      17             : // Visitor class that finds all indirect call sites.
      18        1868 : struct PGOIndirectCallSiteVisitor
      19             :     : public InstVisitor<PGOIndirectCallSiteVisitor> {
      20             :   std::vector<Instruction *> IndirectCallInsts;
      21        1868 :   PGOIndirectCallSiteVisitor() {}
      22             : 
      23         561 :   void visitCallSite(CallSite CS) {
      24         561 :     if (CS.isIndirectCall())
      25         168 :       IndirectCallInsts.push_back(CS.getInstruction());
      26         561 :   }
      27             : };
      28             : 
      29             : // Helper function that finds all indirect call sites.
      30         934 : static inline std::vector<Instruction *> findIndirectCallSites(Function &F) {
      31        1868 :   PGOIndirectCallSiteVisitor ICV;
      32         934 :   ICV.visit(F);
      33        1868 :   return ICV.IndirectCallInsts;
      34             : }
      35             : }

Generated by: LCOV version 1.13