Use X86AddrNumOperands instead of magic constant one
authorDale Johannesen <dalej@apple.com>
Wed, 6 May 2009 19:04:30 +0000 (19:04 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 6 May 2009 19:04:30 +0000 (19:04 +0000)
more place.  This fixes a bunch of x86-64 JIT regressions.
(Introduced when the value of the magic constant changed
in 68645.  At the time apparently nobody noticed; failures
were hidden in 70343-70439 by an unrelated bug, so showed
up again as "new" failures in 70440.)

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

lib/Target/X86/X86CodeEmitter.cpp

index c54a996cb235a26e2fdbac33f00fd7f79452222c..c21eacc9a4c287bf141084d596c3ded85ec63330 100644 (file)
@@ -709,7 +709,8 @@ void Emitter::emitInstruction(const MachineInstr &MI,
   case X86II::MRM4m: case X86II::MRM5m:
   case X86II::MRM6m: case X86II::MRM7m: {
     intptr_t PCAdj = (CurOp + X86AddrNumOperands != NumOps) ?
-      (MI.getOperand(CurOp+4).isImm() ? X86InstrInfo::sizeOfImm(Desc) : 4) : 0;
+      (MI.getOperand(CurOp+X86AddrNumOperands).isImm() ? 
+          X86InstrInfo::sizeOfImm(Desc) : 4) : 0;
 
     MCE.emitByte(BaseOpcode);
     emitMemModRMByte(MI, CurOp, (Desc->TSFlags & X86II::FormMask)-X86II::MRM0m,