[PATCH] D81095: [TableGen] Handle (outs variable_ops)

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 07:38:38 PDT 2020


dantrushin created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When `variable_ops` is specified in `InOperandList` of instruction,
it behaves as expected, i.e., does not count as operand.
So for `(ins variable_ops)` instruction description will have 0
operands.  However when used in OutOperandList it is counted as
operand. So `(outs variable_ops)` results in instruction with
one def.
This patch makes behavior of `variable_ops` in `out` list to match
that of `in` list.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81095

Files:
  llvm/utils/TableGen/CodeGenInstruction.cpp


Index: llvm/utils/TableGen/CodeGenInstruction.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenInstruction.cpp
+++ llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -56,6 +56,7 @@
   std::set<std::string> OperandNames;
   unsigned e = InDI->getNumArgs() + OutDI->getNumArgs();
   OperandList.reserve(e);
+  bool VariadicOuts = false;
   for (unsigned i = 0; i != e; ++i){
     Init *ArgInit;
     StringRef ArgName;
@@ -109,6 +110,8 @@
       else if (Rec->isSubClassOf("OptionalDefOperand"))
         hasOptionalDef = true;
     } else if (Rec->getName() == "variable_ops") {
+      if (i < NumDefs)
+        VariadicOuts = true;
       isVariadic = true;
       continue;
     } else if (Rec->isSubClassOf("RegisterClass")) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81095.268192.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200603/610857e3/attachment-0001.bin>


More information about the llvm-commits mailing list