LCOV - code coverage report
Current view: top level - include/llvm/Analysis - IndirectCallSiteVisitor.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 6 6 100.0 %
Date: 2018-10-20 13:21:21 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             : #ifndef LLVM_ANALYSIS_INDIRECTCALLSITEVISITOR_H
      14             : #define LLVM_ANALYSIS_INDIRECTCALLSITEVISITOR_H
      15             : 
      16             : #include "llvm/IR/InstVisitor.h"
      17             : #include <vector>
      18             : 
      19             : namespace llvm {
      20             : // Visitor class that finds all indirect call sites.
      21             : struct PGOIndirectCallSiteVisitor
      22             :     : public InstVisitor<PGOIndirectCallSiteVisitor> {
      23             :   std::vector<Instruction *> IndirectCallInsts;
      24             :   PGOIndirectCallSiteVisitor() {}
      25             : 
      26         655 :   void visitCallSite(CallSite CS) {
      27         655 :     if (CS.isIndirectCall())
      28         142 :       IndirectCallInsts.push_back(CS.getInstruction());
      29         655 :   }
      30             : };
      31             : 
      32             : // Helper function that finds all indirect call sites.
      33        1115 : inline std::vector<Instruction *> findIndirectCallSites(Function &F) {
      34             :   PGOIndirectCallSiteVisitor ICV;
      35             :   ICV.visit(F);
      36        1115 :   return ICV.IndirectCallInsts;
      37             : }
      38             : }
      39             : 
      40             : #endif

Generated by: LCOV version 1.13