diff --git a/llvm/test/TableGen/FixedLenDecoderEmitter/big-filter.td b/llvm/test/TableGen/FixedLenDecoderEmitter/big-filter.td index b9da61de469ac..e525b4e7219df 100644 --- a/llvm/test/TableGen/FixedLenDecoderEmitter/big-filter.td +++ b/llvm/test/TableGen/FixedLenDecoderEmitter/big-filter.td @@ -11,7 +11,7 @@ class I : Instruction { // Check that a 64-bit filter with all bits set does not confuse DecoderEmitter. // -// CHECK-LABEL: static const uint8_t DecoderTable128[] = { +// CHECK-LABEL: static const uint8_t DecoderTable128[35] = { // CHECK-NEXT: MCD::OPC_ExtractField, 0, 64, // CHECK-NEXT: MCD::OPC_FilterValue, 1, 8, 0, // CHECK-NEXT: MCD::OPC_CheckFieldOrFail, 127, 1, 1, @@ -20,7 +20,6 @@ class I : Instruction { // CHECK-NEXT: MCD::OPC_CheckFieldOrFail, 127, 1, 0, // CHECK-NEXT: MCD::OPC_Decode, 186, 2, 0, // CHECK-NEXT: MCD::OPC_Fail, -// CHECK-NEXT: 0 // CHECK-NEXT: }; def I1 : I { diff --git a/llvm/test/TableGen/HwModeEncodeDecode.td b/llvm/test/TableGen/HwModeEncodeDecode.td index aaacd7d3f6590..991054f8a279f 100644 --- a/llvm/test/TableGen/HwModeEncodeDecode.td +++ b/llvm/test/TableGen/HwModeEncodeDecode.td @@ -70,10 +70,10 @@ def baz : Instruction { } } -// DECODER-LABEL: DecoderTable_ModeA32[] = +// DECODER-LABEL: DecoderTable_ModeA32[22] = // DECODER-DAG: Opcode: fooTypeEncA:foo // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTable_ModeB32[] = +// DECODER-LABEL: DecoderTable_ModeB32[30] = // DECODER-DAG: Opcode: fooTypeEncB:foo // DECODER-DAG: Opcode: fooTypeEncA:baz // DECODER-DAG: Opcode: bar diff --git a/llvm/test/TableGen/HwModeEncodeDecode2.td b/llvm/test/TableGen/HwModeEncodeDecode2.td index dc8773699a466..a62d723837c8f 100644 --- a/llvm/test/TableGen/HwModeEncodeDecode2.td +++ b/llvm/test/TableGen/HwModeEncodeDecode2.td @@ -93,26 +93,26 @@ let OutOperandList = (outs) in { } } -// DECODER-LABEL: DecoderTable_ModeA32[] = +// DECODER-LABEL: DecoderTable_ModeA32[22] = // DECODER-DAG: Opcode: fooTypeEncA:foo // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTable_ModeB32[] = +// DECODER-LABEL: DecoderTable_ModeB32[30] = // DECODER-DAG: Opcode: fooTypeEncB:foo // DECODER-DAG: Opcode: fooTypeEncA:baz // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTableAlt_ModeA32[] = +// DECODER-LABEL: DecoderTableAlt_ModeA32[9] = // DECODER-DAG: Opcode: unrelated -// DECODER-LABEL: DecoderTableAlt_ModeB32[] = +// DECODER-LABEL: DecoderTableAlt_ModeB32[9] = // DECODER-DAG: Opcode: unrelated -// DECODER-SUPPRESS-LABEL: DecoderTable32[] = +// DECODER-SUPPRESS-LABEL: DecoderTable32[9] = // DECODER-SUPPRESS-DAG: Opcode: bar -// DECODER-SUPPRESS-LABEL: DecoderTable_ModeA32[] = +// DECODER-SUPPRESS-LABEL: DecoderTable_ModeA32[9] = // DECODER-SUPPRESS-DAG: Opcode: fooTypeEncA:foo // DECODER-SUPPRESS-NOT: Opcode: bar -// DECODER-SUPPRESS-LABEL: DecoderTable_ModeB32[] = +// DECODER-SUPPRESS-LABEL: DecoderTable_ModeB32[22] = // DECODER-SUPPRESS-DAG: Opcode: fooTypeEncB:foo // DECODER-SUPPRESS-DAG: Opcode: fooTypeEncA:baz // DECODER-SUPPRESS-NOT: Opcode: bar -// DECODER-SUPPRESS-LABEL: DecoderTableAlt32[] = +// DECODER-SUPPRESS-LABEL: DecoderTableAlt32[9] = // DECODER-SUPPRESS-DAG: Opcode: unrelated diff --git a/llvm/test/TableGen/HwModeEncodeDecode3.td b/llvm/test/TableGen/HwModeEncodeDecode3.td index 2629af26be7c0..a7366949f4017 100644 --- a/llvm/test/TableGen/HwModeEncodeDecode3.td +++ b/llvm/test/TableGen/HwModeEncodeDecode3.td @@ -116,46 +116,46 @@ def unrelated: Instruction { // significant duplication of DecoderTables. The four tables ‘DecoderTableAlt32’, // ‘DecoderTableAlt_ModeA32’, ‘DecoderTableAlt_ModeB32’ and 'DecoderTable_ModeC32' are // exact duplicates and could effectively be merged into one. -// DECODER-LABEL: DecoderTable32[] = +// DECODER-LABEL: DecoderTable32[9] = // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTable64[] = +// DECODER-LABEL: DecoderTable64[9] = // DECODER-DAG: Opcode: fooTypeEncDefault:foo -// DECODER-LABEL: DecoderTable_ModeA32[] = +// DECODER-LABEL: DecoderTable_ModeA32[22] = // DECODER-DAG: Opcode: fooTypeEncA:foo // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTable_ModeB32[] = +// DECODER-LABEL: DecoderTable_ModeB32[30] = // DECODER-DAG: Opcode: fooTypeEncB:foo // DECODER-DAG: Opcode: fooTypeEncA:baz // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTable_ModeC32[] = +// DECODER-LABEL: DecoderTable_ModeC32[22] = // DECODER-DAG: Opcode: fooTypeEncC:foo // DECODER-DAG: Opcode: bar -// DECODER-LABEL: DecoderTableAlt32[] = +// DECODER-LABEL: DecoderTableAlt32[9] = // DECODER-DAG: Opcode: unrelated -// DECODER-LABEL: DecoderTableAlt_ModeA32[] = +// DECODER-LABEL: DecoderTableAlt_ModeA32[9] = // DECODER-DAG: Opcode: unrelated -// DECODER-LABEL: DecoderTableAlt_ModeB32[] = +// DECODER-LABEL: DecoderTableAlt_ModeB32[9] = // DECODER-DAG: Opcode: unrelated -// DECODER-LABEL: DecoderTableAlt_ModeC32[] = +// DECODER-LABEL: DecoderTableAlt_ModeC32[9] = // DECODER-DAG: Opcode: unrelated // Under the 'O1' optimization level, unnecessary duplicate tables will be eliminated, // reducing the four ‘Alt’ tables down to just one. -// DECODER-SUPPRESS-O1-LABEL: DecoderTable32[] = +// DECODER-SUPPRESS-O1-LABEL: DecoderTable32[9] = // DECODER-SUPPRESS-O1-DAG: Opcode: bar -// DECODER-SUPPRESS-O1-LABEL: DecoderTable64[] = +// DECODER-SUPPRESS-O1-LABEL: DecoderTable64[9] = // DECODER-SUPPRESS-O1-DAG: Opcode: fooTypeEncDefault:foo -// DECODER-SUPPRESS-O1-LABEL: DecoderTable_ModeA32[] = +// DECODER-SUPPRESS-O1-LABEL: DecoderTable_ModeA32[22] = // DECODER-SUPPRESS-O1-DAG: Opcode: fooTypeEncA:foo // DECODER-SUPPRESS-O1-DAG: Opcode: bar -// DECODER-SUPPRESS-O1-LABEL: DecoderTable_ModeB32[] = +// DECODER-SUPPRESS-O1-LABEL: DecoderTable_ModeB32[30] = // DECODER-SUPPRESS-O1-DAG: Opcode: fooTypeEncB:foo // DECODER-SUPPRESS-O1-DAG: Opcode: fooTypeEncA:baz // DECODER-SUPPRESS-O1-DAG: Opcode: bar -// DECODER-SUPPRESS-O1-LABEL: DecoderTable_ModeC32[] = +// DECODER-SUPPRESS-O1-LABEL: DecoderTable_ModeC32[22] = // DECODER-SUPPRESS-O1-DAG: Opcode: fooTypeEncC:foo // DECODER-SUPPRESS-O1-DAG: Opcode: bar -// DECODER-SUPPRESS-O1-LABEL: DecoderTableAlt32[] = +// DECODER-SUPPRESS-O1-LABEL: DecoderTableAlt32[9] = // DECODER-SUPPRESS-O1-DAG: Opcode: unrelated // Under the 'O2' optimization condition, instructions possessing the 'EncodingByHwMode' @@ -164,22 +164,22 @@ def unrelated: Instruction { // attribute but are within the same DecoderNamespace will be stored in the 'Default' table. This // approach will significantly reduce instruction redundancy, but it necessitates users to thoroughly // consider the interplay between HwMode and DecoderNamespace for their instructions. -// DECODER-SUPPRESS-O2-LABEL: DecoderTable32[] = +// DECODER-SUPPRESS-O2-LABEL: DecoderTable32[9] = // DECODER-SUPPRESS-O2-DAG: Opcode: bar -// DECODER-SUPPRESS-O2-LABEL: DecoderTable64[] = +// DECODER-SUPPRESS-O2-LABEL: DecoderTable64[9] = // DECODER-SUPPRESS-O2-NOT: Opcode: bar // DECODER-SUPPRESS-O2-DAG: Opcode: fooTypeEncDefault:foo -// DECODER-SUPPRESS-O2-LABEL: DecoderTable_ModeA32[] = +// DECODER-SUPPRESS-O2-LABEL: DecoderTable_ModeA32[9] = // DECODER-SUPPRESS-O2-DAG: Opcode: fooTypeEncA:foo // DECODER-SUPPRESS-O2-NOT: Opcode: bar -// DECODER-SUPPRESS-O2-LABEL: DecoderTable_ModeB32[] = +// DECODER-SUPPRESS-O2-LABEL: DecoderTable_ModeB32[22] = // DECODER-SUPPRESS-O2-DAG: Opcode: fooTypeEncB:foo // DECODER-SUPPRESS-O2-DAG: Opcode: fooTypeEncA:baz // DECODER-SUPPRESS-O2-NOT: Opcode: bar -// DECODER-SUPPRESS-O2-LABEL: DecoderTable_ModeC32[] = +// DECODER-SUPPRESS-O2-LABEL: DecoderTable_ModeC32[13] = // DECODER-SUPPRESS-O2-DAG: Opcode: fooTypeEncC:foo // DECODER-SUPPRESS-O2-NOT: Opcode: bar -// DECODER-SUPPRESS-O2-LABEL: DecoderTableAlt32[] = +// DECODER-SUPPRESS-O2-LABEL: DecoderTableAlt32[9] = // DECODER-SUPPRESS-O2-DAG: Opcode: unrelated // For 'bar' and 'unrelated', we didn't assign any HwModes for them, diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp index ebd9148a505a2..6bcaf706759df 100644 --- a/llvm/utils/TableGen/DecoderEmitter.cpp +++ b/llvm/utils/TableGen/DecoderEmitter.cpp @@ -795,7 +795,7 @@ unsigned DecoderEmitter::emitTable(formatted_raw_ostream &OS, OS << "static const uint8_t DecoderTable" << Namespace; if (HwModeID != DefaultMode) OS << '_' << Target.getHwModes().getModeName(HwModeID); - OS << BitWidth << "[] = {\n"; + OS << BitWidth << "[" << Table.size() << "] = {\n"; // Emit ULEB128 encoded value to OS, returning the number of bytes emitted. auto emitULEB128 = [](DecoderTable::const_iterator &I, @@ -978,7 +978,6 @@ unsigned DecoderEmitter::emitTable(formatted_raw_ostream &OS, break; } } - OS << " 0\n"; OS << "};\n\n"; return OpcodeMask;