[llvm-branch-commits] [llvm-branch] r100002 - /llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h

Gabor Greif ggreif at gmail.com
Wed Mar 31 05:05:20 PDT 2010


Author: ggreif
Date: Wed Mar 31 07:05:20 2010
New Revision: 100002

URL: http://llvm.org/viewvc/llvm-project?rev=100002&view=rev
Log:
add ImmutableCallSite

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=100002&r1=100001&r2=100002&view=diff
==============================================================================
--- llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h (original)
+++ llvm/branches/ggreif/const-CallSite/include/llvm/Support/CallSite.h Wed Mar 31 07:05:20 2010
@@ -140,10 +140,10 @@
   IterTy arg_begin() const {
     assert(getInstruction() && "Not a call or invoke instruction!");
     // Skip non-arguments
-    return getInstruction()->op_begin() + getArgumentOffset();
+    return (this*)->op_begin() + getArgumentOffset();
   }
 
-  IterTy arg_end() const { return getInstruction()->op_end() - getArgumentEndOffset(); }
+  IterTy arg_end() const { return (this*)->op_end() - getArgumentEndOffset(); }
   bool arg_empty() const { return arg_end() == arg_begin(); }
   unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
   
@@ -174,9 +174,20 @@
   }
 };
 
+/// ImmutableCallSite - establish a view to a call site for examination
+class ImmutableCallSite : public CallSiteBase<> {
+  typedef CallSiteBase<> _Base;
+public:
+  ImmutableCallSite(const Value* V) : _Base(V) {}
+  ImmutableCallSite(const CallInst *CI) : _Base(CI) {}
+  ImmutableCallSite(const InvokeInst *II) : _Base(II) {}
+  ImmutableCallSite(const Instruction *II) : _Base(II) {}
+};
 
-class CallSite : public CallSiteBase<Function, Value, User , Instruction, CallInst, InvokeInst, User::op_iterator> {
-  typedef CallSiteBase<Function, Value, User , Instruction, CallInst, InvokeInst, User::op_iterator> _Base;
+class CallSite : public CallSiteBase<Function, Value, User, Instruction,
+                                     CallInst, InvokeInst, User::op_iterator> {
+  typedef CallSiteBase<Function, Value, User, Instruction,
+                       CallInst, InvokeInst, User::op_iterator> _Base;
 public:
   CallSite() {}
   CallSite(_Base B) : _Base(B) {}





More information about the llvm-branch-commits mailing list