summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-20 16:34:13 +0000
committerChris Lattner <sabre@nondot.org>2003-09-20 16:34:13 +0000
commit808a7aeec77e79ad236614a578b1bb758ce796ab (patch)
tree97f4e36e707c16b9b64ffc36c2acd3f1e6796f51 /include
parent192cd9cccd3eb2c030c3a25d636d90b69841868e (diff)
downloadllvm-808a7aeec77e79ad236614a578b1bb758ce796ab.tar.gz
llvm-808a7aeec77e79ad236614a578b1bb758ce796ab.tar.bz2
llvm-808a7aeec77e79ad236614a578b1bb758ce796ab.tar.xz
Switch from using CallInst's to represent call sites to using the LLVM
CallSite class. Now we can represent function calls by invoke instructions too! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DSSupport.h24
-rw-r--r--include/llvm/Analysis/DataStructure.h7
-rw-r--r--include/llvm/Analysis/DataStructure/DSSupport.h24
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h7
-rw-r--r--include/llvm/Analysis/IPModRef.h20
5 files changed, 42 insertions, 40 deletions
diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h
index aff7abcb6e..f80423b0d9 100644
--- a/include/llvm/Analysis/DSSupport.h
+++ b/include/llvm/Analysis/DSSupport.h
@@ -7,11 +7,9 @@
#ifndef LLVM_ANALYSIS_DSSUPPORT_H
#define LLVM_ANALYSIS_DSSUPPORT_H
-#include <vector>
#include <functional>
-#include <string>
-#include <cassert>
#include "Support/hash_set"
+#include "llvm/Support/CallSite.h"
class Function;
class CallInst;
@@ -127,7 +125,7 @@ namespace std {
/// the DSNode handles for the function arguments.
///
class DSCallSite {
- CallInst *Inst; // Actual call site
+ CallSite Site; // Actual call site
Function *CalleeF; // The function called (direct call)
DSNodeHandle CalleeN; // The function node called (indirect call)
DSNodeHandle RetVal; // Returned value
@@ -160,21 +158,21 @@ public:
/// Constructor. Note - This ctor destroys the argument vector passed in. On
/// exit, the argument vector is empty.
///
- DSCallSite(CallInst &inst, const DSNodeHandle &rv, DSNode *Callee,
+ DSCallSite(CallSite CS, const DSNodeHandle &rv, DSNode *Callee,
std::vector<DSNodeHandle> &Args)
- : Inst(&inst), CalleeF(0), CalleeN(Callee), RetVal(rv) {
+ : Site(CS), CalleeF(0), CalleeN(Callee), RetVal(rv) {
assert(Callee && "Null callee node specified for call site!");
Args.swap(CallArgs);
}
- DSCallSite(CallInst &inst, const DSNodeHandle &rv, Function *Callee,
+ DSCallSite(CallSite CS, const DSNodeHandle &rv, Function *Callee,
std::vector<DSNodeHandle> &Args)
- : Inst(&inst), CalleeF(Callee), RetVal(rv) {
+ : Site(CS), CalleeF(Callee), RetVal(rv) {
assert(Callee && "Null callee function specified for call site!");
Args.swap(CallArgs);
}
DSCallSite(const DSCallSite &DSCS) // Simple copy ctor
- : Inst(DSCS.Inst), CalleeF(DSCS.CalleeF), CalleeN(DSCS.CalleeN),
+ : Site(DSCS.Site), CalleeF(DSCS.CalleeF), CalleeN(DSCS.CalleeN),
RetVal(DSCS.RetVal), CallArgs(DSCS.CallArgs) {}
/// Mapping copy constructor - This constructor takes a preexisting call site
@@ -183,7 +181,7 @@ public:
///
template<typename MapTy>
DSCallSite(const DSCallSite &FromCall, const MapTy &NodeMap) {
- Inst = FromCall.Inst;
+ Site = FromCall.Site;
InitNH(RetVal, FromCall.RetVal, NodeMap);
InitNH(CalleeN, FromCall.CalleeN, NodeMap);
CalleeF = FromCall.CalleeF;
@@ -194,7 +192,7 @@ public:
}
const DSCallSite &operator=(const DSCallSite &RHS) {
- Inst = RHS.Inst;
+ Site = RHS.Site;
CalleeF = RHS.CalleeF;
CalleeN = RHS.CalleeN;
RetVal = RHS.RetVal;
@@ -212,7 +210,7 @@ public:
// Accessor functions...
Function &getCaller() const;
- CallInst &getCallInst() const { return *Inst; }
+ CallSite getCallSite() const { return Site; }
DSNodeHandle &getRetVal() { return RetVal; }
const DSNodeHandle &getRetVal() const { return RetVal; }
@@ -236,7 +234,7 @@ public:
void swap(DSCallSite &CS) {
if (this != &CS) {
- std::swap(Inst, CS.Inst);
+ std::swap(Site, CS.Site);
std::swap(RetVal, CS.RetVal);
std::swap(CalleeN, CS.CalleeN);
std::swap(CalleeF, CS.CalleeF);
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h
index d8f30d25d0..f52bb4b60f 100644
--- a/include/llvm/Analysis/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure.h
@@ -11,10 +11,9 @@
#include "Support/hash_set"
class Type;
-class CallInst;
+class Instruction;
class DSGraph;
class DSNode;
-class DSCallSite;
// FIXME: move this stuff to a private header
namespace DataStructureAnalysis {
@@ -75,7 +74,7 @@ class BUDataStructures : public Pass {
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph;
- hash_multimap<CallInst*, Function*> ActualCallees;
+ hash_multimap<Instruction*, Function*> ActualCallees;
public:
~BUDataStructures() { releaseMemory(); }
@@ -106,7 +105,7 @@ public:
AU.addRequired<LocalDataStructures>();
}
- typedef hash_multimap<CallInst*, Function*> ActualCalleesTy;
+ typedef hash_multimap<Instruction*, Function*> ActualCalleesTy;
const ActualCalleesTy &getActualCallees() const {
return ActualCallees;
}
diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h
index aff7abcb6e..f80423b0d9 100644
--- a/include/llvm/Analysis/DataStructure/DSSupport.h
+++ b/include/llvm/Analysis/DataStructure/DSSupport.h
@@ -7,11 +7,9 @@
#ifndef LLVM_ANALYSIS_DSSUPPORT_H
#define LLVM_ANALYSIS_DSSUPPORT_H
-#include <vector>
#include <functional>
-#include <string>
-#include <cassert>
#include "Support/hash_set"
+#include "llvm/Support/CallSite.h"
class Function;
class CallInst;
@@ -127,7 +125,7 @@ namespace std {
/// the DSNode handles for the function arguments.
///
class DSCallSite {
- CallInst *Inst; // Actual call site
+ CallSite Site; // Actual call site
Function *CalleeF; // The function called (direct call)
DSNodeHandle CalleeN; // The function node called (indirect call)
DSNodeHandle RetVal; // Returned value
@@ -160,21 +158,21 @@ public:
/// Constructor. Note - This ctor destroys the argument vector passed in. On
/// exit, the argument vector is empty.
///
- DSCallSite(CallInst &inst, const DSNodeHandle &rv, DSNode *Callee,
+ DSCallSite(CallSite CS, const DSNodeHandle &rv, DSNode *Callee,
std::vector<DSNodeHandle> &Args)
- : Inst(&inst), CalleeF(0), CalleeN(Callee), RetVal(rv) {
+ : Site(CS), CalleeF(0), CalleeN(Callee), RetVal(rv) {
assert(Callee && "Null callee node specified for call site!");
Args.swap(CallArgs);
}
- DSCallSite(CallInst &inst, const DSNodeHandle &rv, Function *Callee,
+ DSCallSite(CallSite CS, const DSNodeHandle &rv, Function *Callee,
std::vector<DSNodeHandle> &Args)
- : Inst(&inst), CalleeF(Callee), RetVal(rv) {
+ : Site(CS), CalleeF(Callee), RetVal(rv) {
assert(Callee && "Null callee function specified for call site!");
Args.swap(CallArgs);
}
DSCallSite(const DSCallSite &DSCS) // Simple copy ctor
- : Inst(DSCS.Inst), CalleeF(DSCS.CalleeF), CalleeN(DSCS.CalleeN),
+ : Site(DSCS.Site), CalleeF(DSCS.CalleeF), CalleeN(DSCS.CalleeN),
RetVal(DSCS.RetVal), CallArgs(DSCS.CallArgs) {}
/// Mapping copy constructor - This constructor takes a preexisting call site
@@ -183,7 +181,7 @@ public:
///
template<typename MapTy>
DSCallSite(const DSCallSite &FromCall, const MapTy &NodeMap) {
- Inst = FromCall.Inst;
+ Site = FromCall.Site;
InitNH(RetVal, FromCall.RetVal, NodeMap);
InitNH(CalleeN, FromCall.CalleeN, NodeMap);
CalleeF = FromCall.CalleeF;
@@ -194,7 +192,7 @@ public:
}
const DSCallSite &operator=(const DSCallSite &RHS) {
- Inst = RHS.Inst;
+ Site = RHS.Site;
CalleeF = RHS.CalleeF;
CalleeN = RHS.CalleeN;
RetVal = RHS.RetVal;
@@ -212,7 +210,7 @@ public:
// Accessor functions...
Function &getCaller() const;
- CallInst &getCallInst() const { return *Inst; }
+ CallSite getCallSite() const { return Site; }
DSNodeHandle &getRetVal() { return RetVal; }
const DSNodeHandle &getRetVal() const { return RetVal; }
@@ -236,7 +234,7 @@ public:
void swap(DSCallSite &CS) {
if (this != &CS) {
- std::swap(Inst, CS.Inst);
+ std::swap(Site, CS.Site);
std::swap(RetVal, CS.RetVal);
std::swap(CalleeN, CS.CalleeN);
std::swap(CalleeF, CS.CalleeF);
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index d8f30d25d0..f52bb4b60f 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -11,10 +11,9 @@
#include "Support/hash_set"
class Type;
-class CallInst;
+class Instruction;
class DSGraph;
class DSNode;
-class DSCallSite;
// FIXME: move this stuff to a private header
namespace DataStructureAnalysis {
@@ -75,7 +74,7 @@ class BUDataStructures : public Pass {
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph;
- hash_multimap<CallInst*, Function*> ActualCallees;
+ hash_multimap<Instruction*, Function*> ActualCallees;
public:
~BUDataStructures() { releaseMemory(); }
@@ -106,7 +105,7 @@ public:
AU.addRequired<LocalDataStructures>();
}
- typedef hash_multimap<CallInst*, Function*> ActualCalleesTy;
+ typedef hash_multimap<Instruction*, Function*> ActualCalleesTy;
const ActualCalleesTy &getActualCallees() const {
return ActualCallees;
}
diff --git a/include/llvm/Analysis/IPModRef.h b/include/llvm/Analysis/IPModRef.h
index eed264f978..015618d057 100644
--- a/include/llvm/Analysis/IPModRef.h
+++ b/include/llvm/Analysis/IPModRef.h
@@ -45,7 +45,10 @@
class Module;
class Function;
+class CallSite;
+class Instruction;
class CallInst;
+class InvokeInst;
class DSNode;
class DSGraph;
class DSNodeHandle;
@@ -117,15 +120,15 @@ class FunctionModRefInfo {
IPModRef& IPModRefObj; // The IPModRef Object owning this
DSGraph* funcTDGraph; // Top-down DS graph for function
ModRefInfo funcModRefInfo; // ModRefInfo for the function body
- std::map<const CallInst*, ModRefInfo*>
+ std::map<const Instruction*, ModRefInfo*>
callSiteModRefInfo; // ModRefInfo for each callsite
std::map<const DSNode*, unsigned> NodeIds;
friend class IPModRef;
void computeModRef (const Function &func);
- void computeModRef (const CallInst& callInst);
- DSGraph *ResolveCallSiteModRefInfo(CallInst &CI,
+ void computeModRef (CallSite call);
+ DSGraph *ResolveCallSiteModRefInfo(CallSite CS,
hash_map<const DSNode*, DSNodeHandle> &NodeMap);
public:
@@ -145,9 +148,14 @@ public:
return &funcModRefInfo;
}
const ModRefInfo* getModRefInfo (const CallInst& callInst) const {
- std::map<const CallInst*, ModRefInfo*>::const_iterator I =
- callSiteModRefInfo.find(&callInst);
- return (I == callSiteModRefInfo.end())? NULL : I->second;
+ std::map<const Instruction*, ModRefInfo*>::const_iterator I =
+ callSiteModRefInfo.find((Instruction*)&callInst);
+ return (I == callSiteModRefInfo.end()) ? NULL : I->second;
+ }
+ const ModRefInfo* getModRefInfo (const InvokeInst& II) const {
+ std::map<const Instruction*, ModRefInfo*>::const_iterator I =
+ callSiteModRefInfo.find((Instruction*)&II);
+ return (I == callSiteModRefInfo.end()) ? NULL : I->second;
}
// Get the nodeIds used to index all Mod/Ref information for current function