mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-11 10:31:40 +00:00
Avoid unneeded SIB byte encoding. Patch by Zoltan Varga.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71520 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc12c2be18
commit
6ed34918eb
@ -338,7 +338,8 @@ void Emitter::emitMemModRMByte(const MachineInstr &MI,
|
||||
unsigned BaseReg = Base.getReg();
|
||||
|
||||
// Is a SIB byte needed?
|
||||
if ((!Is64BitMode || DispForReloc) && IndexReg.getReg() == 0 &&
|
||||
if ((!Is64BitMode || DispForReloc || BaseReg != 0) &&
|
||||
IndexReg.getReg() == 0 &&
|
||||
(BaseReg == 0 || getX86RegNum(BaseReg) != N86::ESP)) {
|
||||
if (BaseReg == 0) { // Just a displacement?
|
||||
// Emit special case [disp32] encoding
|
||||
|
@ -2811,7 +2811,8 @@ static unsigned getMemModRMByteSize(const MachineInstr &MI, unsigned Op,
|
||||
unsigned BaseReg = Base.getReg();
|
||||
|
||||
// Is a SIB byte needed?
|
||||
if ((!Is64BitMode || DispForReloc) && IndexReg.getReg() == 0 &&
|
||||
if ((!Is64BitMode || DispForReloc || BaseReg != 0) &&
|
||||
IndexReg.getReg() == 0 &&
|
||||
(BaseReg == 0 || X86RegisterInfo::getX86RegNum(BaseReg) != N86::ESP)) {
|
||||
if (BaseReg == 0) { // Just a displacement?
|
||||
// Emit special case [disp32] encoding
|
||||
|
Loading…
x
Reference in New Issue
Block a user