[llvm-branch-commits] [llvm-branch] r99547 - /llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h
Gabor Greif
ggreif at gmail.com
Thu Mar 25 13:02:49 PDT 2010
Author: ggreif
Date: Thu Mar 25 15:02:49 2010
New Revision: 99547
URL: http://llvm.org/viewvc/llvm-project?rev=99547&view=rev
Log:
allow constization of Function too
Modified:
llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h
Modified: llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h?rev=99547&r1=99546&r2=99547&view=diff
==============================================================================
--- llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h (original)
+++ llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h Thu Mar 25 15:02:49 2010
@@ -34,7 +34,8 @@
class CallInst;
class InvokeInst;
-template <typename ValTy = const Value,
+template <typename FunTy = const Function,
+ typename ValTy = const Value,
typename UserTy = const User,
typename InstrTy = const Instruction,
typename CallTy = const CallInst,
@@ -44,8 +45,8 @@
PointerIntPair<InstrTy*, 1, bool> I;
public:
CallSiteBase() : I(0, false) {}
- CallSiteBase(CallInst *CI) : I(reinterpret_cast<InstrTy*>(CI), true) {}
- CallSiteBase(InvokeInst *II) : I(reinterpret_cast<InstrTy*>(II), false) {}
+ CallSiteBase(CallTy *CI) : I(reinterpret_cast<InstrTy*>(CI), true) {}
+ CallSiteBase(InvokeTy *II) : I(reinterpret_cast<InstrTy*>(II), false) {}
CallSiteBase(ValTy *II) { *this = get(II); }
CallSiteBase(InstrTy *II) {
assert(II && "Null instruction given?");
@@ -83,7 +84,7 @@
/// getCalledValue - Return the pointer to function that is being called...
///
- Value *getCalledValue() const {
+ ValTy *getCalledValue() const {
assert(getInstruction() && "Not a call or invoke instruction!");
return *getCallee();
}
@@ -91,8 +92,8 @@
/// getCalledFunction - Return the function being called if this is a direct
/// call, otherwise return null (if it's an indirect call).
///
- Function *getCalledFunction() const {
- return dyn_cast<Function>(getCalledValue());
+ FunTy *getCalledFunction() const {
+ return dyn_cast<FunTy>(getCalledValue());
}
/// setCalledFunction - Set the callee to the specified value...
@@ -109,7 +110,7 @@
return getCallee() == &UI.getUse();
}
- Value *getArgument(unsigned ArgNo) const {
+ ValTy *getArgument(unsigned ArgNo) const {
assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
return *(arg_begin()+ArgNo);
}
@@ -129,6 +130,10 @@
return &I.getUse() - arg_begin();
}
+ /// arg_iterator - The type of iterator to use when looping over actual
+ /// arguments at this call site...
+ typedef IterTy arg_iterator;
+
/// arg_begin/arg_end - Return iterators corresponding to the actual argument
/// list for a call site.
IterTy arg_begin() const {
More information about the llvm-branch-commits
mailing list