Skip to content

Commit 86126e4

Browse files
committed
[X86] Hide POP16/32/64rmr and PUSH16/32/64rmr instructions from the assembly parser.
These all have a short form encoding that the assembler already prefers. Though that preference seems to only be based on order in the .td fie. Hiding the long form saves space in the table and prevents us from breaking the implicit order based priority. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334897 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ea330bd commit 86126e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Target/X86/X86InstrInfo.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,10 +1191,13 @@ def POP16r : I<0x58, AddRegFrm, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>,
11911191
OpSize16;
11921192
def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>,
11931193
OpSize32, Requires<[Not64BitMode]>;
1194+
// Long form for the disassembler.
1195+
let isCodeGenOnly = 1, ForceDisassemble = 1 in {
11941196
def POP16rmr: I<0x8F, MRM0r, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>,
11951197
OpSize16, NotMemoryFoldable;
11961198
def POP32rmr: I<0x8F, MRM0r, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>,
11971199
OpSize32, Requires<[Not64BitMode]>, NotMemoryFoldable;
1200+
} // isCodeGenOnly = 1, ForceDisassemble = 1
11981201
} // mayLoad, SchedRW
11991202
let mayStore = 1, mayLoad = 1, SchedRW = [WriteRMW] in {
12001203
def POP16rmm: I<0x8F, MRM0m, (outs), (ins i16mem:$dst), "pop{w}\t$dst", []>,
@@ -1208,10 +1211,13 @@ def PUSH16r : I<0x50, AddRegFrm, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>,
12081211
OpSize16;
12091212
def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>,
12101213
OpSize32, Requires<[Not64BitMode]>;
1214+
// Long form for the disassembler.
1215+
let isCodeGenOnly = 1, ForceDisassemble = 1 in {
12111216
def PUSH16rmr: I<0xFF, MRM6r, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>,
12121217
OpSize16, NotMemoryFoldable;
12131218
def PUSH32rmr: I<0xFF, MRM6r, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>,
12141219
OpSize32, Requires<[Not64BitMode]>, NotMemoryFoldable;
1220+
} // isCodeGenOnly = 1, ForceDisassemble = 1
12151221

12161222
def PUSH16i8 : Ii8<0x6a, RawFrm, (outs), (ins i16i8imm:$imm),
12171223
"push{w}\t$imm", []>, OpSize16;
@@ -1279,17 +1285,23 @@ let Defs = [RSP], Uses = [RSP], hasSideEffects=0 in {
12791285
let mayLoad = 1, SchedRW = [WriteLoad] in {
12801286
def POP64r : I<0x58, AddRegFrm, (outs GR64:$reg), (ins), "pop{q}\t$reg", []>,
12811287
OpSize32, Requires<[In64BitMode]>;
1288+
// Long form for the disassembler.
1289+
let isCodeGenOnly = 1, ForceDisassemble = 1 in {
12821290
def POP64rmr: I<0x8F, MRM0r, (outs GR64:$reg), (ins), "pop{q}\t$reg", []>,
12831291
OpSize32, Requires<[In64BitMode]>, NotMemoryFoldable;
1292+
} // isCodeGenOnly = 1, ForceDisassemble = 1
12841293
} // mayLoad, SchedRW
12851294
let mayLoad = 1, mayStore = 1, SchedRW = [WriteRMW] in
12861295
def POP64rmm: I<0x8F, MRM0m, (outs), (ins i64mem:$dst), "pop{q}\t$dst", []>,
12871296
OpSize32, Requires<[In64BitMode]>;
12881297
let mayStore = 1, SchedRW = [WriteStore] in {
12891298
def PUSH64r : I<0x50, AddRegFrm, (outs), (ins GR64:$reg), "push{q}\t$reg", []>,
12901299
OpSize32, Requires<[In64BitMode]>;
1300+
// Long form for the disassembler.
1301+
let isCodeGenOnly = 1, ForceDisassemble = 1 in {
12911302
def PUSH64rmr: I<0xFF, MRM6r, (outs), (ins GR64:$reg), "push{q}\t$reg", []>,
12921303
OpSize32, Requires<[In64BitMode]>, NotMemoryFoldable;
1304+
} // isCodeGenOnly = 1, ForceDisassemble = 1
12931305
} // mayStore, SchedRW
12941306
let mayLoad = 1, mayStore = 1, SchedRW = [WriteRMW] in {
12951307
def PUSH64rmm: I<0xFF, MRM6m, (outs), (ins i64mem:$src), "push{q}\t$src", []>,

0 commit comments

Comments
 (0)