remove the private hack from CallInst, it was not supposed to hit the branch anyway
authorGabor Greif <ggreif@gmail.com>
Thu, 5 Aug 2010 21:25:49 +0000 (21:25 +0000)
committerGabor Greif <ggreif@gmail.com>
Thu, 5 Aug 2010 21:25:49 +0000 (21:25 +0000)
as a positive consequence the CallSite::getCallee() methods now can be rewritten to be
a bit more efficient

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110380 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instructions.h
include/llvm/Support/CallSite.h
lib/VMCore/Instructions.cpp

index b4c88ca8d24e2643a98c77ec0c8785d823ab66ba..f2854b6342c90445b7c9303b4fd62221a44e5c08 100644 (file)
@@ -941,28 +941,8 @@ public:
                                unsigned(isTC));
   }
 
-  /// @deprecated these "define hacks" will go away soon
-  /// @brief coerce out-of-tree code to abandon the low-level interfaces
-  /// @detail see below comments and update your code to high-level interfaces
-  ///    - getOperand(0)  --->  getCalledValue(), or possibly getCalledFunction
-  ///    - setOperand(0, V)  --->  setCalledFunction(V)
-  ///
-  ///    in LLVM v2.8-only code
-  ///    - getOperand(N+1)  --->  getArgOperand(N)
-  ///    - setOperand(N+1, V)  --->  setArgOperand(N, V)
-  ///    - getNumOperands()  --->  getNumArgOperands()+1  // note the "+1"!
-  ///
-  ///    in backward compatible code please consult llvm/Support/CallSite.h,
-  ///    you should create a callsite using the CallInst pointer and call its
-  ///    methods
-  ///
-# define public private
-# define protected private
   /// Provide fast operand accessors
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-# undef public
-# undef protected
-public:
 
   /// getNumArgOperands - Return the number of call arguments.
   ///
index 5c6632bdf3fc2c401b323b4b8de8d5c2b6cc2257..9b6a4098b6170e761bc2838a74f3e5c98426fce9 100644 (file)
@@ -261,13 +261,10 @@ private:
   }
 
   IterTy getCallee() const {
-      // FIXME: this is slow, since we do not have the fast versions
-      // of the op_*() functions here. See CallSite::getCallee.
-      //
-    if (isCall())
-      return getInstruction()->op_end() - 1; // Skip Callee
-    else
-      return getInstruction()->op_end() - 3; // Skip BB, BB, Callee
+    if (isCall()) // Skip Callee
+      return cast<CallInst>(getInstruction())->op_end() - 1;
+    else // Skip BB, BB, Callee
+      return cast<InvokeInst>(getInstruction())->op_end() - 3;
   }
 };
 
index e03cc827580e56a5c55db23e0493e6c3b8e018f4..9e5fd239233ebb9b2755b49d9ef3ea018dd6159e 100644 (file)
@@ -33,7 +33,7 @@ using namespace llvm;
 User::op_iterator CallSite::getCallee() const {
   Instruction *II(getInstruction());
   return isCall()
-    ? cast</*FIXME: CallInst*/User>(II)->op_end() - 1 // Skip Callee
+    ? cast<CallInst>(II)->op_end() - 1 // Skip Callee
     : cast<InvokeInst>(II)->op_end() - 3; // Skip BB, BB, Callee
 }