[PATCH] D88399: [TableGen] AsmMatcher: fix OpIdx of tied operands when HasOptionalOperands is true
TOCK Chiu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 03:33:58 PDT 2020
TOCK created this revision.
TOCK added a reviewer: arsenm.
TOCK added a project: LLVM.
Herald added a subscriber: llvm-commits.
TOCK requested review of this revision.
Herald added a subscriber: wdng.
For tied operands, entry in `ConversionTable` does not store operand
index but the index of `TiedAsmOperandTable` where the actual operand
index comes from. Only subtract the number of optional operands after
actual operand index is known or it would use wrong entry from
`TiedAsmOperandTable` and tied to wrong operand as a result.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88399
Files:
llvm/utils/TableGen/AsmMatcherEmitter.cpp
Index: llvm/utils/TableGen/AsmMatcherEmitter.cpp
===================================================================
--- llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1996,9 +1996,12 @@
CvtOS << " assert(OpIdx < (size_t)(std::end(TiedAsmOperandTable) -\n";
CvtOS << " std::begin(TiedAsmOperandTable)) &&\n";
CvtOS << " \"Tied operand not found\");\n";
- CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[OpIdx][0];\n";
- CvtOS << " if (TiedResOpnd != (uint8_t) -1)\n";
+ CvtOS << " unsigned TiedResOpnd = TiedAsmOperandTable[*(p + 1)][0];\n";
+ CvtOS << " if (TiedResOpnd != (uint8_t) -1) {\n";
+ if (HasOptionalOperands)
+ CvtOS << " TiedResOpnd -= DefaultsOffset[TiedResOpnd];\n";
CvtOS << " Inst.addOperand(Inst.getOperand(TiedResOpnd));\n";
+ CvtOS << " };\n";
CvtOS << " break;\n";
CvtOS << " }\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88399.294639.patch
Type: text/x-patch
Size: 972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200928/c25e78c0/attachment.bin>
More information about the llvm-commits
mailing list