llvm.org GIT mirror llvm / 5188cfa
[TableGen] Add EncoderMethod to RegisterOperand Reviewers: stoklund, grosbach, vpykhtin Differential Revision: https://reviews.llvm.org/D32493 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303044 91177308-0d34-0410-b5e6-96231b3b80d8 Sam Kolton 3 years ago
4 changed file(s) with 42 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
679679 // this type. The method normally will just use an alt-name index to look
680680 // up the name to print. Default to the generic printOperand().
681681 string PrintMethod = pm;
682
683 // EncoderMethod - The target method name to call to encode this register
684 // operand.
685 string EncoderMethod = "";
686
682687 // ParserMatchClass - The "match class" that operands of this type fit
683688 // in. Match classes are used to define the order in which instructions are
684689 // match, to ensure that which instructions gets matched is deterministic.
0 // RUN: llvm-tblgen -gen-asm-matcher -I %p/../../include %s | FileCheck %s
11
2 // Check that cpecifying AsmVariant works correctly
2 // Check that specifying AsmVariant works correctly
33
44 include "llvm/Target/Target.td"
55
0 // RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s
1
2 // Check that EncoderMethod for RegisterOperand is working correctly
3
4 include "llvm/Target/Target.td"
5
6 def ArchInstrInfo : InstrInfo { }
7
8 def Arch : Target {
9 let InstructionSet = ArchInstrInfo;
10 }
11
12 def Reg : Register<"reg">;
13
14 def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
15
16 def RegOperand : RegisterOperand {
17 let EncoderMethod = "barEncoder";
18 }
19
20 def foo : Instruction {
21 let Size = 1;
22
23 let OutOperandList = (outs);
24 let InOperandList = (ins RegOperand:$bar);
25
26 bits<8> bar;
27 bits<8> Inst = bar;
28 }
29
30 // CHECK: case ::foo: {
31 // CHECK: op = barEncoder
32 // CHECK: Value |= op & UINT64_C(255);
33 // CHECK: break;
34 // CHECK: }
7676 PrintMethod = Rec->getValueAsString("PrintMethod");
7777 OperandType = Rec->getValueAsString("OperandType");
7878 OperandNamespace = Rec->getValueAsString("OperandNamespace");
79 EncoderMethod = Rec->getValueAsString("EncoderMethod");
7980 } else if (Rec->isSubClassOf("Operand")) {
8081 PrintMethod = Rec->getValueAsString("PrintMethod");
8182 OperandType = Rec->getValueAsString("OperandType");