blob: a3bed650890bd3609d385061f1faa92fa2e46bec [file] [log] [blame]
Nicolai Haehnle0ea4d062018-06-21 13:36:22 +00001// RUN: llvm-tblgen -gen-searchable-tables -I %p/../../include %s | FileCheck %s
2// XFAIL: vg_leak
3
4include "llvm/TableGen/SearchableTable.td"
5
6// CHECK-LABEL: GET_InstrTable_IMPL
Benjamin Kramer573d81c2019-08-24 15:11:41 +00007// CHECK: constexpr MyInstr InstrTable[] = {
Nicolai Haehnle0ea4d062018-06-21 13:36:22 +00008// CHECK: { B, 0xA },
9// CHECK: { C, 0x0 },
10// CHECK: { A, 0x5 },
11// CHECK: { D, 0x8 },
12// CHECK: };
13
14class Instruction {
15 bit isPseudo = 0;
16}
17
18class MyInstr<int op> : Instruction {
19 Instruction Opcode = !cast<Instruction>(NAME);
20 bits<16> CustomEncoding = op;
21}
22
23def A : MyInstr<5>;
24def D : MyInstr<8>;
25let isPseudo = 1 in {
26 def C : MyInstr<0>;
27 def B : MyInstr<10>;
28}
29
30def InstrTable : GenericTable {
31 let FilterClass = "MyInstr";
32 let Fields = ["Opcode", "CustomEncoding"];
33
34 let PrimaryKey = ["Opcode"];
35 let PrimaryKeyName = "getCustomEncodingHelper";
36}