• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s
2
3// Check that EncoderMethod for RegisterOperand is working correctly
4
5include "llvm/Target/Target.td"
6
7def ArchInstrInfo : InstrInfo { }
8
9def Arch : Target {
10  let InstructionSet = ArchInstrInfo;
11}
12
13def Reg : Register<"reg">;
14
15def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
16
17def RegOperand : RegisterOperand<RegClass> {
18  let EncoderMethod = "barEncoder";
19}
20
21def foo : Instruction {
22  let Size = 1;
23
24  let OutOperandList = (outs);
25  let InOperandList = (ins RegOperand:$bar);
26
27  bits<8> bar;
28  bits<8> Inst = bar;
29}
30
31// CHECK: case ::foo: {
32// CHECK:   op = barEncoder
33// CHECK:   Value |= op & UINT64_C(255);
34// CHECK:   break;
35// CHECK: }