about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-07-15 04:48:25 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-07-15 04:48:25 +0000
commit1c983524d05fb4b3b21a2836662f63f27774d01c (patch)
treec0204f957afc2bb5b245488d7e0c59272ab0d40a
parentcceb06eebe931a5d933a45e70519aa61b90eddc1 (diff)
downloadklee-1c983524d05fb4b3b21a2836662f63f27774d01c.tar.gz
Update to match new 2.8 CallInst getOperand API.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@108406 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Module/IntrinsicCleaner.cpp5
-rw-r--r--lib/Module/RaiseAsm.cpp16
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
index 540ee0d3..da0c65f8 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
@@ -61,8 +61,13 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b) {
         // FIXME: This is much more target dependent than just the word size,
         // however this works for x86-32 and x86-64.
       case Intrinsic::vacopy: { // (dst, src) -> *((i8**) dst) = *((i8**) src)
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8)
         Value *dst = ii->getOperand(1);
         Value *src = ii->getOperand(2);
+#else
+        Value *dst = ii->getArgOperand(0);
+        Value *src = ii->getArgOperand(1);
+#endif
 
         if (WordSize == 4) {
           Type *i8pp = PointerType::getUnqual(PointerType::getUnqual(Type::getInt8Ty(getGlobalContext())));
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 42940fda..f89a7661 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Passes.h"
+#include "klee/Config/config.h"
 
 #include "llvm/InlineAsm.h"
 #if !(LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 7)
@@ -36,17 +37,26 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) {
       const llvm::Type *T = ci->getType();
 
       // bswaps
-      if (ci->getNumOperands() == 2 && 
-          T == ci->getOperand(1)->getType() &&
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8)
+      unsigned NumOperands = ci->getNumOperands();
+      llvm::Value *Arg0 = NumOperands > 1 ? ci->getOperand(1) : 0;
+#else
+      unsigned NumOperands = ci->getNumArgOperands() + 1;
+      llvm::Value *Arg0 = NumOperands > 1 ? ci->getArgOperand(0) : 0;
+#endif
+      if (Arg0 && T == Arg0->getType() &&
           ((T == llvm::Type::getInt16Ty(getGlobalContext()) && 
             as == "rorw $$8, ${0:w}" &&
             cs == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}") ||
            (T == llvm::Type::getInt32Ty(getGlobalContext()) &&
             as == "rorw $$8, ${0:w};rorl $$16, $0;rorw $$8, ${0:w}" &&
             cs == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"))) {
-        llvm::Value *Arg0 = ci->getOperand(1);
         Function *F = getIntrinsic(M, Intrinsic::bswap, Arg0->getType());
+#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 8)
         ci->setOperand(0, F);
+#else
+        ci->setCalledFunction(F);
+#endif
         return true;
       }
     }