[PATCH] D104698: [TableGen] Fix printing second PC-relative operand
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 22 23:28:54 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG36111f28edb1: [TableGen] Fix printing second PC-relative operand (authored by ikudrin).
Changed prior to commit:
https://reviews.llvm.org/D104698?vs=353597&id=353853#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104698/new/
https://reviews.llvm.org/D104698
Files:
llvm/test/TableGen/AsmWriterPCRelOp.td
llvm/utils/TableGen/AsmWriterInst.h
Index: llvm/utils/TableGen/AsmWriterInst.h
===================================================================
--- llvm/utils/TableGen/AsmWriterInst.h
+++ llvm/utils/TableGen/AsmWriterInst.h
@@ -66,7 +66,8 @@
bool operator!=(const AsmWriterOperand &Other) const {
if (OperandType != Other.OperandType || Str != Other.Str) return true;
if (OperandType == isMachineInstrOperand)
- return MIOpNo != Other.MIOpNo || MiModifier != Other.MiModifier;
+ return MIOpNo != Other.MIOpNo || MiModifier != Other.MiModifier ||
+ PCRel != Other.PCRel;
return false;
}
bool operator==(const AsmWriterOperand &Other) const {
Index: llvm/test/TableGen/AsmWriterPCRelOp.td
===================================================================
--- /dev/null
+++ llvm/test/TableGen/AsmWriterPCRelOp.td
@@ -0,0 +1,38 @@
+// RUN: llvm-tblgen -gen-asm-writer -I %p/../../include %s | FileCheck %s
+
+include "llvm/Target/Target.td"
+
+def ArchInstrInfo : InstrInfo { }
+
+def Arch : Target {
+ let InstructionSet = ArchInstrInfo;
+}
+
+def R0 : Register<"r0">;
+def Reg : RegisterClass<"Reg", [i32], 0, (add R0)>;
+
+def IntOperand: Operand<i32>;
+
+def PCRelOperand : Operand<i32> {
+ let OperandType = "OPERAND_PCREL";
+}
+
+def foo : Instruction {
+ let OutOperandList = (outs);
+ let InOperandList = (ins Reg:$reg, IntOperand:$imm);
+ let AsmString = "foo $reg, $imm";
+}
+
+def bar : Instruction {
+ let OutOperandList = (outs);
+ let InOperandList = (ins Reg:$reg, PCRelOperand:$imm);
+ let AsmString = "bar $reg, $imm";
+}
+
+// CHECK: ArchInstPrinter::printInstruction(
+// CHECK: // bar, foo
+// CHECK-NEXT: printOperand(MI, 0, O);
+// CHECK: // foo
+// CHECK-NEXT: printOperand(MI, 1, O);
+// CHECK: // bar
+// CHECK-NEXT: printOperand(MI, Address, 1, O);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104698.353853.patch
Type: text/x-patch
Size: 1832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210623/cf7a794e/attachment-0001.bin>
More information about the llvm-commits
mailing list