Skip to content

Commit 3250349

Browse files
authored
[TableGen][DecoderEmitter] Add OPC_Scope opcode (#155580)
This change introduces OPC_Scope opcode, whose only purpose is to record a continuation point to resume at if a subsequent opcode fails. Each OPC_Scope pushes an entry onto the scope stack; an entry is popped if an opcode in the scope fails. Previously, we recorded this information on several opcodes, it has been removed. A series of such opcodes often referred to the same continuation point; this information is now recorded in one place, reducing table sizes in most cases. Average reduction is 1.1%, some table observe up to 7% reduction in size. The new behavior of those opcodes is "check or leave scope". If we're in the outermost scope (scope stack is empty), they act as "check or fail". There is one opcode, OPC_FilterValueOrSkip that behaves like the old OPC_FilterValue. It is special because it acts as a case of a switch statement and has nothing to do with scopes. (If a case fails, we should try the next case instead of leaving the current scope.)
1 parent 188586a commit 3250349

File tree

10 files changed

+201
-256
lines changed

10 files changed

+201
-256
lines changed

llvm/include/llvm/MC/MCDecoderOps.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,16 @@ namespace llvm::MCD {
1616
// nts_t is either uint16_t or uint24_t based on whether large decoder table is
1717
// enabled.
1818
enum DecoderOps {
19-
OPC_ExtractField = 1, // OPC_ExtractField(uleb128 Start, uint8_t Len)
20-
OPC_FilterValue, // OPC_FilterValue(uleb128 Val, nts_t NumToSkip)
21-
OPC_FilterValueOrFail, // OPC_FilterValueOrFail(uleb128 Val)
22-
OPC_CheckField, // OPC_CheckField(uleb128 Start, uint8_t Len,
23-
// uleb128 Val, nts_t NumToSkip)
24-
OPC_CheckFieldOrFail, // OPC_CheckFieldOrFail(uleb128 Start, uint8_t Len,
25-
// uleb128 Val)
26-
OPC_CheckPredicate, // OPC_CheckPredicate(uleb128 PIdx, nts_t NumToSkip)
27-
OPC_CheckPredicateOrFail, // OPC_CheckPredicateOrFail(uleb128 PIdx)
28-
OPC_Decode, // OPC_Decode(uleb128 Opcode, uleb128 DIdx)
29-
OPC_TryDecode, // OPC_TryDecode(uleb128 Opcode, uleb128 DIdx,
30-
// nts_t NumToSkip)
31-
OPC_TryDecodeOrFail, // OPC_TryDecodeOrFail(uleb128 Opcode, uleb128 DIdx)
32-
OPC_SoftFail, // OPC_SoftFail(uleb128 PMask, uleb128 NMask)
19+
OPC_Scope = 1, // OPC_Scope(nts_t NumToSkip)
20+
OPC_ExtractField, // OPC_ExtractField(uleb128 Start, uint8_t Len)
21+
OPC_FilterValueOrSkip, // OPC_FilterValueOrSkip(uleb128 Val, nts_t NumToSkip)
22+
OPC_FilterValue, // OPC_FilterValue(uleb128 Val)
23+
OPC_CheckField, // OPC_CheckField(uleb128 Start, uint8_t Len,
24+
// uleb128 Val)
25+
OPC_CheckPredicate, // OPC_CheckPredicate(uleb128 PIdx)
26+
OPC_Decode, // OPC_Decode(uleb128 Opcode, uleb128 DIdx)
27+
OPC_TryDecode, // OPC_TryDecode(uleb128 Opcode, uleb128 DIdx)
28+
OPC_SoftFail, // OPC_SoftFail(uleb128 PMask, uleb128 NMask)
3329
};
3430

3531
} // namespace llvm::MCD

llvm/test/TableGen/FixedLenDecoderEmitter/additional-encoding.td

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,28 @@ class I<dag out_ops, dag in_ops> : Instruction {
3030
let OutOperandList = out_ops;
3131
}
3232

33-
// CHECK: /* 0 */ MCD::OPC_ExtractField, 12, 4, // Inst{15-12} ...
34-
// CHECK-NEXT: /* 3 */ MCD::OPC_FilterValue, 0, 14, 0, // Skip to: 21
35-
// CHECK-NEXT: /* 7 */ MCD::OPC_CheckField, 6, 6, 0, 4, 0, // Skip to: 17
36-
// CHECK-NEXT: /* 13 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP
37-
// CHECK-NEXT: /* 17 */ MCD::OPC_TryDecodeOrFail, {{[0-9]+}}, 2, 1,
38-
// CHECK-NEXT: /* 21 */ MCD::OPC_FilterValue, 1, 14, 0, // Skip to: 39
39-
// CHECK-NEXT: /* 25 */ MCD::OPC_CheckField, 6, 6, 0, 4, 0, // Skip to: 35
40-
// CHECK-NEXT: /* 31 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP
41-
// CHECK-NEXT: /* 35 */ MCD::OPC_TryDecodeOrFail, {{[0-9]+}}, 2, 1,
42-
// CHECK-NEXT: /* 39 */ MCD::OPC_FilterValue, 2, 14, 0, // Skip to: 57
43-
// CHECK-NEXT: /* 43 */ MCD::OPC_CheckField, 6, 6, 0, 4, 0, // Skip to: 53
44-
// CHECK-NEXT: /* 49 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP
45-
// CHECK-NEXT: /* 53 */ MCD::OPC_TryDecodeOrFail, {{[0-9]+}}, 2, 1,
46-
// CHECK-NEXT: /* 57 */ MCD::OPC_FilterValueOrFail, 3,
47-
// CHECK-NEXT: /* 59 */ MCD::OPC_CheckField, 6, 6, 0, 4, 0, // Skip to: 69
48-
// CHECK-NEXT: /* 65 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP
49-
// CHECK-NEXT: /* 69 */ MCD::OPC_TryDecodeOrFail, {{[0-9]+}}, 2, 1,
33+
// CHECK: /* 0 */ MCD::OPC_ExtractField, 12, 4, // Inst{15-12} ...
34+
// CHECK-NEXT: /* 3 */ MCD::OPC_FilterValueOrSkip, 0, 15, 0, // Skip to: 22
35+
// CHECK-NEXT: /* 7 */ MCD::OPC_Scope, 8, 0, // Skip to: 18
36+
// CHECK-NEXT: /* 10 */ MCD::OPC_CheckField, 6, 6, 0,
37+
// CHECK-NEXT: /* 14 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP, DecodeIdx: 0
38+
// CHECK-NEXT: /* 18 */ MCD::OPC_TryDecode, 187, 2, 1,
39+
// CHECK-NEXT: /* 22 */ MCD::OPC_FilterValueOrSkip, 1, 15, 0, // Skip to: 41
40+
// CHECK-NEXT: /* 26 */ MCD::OPC_Scope, 8, 0, // Skip to: 37
41+
// CHECK-NEXT: /* 29 */ MCD::OPC_CheckField, 6, 6, 0,
42+
// CHECK-NEXT: /* 33 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP, DecodeIdx: 0
43+
// CHECK-NEXT: /* 37 */ MCD::OPC_TryDecode, 188, 2, 1,
44+
// CHECK-NEXT: /* 41 */ MCD::OPC_FilterValueOrSkip, 2, 15, 0, // Skip to: 60
45+
// CHECK-NEXT: /* 45 */ MCD::OPC_Scope, 8, 0, // Skip to: 56
46+
// CHECK-NEXT: /* 48 */ MCD::OPC_CheckField, 6, 6, 0,
47+
// CHECK-NEXT: /* 52 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP, DecodeIdx: 0
48+
// CHECK-NEXT: /* 56 */ MCD::OPC_TryDecode, 189, 2, 1,
49+
// CHECK-NEXT: /* 60 */ MCD::OPC_FilterValue, 3,
50+
// CHECK-NEXT: /* 62 */ MCD::OPC_Scope, 8, 0, // Skip to: 73
51+
// CHECK-NEXT: /* 65 */ MCD::OPC_CheckField, 6, 6, 0,
52+
// CHECK-NEXT: /* 69 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: {{.*}}:NOP, DecodeIdx: 0
53+
// CHECK-NEXT: /* 73 */ MCD::OPC_TryDecode, 190, 2, 1,
54+
5055

5156
class SHIFT<bits<2> opc> : I<(outs), (ins ShAmtOp:$shamt)>, EncSHIFT<opc>;
5257
def SHIFT0 : SHIFT<0>;

llvm/test/TableGen/FixedLenDecoderEmitter/big-filter.td

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class I : Instruction {
1212
// Check that a 64-bit filter with all bits set does not confuse DecoderEmitter.
1313
//
1414
// CHECK-LABEL: static const uint8_t DecoderTable128[34] = {
15-
// CHECK-NEXT: MCD::OPC_ExtractField, 0, 64,
16-
// CHECK-NEXT: MCD::OPC_FilterValue, 1, 8, 0,
17-
// CHECK-NEXT: MCD::OPC_CheckFieldOrFail, 127, 1, 1,
18-
// CHECK-NEXT: MCD::OPC_Decode, 187, 2, 0,
19-
// CHECK-NEXT: MCD::OPC_FilterValueOrFail, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1,
20-
// CHECK-NEXT: MCD::OPC_CheckFieldOrFail, 127, 1, 0,
21-
// CHECK-NEXT: MCD::OPC_Decode, 186, 2, 0,
15+
// CHECK-NEXT: /* 0 */ MCD::OPC_ExtractField, 0, 64, // Inst{63-0} ...
16+
// CHECK-NEXT: /* 3 */ MCD::OPC_FilterValueOrSkip, 1, 8, 0, // Skip to: 15
17+
// CHECK-NEXT: /* 7 */ MCD::OPC_CheckField, 127, 1, 1,
18+
// CHECK-NEXT: /* 11 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: I2, DecodeIdx: 0
19+
// CHECK-NEXT: /* 15 */ MCD::OPC_FilterValue, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1,
20+
// CHECK-NEXT: /* 26 */ MCD::OPC_CheckField, 127, 1, 0,
21+
// CHECK-NEXT: /* 30 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: I1, DecodeIdx: 0
2222
// CHECK-NEXT: };
2323

2424
def I1 : I {

llvm/test/TableGen/FixedLenDecoderEmitter/var-len-conflict-1.td

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ class I : Instruction {
1818
// 00000001 ________ I16_1
1919
// 00000010 ________ I16_2
2020

21-
// CHECK: MCD::OPC_ExtractField, 0, 1, // Inst{0} ...
22-
// CHECK-NEXT: MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 11
23-
// CHECK-NEXT: MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: I8_0, DecodeIdx: 0
24-
// CHECK-NEXT: MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 19
25-
// CHECK-NEXT: MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: I8_1, DecodeIdx: 0
26-
// CHECK-NEXT: MCD::OPC_ExtractField, 8, 8, // Inst{15-8} ...
27-
// CHECK-NEXT: MCD::OPC_FilterValue, 0, 4, 0, // Skip to: 30
28-
// CHECK-NEXT: MCD::OPC_Decode, {{[0-9]+}}, 2, 1, // Opcode: I16_0, DecodeIdx: 1
29-
// CHECK-NEXT: MCD::OPC_FilterValue, 1, 4, 0, // Skip to: 38
30-
// CHECK-NEXT: MCD::OPC_Decode, {{[0-9]+}}, 2, 1, // Opcode: I16_1, DecodeIdx: 1
31-
// CHECK-NEXT: MCD::OPC_FilterValueOrFail, 2,
32-
// CHECK-NEXT: MCD::OPC_Decode, {{[0-9]+}}, 2, 1, // Opcode: I16_2, DecodeIdx: 1
21+
// CHECK: /* 0 */ MCD::OPC_Scope, 17, 0, // Skip to: 20
22+
// CHECK-NEXT: /* 3 */ MCD::OPC_ExtractField, 0, 1, // Inst{0} ...
23+
// CHECK-NEXT: /* 6 */ MCD::OPC_FilterValueOrSkip, 0, 4, 0, // Skip to: 14
24+
// CHECK-NEXT: /* 10 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: I8_0, DecodeIdx: 0
25+
// CHECK-NEXT: /* 14 */ MCD::OPC_FilterValue, 1,
26+
// CHECK-NEXT: /* 16 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 0, // Opcode: I8_1, DecodeIdx: 0
27+
// CHECK-NEXT: /* 20 */ MCD::OPC_ExtractField, 8, 8, // Inst{15-8} ...
28+
// CHECK-NEXT: /* 23 */ MCD::OPC_FilterValueOrSkip, 0, 4, 0, // Skip to: 31
29+
// CHECK-NEXT: /* 27 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 1, // Opcode: I16_0, DecodeIdx: 1
30+
// CHECK-NEXT: /* 31 */ MCD::OPC_FilterValueOrSkip, 1, 4, 0, // Skip to: 39
31+
// CHECK-NEXT: /* 35 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 1, // Opcode: I16_1, DecodeIdx: 1
32+
// CHECK-NEXT: /* 39 */ MCD::OPC_FilterValue, 2,
33+
// CHECK-NEXT: /* 41 */ MCD::OPC_Decode, {{[0-9]+}}, 2, 1, // Opcode: I16_2, DecodeIdx: 1
3334

3435
def I8_0 : I { dag Inst = (descend (operand "$op", 7), 0b0); }
3536
def I8_1 : I { dag Inst = (descend (operand "$op", 7), 0b1); }

llvm/test/TableGen/VarLenDecoder.td

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ def FOO32 : MyVarInst<MemOp32> {
5454
// CHECK-NEXT: };
5555

5656
// CHECK-SMALL: /* 0 */ MCD::OPC_ExtractField, 3, 5, // Inst{7-3} ...
57-
// CHECK-SMALL-NEXT: /* 3 */ MCD::OPC_FilterValue, 8, 4, 0, // Skip to: 11
57+
// CHECK-SMALL-NEXT: /* 3 */ MCD::OPC_FilterValueOrSkip, 8, 4, 0, // Skip to: 11
5858
// CHECK-SMALL-NEXT: /* 7 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 0, // Opcode: FOO16
59-
// CHECK-SMALL-NEXT: /* 11 */ MCD::OPC_FilterValueOrFail, 9,
59+
// CHECK-SMALL-NEXT: /* 11 */ MCD::OPC_FilterValue, 9,
6060
// CHECK-SMALL-NEXT: /* 13 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: FOO32
6161
// CHECK-SMALL-NEXT: };
6262

6363
// CHECK-LARGE: /* 0 */ MCD::OPC_ExtractField, 3, 5, // Inst{7-3} ...
64-
// CHECK-LARGE-NEXT: /* 3 */ MCD::OPC_FilterValue, 8, 4, 0, 0, // Skip to: 12
64+
// CHECK-LARGE-NEXT: /* 3 */ MCD::OPC_FilterValueOrSkip, 8, 4, 0, 0, // Skip to: 12
6565
// CHECK-LARGE-NEXT: /* 8 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 0, // Opcode: FOO16
66-
// CHECK-LARGE-NEXT: /* 12 */ MCD::OPC_FilterValueOrFail, 9,
66+
// CHECK-LARGE-NEXT: /* 12 */ MCD::OPC_FilterValue, 9,
6767
// CHECK-LARGE-NEXT: /* 14 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: FOO32
6868
// CHECK-LARGE-NEXT: };
6969

@@ -89,8 +89,7 @@ def FOO32 : MyVarInst<MemOp32> {
8989
// CHECK-LABEL: case MCD::OPC_ExtractField: {
9090
// CHECK: makeUp(insn, Start + Len);
9191

92-
// CHECK-LABEL: case MCD::OPC_CheckField:
93-
// CHECK-NEXT: case MCD::OPC_CheckFieldOrFail: {
92+
// CHECK-LABEL: case MCD::OPC_CheckField: {
9493
// CHECK: makeUp(insn, Start + Len);
9594

9695
// CHECK-LABEL: case MCD::OPC_Decode: {

llvm/test/TableGen/trydecode-emission.td

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ def InstB : TestInstruction {
3434
let hasCompleteDecoder = 0;
3535
}
3636

37-
// CHECK: /* 0 */ MCD::OPC_CheckFieldOrFail, 4, 4, 0,
38-
// CHECK-NEXT: /* 4 */ MCD::OPC_CheckField, 2, 2, 0, 6, 0, // Skip to: 16
39-
// CHECK-NEXT: /* 10 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 16
40-
// CHECK-NEXT: /* 16 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: {{[0-9]+}}
37+
// CHECK: /* 0 */ MCD::OPC_CheckField, 4, 4, 0,
38+
// CHECK-NEXT: /* 4 */ MCD::OPC_Scope, 8, 0, // Skip to: 15
39+
// CHECK-NEXT: /* 7 */ MCD::OPC_CheckField, 2, 2, 0,
40+
// CHECK-NEXT: /* 11 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
41+
// CHECK-NEXT: /* 15 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: 1
4142
// CHECK-NEXT: };
4243

4344
// CHECK: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }
@@ -46,10 +47,11 @@ def InstB : TestInstruction {
4647
// CHECK-NEXT: NumToSkip |= (*Ptr++) << 8;
4748
// CHECK-NEXT: return NumToSkip;
4849

49-
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckFieldOrFail, 4, 4, 0,
50-
// CHECK-LARGE-NEXT: /* 4 */ MCD::OPC_CheckField, 2, 2, 0, 7, 0, 0, // Skip to: 18
51-
// CHECK-LARGE-NEXT: /* 11 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 18
52-
// CHECK-LARGE-NEXT: /* 18 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: {{[0-9]+}}
50+
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckField, 4, 4, 0,
51+
// CHECK-LARGE-NEXT: /* 4 */ MCD::OPC_Scope, 8, 0, 0, // Skip to: 16
52+
// CHECK-LARGE-NEXT: /* 8 */ MCD::OPC_CheckField, 2, 2, 0,
53+
// CHECK-LARGE-NEXT: /* 12 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
54+
// CHECK-LARGE-NEXT: /* 16 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: 1
5355
// CHECK-LARGE-NEXT: };
5456

5557
// CHECK-LARGE: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }

llvm/test/TableGen/trydecode-emission2.td

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,24 @@ def InstB : TestInstruction {
3131
let hasCompleteDecoder = 0;
3232
}
3333

34-
// CHECK: /* 0 */ MCD::OPC_CheckFieldOrFail, 2, 1, 0,
35-
// CHECK-NEXT: /* 4 */ MCD::OPC_CheckFieldOrFail, 5, 3, 0,
36-
// CHECK-NEXT: /* 8 */ MCD::OPC_CheckField, 0, 2, 3, 6, 0, // Skip to: 20
37-
// CHECK-NEXT: /* 14 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 20
38-
// CHECK-NEXT: /* 20 */ MCD::OPC_CheckFieldOrFail, 3, 2, 0,
39-
// CHECK-NEXT: /* 24 */ MCD::OPC_TryDecodeOrFail, {{[0-9]+}}, {{[0-9]+}}, 1,
40-
// CHECK-NEXT: };
34+
// CHECK: /* 0 */ MCD::OPC_CheckField, 2, 1, 0,
35+
// CHECK-NEXT: /* 4 */ MCD::OPC_CheckField, 5, 3, 0,
36+
// CHECK-NEXT: /* 8 */ MCD::OPC_Scope, 8, 0, // Skip to: 19
37+
// CHECK-NEXT: /* 11 */ MCD::OPC_CheckField, 0, 2, 3,
38+
// CHECK-NEXT: /* 15 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
39+
// CHECK-NEXT: /* 19 */ MCD::OPC_CheckField, 3, 2, 0,
40+
// CHECK-NEXT: /* 23 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 1,
4141

4242
// CHECK: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }
4343
// CHECK: if (!Check(S, DecodeInstA(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }
4444

45-
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckFieldOrFail, 2, 1, 0,
46-
// CHECK-LARGE-NEXT: /* 4 */ MCD::OPC_CheckFieldOrFail, 5, 3, 0,
47-
// CHECK-LARGE-NEXT: /* 8 */ MCD::OPC_CheckField, 0, 2, 3, 7, 0, 0, // Skip to: 22
48-
// CHECK-LARGE-NEXT: /* 15 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 22
49-
// CHECK-LARGE-NEXT: /* 22 */ MCD::OPC_CheckFieldOrFail, 3, 2, 0,
50-
// CHECK-LARGE-NEXT: /* 26 */ MCD::OPC_TryDecodeOrFail, {{[0-9]+}}, {{[0-9]+}}, 1,
45+
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckField, 2, 1, 0,
46+
// CHECK-LARGE-NEXT: /* 4 */ MCD::OPC_CheckField, 5, 3, 0,
47+
// CHECK-LARGE-NEXT: /* 8 */ MCD::OPC_Scope, 8, 0, 0, // Skip to: 20
48+
// CHECK-LARGE-NEXT: /* 12 */ MCD::OPC_CheckField, 0, 2, 3,
49+
// CHECK-LARGE-NEXT: /* 16 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
50+
// CHECK-LARGE-NEXT: /* 20 */ MCD::OPC_CheckField, 3, 2, 0,
51+
// CHECK-LARGE-NEXT: /* 24 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 1,
5152
// CHECK-LARGE-NEXT: };
5253

5354
// CHECK-LARGE: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }

llvm/test/TableGen/trydecode-emission3.td

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@ def InstB : TestInstruction {
3535
let AsmString = "InstB";
3636
}
3737

38-
// CHECK: /* 0 */ MCD::OPC_CheckFieldOrFail, 4, 4, 0,
39-
// CHECK-NEXT: /* 4 */ MCD::OPC_CheckField, 2, 2, 0, 6, 0, // Skip to: 16
40-
// CHECK-NEXT: /* 10 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 16
41-
// CHECK-NEXT: /* 16 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA
38+
// CHECK: /* 0 */ MCD::OPC_CheckField, 4, 4, 0,
39+
// CHECK-NEXT: /* 4 */ MCD::OPC_Scope, 8, 0, // Skip to: 15
40+
// CHECK-NEXT: /* 7 */ MCD::OPC_CheckField, 2, 2, 0,
41+
// CHECK-NEXT: /* 11 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
42+
// CHECK-NEXT: /* 15 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: 1
4243
// CHECK-NEXT: };
4344

4445
// CHECK: if (!Check(S, DecodeInstBOp(MI, tmp, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }
4546

46-
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckFieldOrFail, 4, 4, 0,
47-
// CHECK-LARGE-NEXT: /* 4 */ MCD::OPC_CheckField, 2, 2, 0, 7, 0, 0, // Skip to: 18
48-
// CHECK-LARGE-NEXT: /* 11 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 18
49-
// CHECK-LARGE-NEXT: /* 18 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: {{[0-9]+}}
47+
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckField, 4, 4, 0,
48+
// CHECK-LARGE-NEXT: /* 4 */ MCD::OPC_Scope, 8, 0, 0, // Skip to: 16
49+
// CHECK-LARGE-NEXT: /* 8 */ MCD::OPC_CheckField, 2, 2, 0,
50+
// CHECK-LARGE-NEXT: /* 12 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
51+
// CHECK-LARGE-NEXT: /* 16 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: 1
5052
// CHECK-LARGE-NEXT: };
5153

5254
// CHECK-LARGE: if (!Check(S, DecodeInstBOp(MI, tmp, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }

llvm/test/TableGen/trydecode-emission4.td

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@ def InstB : TestInstruction {
3333
let hasCompleteDecoder = 0;
3434
}
3535

36-
// CHECK: /* 0 */ MCD::OPC_CheckFieldOrFail, 250, 3, 4, 0,
37-
// CHECK-NEXT: /* 5 */ MCD::OPC_CheckField, 248, 3, 2, 0, 6, 0, // Skip to: 18
38-
// CHECK-NEXT: /* 12 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 18
39-
// CHECK-NEXT: /* 18 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: {{[0-9]+}}
36+
// CHECK: /* 0 */ MCD::OPC_CheckField, 250, 3, 4, 0,
37+
// CHECK-NEXT: /* 5 */ MCD::OPC_Scope, 9, 0, // Skip to: 17
38+
// CHECK-NEXT: /* 8 */ MCD::OPC_CheckField, 248, 3, 2, 0,
39+
// CHECK-NEXT: /* 13 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
40+
// CHECK-NEXT: /* 17 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: 1
4041
// CHECK-NEXT: };
4142

4243
// CHECK: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }
4344

4445

45-
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckFieldOrFail, 250, 3, 4, 0,
46-
// CHECK-LARGE-NEXT: /* 5 */ MCD::OPC_CheckField, 248, 3, 2, 0, 7, 0, 0, // Skip to: 20
47-
// CHECK-LARGE-NEXT: /* 13 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, 0, // Opcode: InstB, DecodeIdx: {{[0-9]+}}, Skip to: 20
48-
// CHECK-LARGE-NEXT: /* 20 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: {{[0-9]+}}
46+
// CHECK-LARGE: /* 0 */ MCD::OPC_CheckField, 250, 3, 4, 0,
47+
// CHECK-LARGE-NEXT: /* 5 */ MCD::OPC_Scope, 9, 0, 0, // Skip to: 18
48+
// CHECK-LARGE-NEXT: /* 9 */ MCD::OPC_CheckField, 248, 3, 2, 0,
49+
// CHECK-LARGE-NEXT: /* 14 */ MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0,
50+
// CHECK-LARGE-NEXT: /* 18 */ MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA, DecodeIdx: 1
4951
// CHECK-LARGE-NEXT: };
5052

5153
// CHECK-LARGE: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }

0 commit comments

Comments
 (0)