blob: 1b79da6f734713146cb1ba3c4b3db126610a36fc [file] [log] [blame]
Nicolai Haehnle2b1cd512018-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
7// CHECK: const MyInstr InstrTable[] = {
8// 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}