[llvm] f2c9765 - [TableGen] Handle (outs variable_ops)
Denis Antrushin via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 06:08:07 PDT 2020
Author: Denis Antrushin
Date: 2020-06-04T16:07:33+03:00
New Revision: f2c97656644e783622a6e60fe452b41ffe0f1d18
URL: https://github.com/llvm/llvm-project/commit/f2c97656644e783622a6e60fe452b41ffe0f1d18
DIFF: https://github.com/llvm/llvm-project/commit/f2c97656644e783622a6e60fe452b41ffe0f1d18.diff
LOG: [TableGen] Handle (outs variable_ops)
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.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D81095
Added:
Modified:
llvm/utils/TableGen/CodeGenInstruction.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp
index b97193d2df46..1df5902b081e 100644
--- a/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -56,6 +56,7 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
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 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
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")) {
@@ -137,6 +140,8 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
MIOperandNo += NumOps;
}
+ if (VariadicOuts)
+ --NumDefs;
// Make sure the constraints list for each operand is large enough to hold
// constraint info, even if none is present.
More information about the llvm-commits
mailing list