1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/include/llvm/Analysis/IndirectCallSiteVisitor.h
Argyrios Kyrtzidis 048516922a Add header guards to some headers that are missing them
Also adjust some of dsymutil's headers to put the header guards at the top,
otherwise the compiler will not recognize them as header guards.

llvm-svn: 341323
2018-09-03 16:22:05 +00:00

41 lines
1.2 KiB
C++

//===-- IndirectCallSiteVisitor.h - indirect call-sites visitor -----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements defines a visitor class and a helper function that find
// all indirect call-sites in a function.
#ifndef LLVM_ANALYSIS_INDIRECTCALLSITEVISITOR_H
#define LLVM_ANALYSIS_INDIRECTCALLSITEVISITOR_H
#include "llvm/IR/InstVisitor.h"
#include <vector>
namespace llvm {
// Visitor class that finds all indirect call sites.
struct PGOIndirectCallSiteVisitor
: public InstVisitor<PGOIndirectCallSiteVisitor> {
std::vector<Instruction *> IndirectCallInsts;
PGOIndirectCallSiteVisitor() {}
void visitCallSite(CallSite CS) {
if (CS.isIndirectCall())
IndirectCallInsts.push_back(CS.getInstruction());
}
};
// Helper function that finds all indirect call sites.
inline std::vector<Instruction *> findIndirectCallSites(Function &F) {
PGOIndirectCallSiteVisitor ICV;
ICV.visit(F);
return ICV.IndirectCallInsts;
}
}
#endif