mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 03:30:28 +00:00
Encoding of instructions referencing segments has changed. Do what X86MCCodeEmitter does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138723 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
be6ceb6ebc
commit
c98da24bed
@ -618,6 +618,25 @@ void Emitter<CodeEmitter>::emitInstruction(MachineInstr &MI,
|
||||
|
||||
// Emit segment override opcode prefix as needed.
|
||||
switch (Desc->TSFlags & X86II::SegOvrMask) {
|
||||
case 0: {
|
||||
// Determine where the memory operand starts, if present.
|
||||
int MemOperand = X86II::getMemoryOperandNo(Desc->TSFlags);
|
||||
// No segment override, check for explicit one on memory operand.
|
||||
if (MemOperand != -1) { // If the instruction has a memory operand.
|
||||
switch (MI.getOperand(MemOperand+X86::AddrSegmentReg).getReg()) {
|
||||
default: assert(0 && "Unknown segment register!");
|
||||
case 0: break;
|
||||
case X86::CS: MCE.emitByte(0x2E); break;
|
||||
case X86::SS: MCE.emitByte(0x36); break;
|
||||
case X86::DS: MCE.emitByte(0x3E); break;
|
||||
case X86::ES: MCE.emitByte(0x26); break;
|
||||
case X86::FS: MCE.emitByte(0x64); break;
|
||||
case X86::GS: MCE.emitByte(0x65); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case X86II::FS:
|
||||
MCE.emitByte(0x64);
|
||||
break;
|
||||
@ -625,7 +644,6 @@ void Emitter<CodeEmitter>::emitInstruction(MachineInstr &MI,
|
||||
MCE.emitByte(0x65);
|
||||
break;
|
||||
default: llvm_unreachable("Invalid segment!");
|
||||
case 0: break; // No segment override!
|
||||
}
|
||||
|
||||
// Emit the repeat opcode prefix as needed.
|
||||
|
Loading…
Reference in New Issue
Block a user