1 //=- llvm/Analysis/CallTargets.h - Resolve Indirect Call Targets --*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass uses DSA to map targets of all calls, and reports on if it
11 // thinks it knows all targets of a given call.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ANALYSIS_CALLTARGETS_H
16 #define LLVM_ANALYSIS_CALLTARGETS_H
18 #include "llvm/Pass.h"
19 #include "llvm/Support/CallSite.h"
26 class CallTargetFinder : public ModulePass {
27 std::map<CallSite, std::vector<Function*> > IndMap;
28 std::set<CallSite> CompleteSites;
29 std::list<CallSite> AllSites;
31 void findIndTargets(Module &M);
33 virtual bool runOnModule(Module &M);
35 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
37 virtual void print(std::ostream &O, const Module *M) const;
39 // Given a CallSite, get an iterator of callees
40 std::vector<Function*>::iterator begin(CallSite cs);
41 std::vector<Function*>::iterator end(CallSite cs);
43 // Iterate over CallSites in program
44 std::list<CallSite>::iterator cs_begin();
45 std::list<CallSite>::iterator cs_end();
47 // Do we think we have complete knowledge of this site?
48 // That is, do we think there are no missing callees
49 bool isComplete(CallSite cs) const;