summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-08 23:46:44 +0000
committerChris Lattner <sabre@nondot.org>2010-07-08 23:46:44 +0000
commitf469307c77637ddbbf6b7167b9d31cb20f39a040 (patch)
tree638f23bd62e727da11e9b95b9d86e8f903f53107 /llvm/lib/Target/X86/X86MCCodeEmitter.cpp
parent45879695553e4fcf007227eba100d3b4b366d477 (diff)
downloadbcm5719-llvm-f469307c77637ddbbf6b7167b9d31cb20f39a040.tar.gz
bcm5719-llvm-f469307c77637ddbbf6b7167b9d31cb20f39a040.zip
Change LEA to have 5 operands for its memory operand, just
like all other instructions, even though a segment is not allowed. This resolves a bunch of gross hacks in the encoder and makes LEA more consistent with the rest of the instruction set. No functionality change. llvm-svn: 107934
Diffstat (limited to 'llvm/lib/Target/X86/X86MCCodeEmitter.cpp')
-rw-r--r--llvm/lib/Target/X86/X86MCCodeEmitter.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86MCCodeEmitter.cpp b/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
index 94333aea6ac..813b8814f23 100644
--- a/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
+++ b/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
@@ -655,10 +655,7 @@ void X86MCCodeEmitter::EmitOpcodePrefix(uint64_t TSFlags, unsigned &CurByte,
default: assert(0 && "Invalid segment!");
case 0:
// No segment override, check for explicit one on memory operand.
- if (MemOperand != -1 && // If the instruction has a memory operand.
- // FIXME: This is disgusting.
- MI.getOpcode() != X86::LEA64r && MI.getOpcode() != X86::LEA64_32r &&
- MI.getOpcode() != X86::LEA16r && MI.getOpcode() != X86::LEA32r) {
+ 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;
@@ -839,11 +836,6 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
++FirstMemOp; // Skip the register source (which is encoded in VEX_VVVV).
}
- // FIXME: Maybe lea should have its own form? This is a horrible hack.
- if (Opcode == X86::LEA64r || Opcode == X86::LEA64_32r ||
- Opcode == X86::LEA16r || Opcode == X86::LEA32r)
- --AddrOperands; // No segment register
-
EmitByte(BaseOpcode, CurByte, OS);
EmitMemModRMByte(MI, FirstMemOp, GetX86RegNum(MI.getOperand(CurOp)),
OpenPOWER on IntegriCloud