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
// this type. The method normally will just use an alt-name index to look
// up the name to print. Default to the generic printOperand().
string PrintMethod = pm;
+
+ // EncoderMethod - The target method name to call to encode this register
+ // operand.
+ string EncoderMethod = "";
+
// ParserMatchClass - The "match class" that operands of this type fit
// in. Match classes are used to define the order in which instructions are
// match, to ensure that which instructions gets matched is deterministic.
// RUN: llvm-tblgen -gen-asm-matcher -I %p/../../include %s | FileCheck %s
-// Check that cpecifying AsmVariant works correctly
+// Check that specifying AsmVariant works correctly
include "llvm/Target/Target.td"
--- /dev/null
+// RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s
+
+// Check that EncoderMethod for RegisterOperand is working correctly
+
+include "llvm/Target/Target.td"
+
+def ArchInstrInfo : InstrInfo { }
+
+def Arch : Target {
+ let InstructionSet = ArchInstrInfo;
+}
+
+def Reg : Register<"reg">;
+
+def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
+
+def RegOperand : RegisterOperand<RegClass> {
+ let EncoderMethod = "barEncoder";
+}
+
+def foo : Instruction {
+ let Size = 1;
+
+ let OutOperandList = (outs);
+ let InOperandList = (ins RegOperand:$bar);
+
+ bits<8> bar;
+ bits<8> Inst = bar;
+}
+
+// CHECK: case ::foo: {
+// CHECK: op = barEncoder
+// CHECK: Value |= op & UINT64_C(255);
+// CHECK: break;
+// CHECK: }
\ No newline at end of file
PrintMethod = Rec->getValueAsString("PrintMethod");
OperandType = Rec->getValueAsString("OperandType");
OperandNamespace = Rec->getValueAsString("OperandNamespace");
+ EncoderMethod = Rec->getValueAsString("EncoderMethod");
} else if (Rec->isSubClassOf("Operand")) {
PrintMethod = Rec->getValueAsString("PrintMethod");
OperandType = Rec->getValueAsString("OperandType");