Fixed the llvm-mv X86 disassembler so the 'C' API gets jumps properly
authorKevin Enderby <enderby@apple.com>
Wed, 18 Apr 2012 23:12:11 +0000 (23:12 +0000)
committerKevin Enderby <enderby@apple.com>
Wed, 18 Apr 2012 23:12:11 +0000 (23:12 +0000)
symbolicated.  These have and operand type of TYPE_RELv which was not handled
as isBranch in translateImmediate() in X86Disassembler.cpp.  rdar://11268426

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

lib/Target/X86/Disassembler/X86Disassembler.cpp

index 8278bde7c21871a90d9beaeb0379d9e058801486..b13a00620bb780d2f4918b80f43ea0b27d68d5cf 100644 (file)
@@ -322,7 +322,12 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
 
   OperandType type = (OperandType)operand.type;
 
+  bool isBranch = false;
+  uint64_t pcrel = 0;
   if (type == TYPE_RELv) {
+    isBranch = true;
+    pcrel = insn.startLocation +
+            insn.displacementOffset + insn.displacementSize;
     switch (insn.displacementSize) {
     default:
       break;
@@ -373,8 +378,6 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
     }
   }
 
-  bool isBranch = false;
-  uint64_t pcrel = 0;
   switch (type) {
   case TYPE_XMM128:
     mcInst.addOperand(MCOperand::CreateReg(X86::XMM0 + (immediate >> 4)));