Remove spurious caller pointer in DSCallSite.

Also add functions to access pointer argument nodes cleanly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4235 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve
2002-10-20 21:41:02 +00:00
parent e80fe61a72
commit 26b98265b7
7 changed files with 52 additions and 41 deletions

View File

@@ -362,26 +362,27 @@ inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) {
/// the DSNode handles for the function arguments.
///
class DSCallSite: public std::vector<DSNodeHandle> {
Function* caller;
CallInst* callInst;
DSCallSite(); // do not implement
public:
DSCallSite(Function& _caller, CallInst& _callInst)
: caller(&_caller), callInst(&_callInst) { }
DSCallSite(CallInst& _callInst) : callInst(&_callInst) { }
// Copy constructor with helper for cloning nodes. The helper should be a
// model of unary_function<const DSNodeHandle*, DSNodeHandle>, i.e., it
// should take a pointer to DSNodeHandle and return a fresh DSNodeHandle.
// If no helper is specified, this defaults to a simple copy constructor.
template<typename _CopierFunction>
DSCallSite::DSCallSite(const DSCallSite& FromCall,
_CopierFunction nodeCopier = *(_CopierFunction*) 0);
DSCallSite(const DSCallSite& FromCall,
_CopierFunction nodeCopier = *(_CopierFunction*) 0);
Function& getCaller() const { return *caller; }
CallInst& getCallInst() const { return *callInst; }
DSNodeHandle getReturnValueNode() const { return (*this)[0]; }
DSNodeHandle getCalleeNode() const { return (*this)[1]; }
Function& getCaller() const;
CallInst& getCallInst() const { return *callInst; }
DSNodeHandle getReturnValueNode() const { return (*this)[0]; }
DSNodeHandle getCalleeNode() const { return (*this)[1]; }
unsigned getNumPtrArgs() const { return (size() - 2); }
DSNodeHandle getPtrArgNode(unsigned i) const { assert(i < getNumPtrArgs());
return (*this)[i+2]; }
};