Update size of inst correctly with segment override.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2008-10-12 10:30:11 +00:00
parent b5cf048fdf
commit d21a6305ea
2 changed files with 12 additions and 0 deletions

View File

@ -420,6 +420,8 @@ void Emitter::emitInstruction(const MachineInstr &MI,
case X86II::GS:
MCE.emitByte(0x65);
break;
default: assert(0 && "Invalid segment!");
case 0: break; // No segment override!
}
// Emit the repeat opcode prefix as needed.

View File

@ -2668,6 +2668,16 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
// Emit the lock opcode prefix as needed.
if (Desc->TSFlags & X86II::LOCK) ++FinalSize;
// Emit segment overrid opcode prefix as needed.
switch (Desc->TSFlags & X86II::SegOvrMask) {
case X86II::FS:
case X86II::GS:
++FinalSize;
break;
default: assert(0 && "Invalid segment!");
case 0: break; // No segment override!
}
// Emit the repeat opcode prefix as needed.
if ((Desc->TSFlags & X86II::Op0Mask) == X86II::REP) ++FinalSize;