[llvm-branch-commits] [llvm-branch] r101479 - in /llvm/branches/ggreif/CallInst-operands: include/llvm/Instructions.h lib/VMCore/Instructions.cpp lib/VMCore/Verifier.cpp

Gabor Greif ggreif at gmail.com
Fri Apr 16 10:13:06 PDT 2010


Author: ggreif
Date: Fri Apr 16 12:13:05 2010
New Revision: 101479

URL: http://llvm.org/viewvc/llvm-project?rev=101479&view=rev
Log:
add assertions about the illegal use of the low-level interface

Modified:
    llvm/branches/ggreif/CallInst-operands/include/llvm/Instructions.h
    llvm/branches/ggreif/CallInst-operands/lib/VMCore/Instructions.cpp
    llvm/branches/ggreif/CallInst-operands/lib/VMCore/Verifier.cpp

Modified: llvm/branches/ggreif/CallInst-operands/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/include/llvm/Instructions.h?rev=101479&r1=101478&r2=101479&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/include/llvm/Instructions.h (original)
+++ llvm/branches/ggreif/CallInst-operands/include/llvm/Instructions.h Fri Apr 16 12:13:05 2010
@@ -937,9 +937,17 @@
                                unsigned(isTC));
   }
 
+    Value* getOperand(unsigned i)const;
+//     Value* getOperand(unsigned i);
+    
+
+#define getOperand getOperand2
+
   /// Provide fast operand accessors
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
 
+#undef getOperand
+
   /// getCallingConv/setCallingConv - Get or set the calling convention of this
   /// function call.
   CallingConv::ID getCallingConv() const {
@@ -1088,8 +1096,9 @@
        typename std::iterator_traits<InputIterator>::iterator_category());
 }
 
+#define getOperand getOperand2
 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CallInst, Value)
-
+#undef getOperand
 //===----------------------------------------------------------------------===//
 //                               SelectInst Class
 //===----------------------------------------------------------------------===//

Modified: llvm/branches/ggreif/CallInst-operands/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/VMCore/Instructions.cpp?rev=101479&r1=101478&r2=101479&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/VMCore/Instructions.cpp Fri Apr 16 12:13:05 2010
@@ -26,6 +26,21 @@
 #include "llvm/Support/MathExtras.h"
 using namespace llvm;
 
+
+
+Value* CallInst::getOperand(unsigned i)const
+{
+    assert(i != getNumOperands() - 1);
+    return getOperand2(i);
+}
+/*
+     Value* getOperand(unsigned i)
+{
+    assert(i != numOperands);
+    return getOperand2(i);
+}
+*/
+
 //===----------------------------------------------------------------------===//
 //                            CallSite Class
 //===----------------------------------------------------------------------===//

Modified: llvm/branches/ggreif/CallInst-operands/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/VMCore/Verifier.cpp?rev=101479&r1=101478&r2=101479&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/VMCore/Verifier.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/VMCore/Verifier.cpp Fri Apr 16 12:13:05 2010
@@ -1605,7 +1605,7 @@
   // If the intrinsic takes MDNode arguments, verify that they are either global
   // or are local to *this* function.
   for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i)
-    if (MDNode *MD = dyn_cast<MDNode>(CI.getOperand(i))) {
+    if (MDNode *MD = dyn_cast<MDNode>(CI.getOperand2(i))) {
       if (!MD->isFunctionLocal()) continue;
       SmallPtrSet<MDNode *, 32> Visited;
       VerifyFunctionLocalMetadata(MD, CI.getParent()->getParent(), Visited);





More information about the llvm-branch-commits mailing list