diff options
author | Sergei Barannikov <barannikov88@gmail.com> | 2024-11-09 07:25:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-09 07:25:40 +0300 |
commit | 501a58344179242f702f55e0ee5c039290426c54 (patch) | |
tree | a0c0fe925339099c48339d8d814836c86e1a694d /llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | |
parent | fb4f426c81d7e87dbb30df7abeba15ffc2f9f41a (diff) | |
download | llvm-501a58344179242f702f55e0ee5c039290426c54.zip llvm-501a58344179242f702f55e0ee5c039290426c54.tar.gz llvm-501a58344179242f702f55e0ee5c039290426c54.tar.bz2 |
[TableGen][SelectionDAG] Remove the `implicit` DAG node (#115295)
The node was introduced in 59c39dc1 and was intended to allow writing
patterns like this:
`[(set AL, (mul AL, GR8:$src1)), (implicit EFLAGS)]`
However, it does not introduce new functionality because the same
pattern can be equivalently expressed as:
`[(set AL, EFLAGS, (mul AL, GR8:$src1))]`
The latter form is also more flexible as it allows reordering output
operands.
In most places uses of `implicit` were redundant -- removing them didn't
change anything in the generated DAG tables. The only three cases where
it did have effect are in X86InstrArithmetic.td and X86InstrSystem.td --
those were rewritten to use `set` node.
Removing `implicit` from some patterns made them importable by GISel,
hence the change in a test.
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp')
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index f17c62d..c8186d6 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -1838,7 +1838,7 @@ MVT::SimpleValueType SDNodeInfo::getKnownType(unsigned ResNo) const { static unsigned GetNumNodeResults(const Record *Operator, CodeGenDAGPatterns &CDP) { - if (Operator->getName() == "set" || Operator->getName() == "implicit") + if (Operator->getName() == "set") return 0; // All return nothing. if (Operator->isSubClassOf("Intrinsic")) @@ -2945,8 +2945,7 @@ TreePatternNodePtr TreePattern::ParseTreePattern(const Init *TheInit, !Operator->isSubClassOf("Instruction") && !Operator->isSubClassOf("SDNodeXForm") && !Operator->isSubClassOf("Intrinsic") && - !Operator->isSubClassOf("ComplexPattern") && - Operator->getName() != "set" && Operator->getName() != "implicit") + !Operator->isSubClassOf("ComplexPattern") && Operator->getName() != "set") error("Unrecognized node '" + Operator->getName() + "'!"); // Check to see if this is something that is illegal in an input pattern. @@ -3456,21 +3455,6 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( return; } - if (Pat->getOperator()->getName() == "implicit") { - for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) { - TreePatternNode &Dest = Pat->getChild(i); - if (!Dest.isLeaf()) - I.error("implicitly defined value should be a register!"); - - const DefInit *Val = dyn_cast<DefInit>(Dest.getLeafValue()); - if (!Val || !Val->getDef()->isSubClassOf("Register")) - I.error("implicitly defined value should be a register!"); - if (Val) - InstImpResults.push_back(Val->getDef()); - } - return; - } - if (Pat->getOperator()->getName() != "set") { // If this is not a set, verify that the children nodes are not void typed, // and recurse. |