LLVM  6.0.0svn
IndirectCallSiteVisitor.h
Go to the documentation of this file.
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.
19  : public InstVisitor<PGOIndirectCallSiteVisitor> {
20  std::vector<Instruction *> IndirectCallInsts;
22 
24  if (CS.isIndirectCall())
25  IndirectCallInsts.push_back(CS.getInstruction());
26  }
27 };
28 
29 // Helper function that finds all indirect call sites.
30 inline std::vector<Instruction *> findIndirectCallSites(Function &F) {
32  ICV.visit(F);
33  return ICV.IndirectCallInsts;
34 }
35 }
Base class for instruction visitors.
Definition: InstVisitor.h:81
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
F(f)
bool isIndirectCall() const
Return true if the callsite is an indirect call.
Definition: CallSite.h:112
InstrTy * getInstruction() const
Definition: CallSite.h:92
std::vector< Instruction * > IndirectCallInsts
void visit(Iterator Start, Iterator End)
Definition: InstVisitor.h:90
std::vector< Instruction * > findIndirectCallSites(Function &F)