]> granicus.if.org Git - llvm/commit
[TableGen] Allow DAG isel patterns to override default operands.
authorSimon Tatham <simon.tatham@arm.com>
Thu, 4 Jul 2019 08:43:20 +0000 (08:43 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Thu, 4 Jul 2019 08:43:20 +0000 (08:43 +0000)
commit150ff17d20a10cb60e86b80b3e6fb9d58d0c3bb1
tree90e6a2df6ce798b193b52ee2b4ecd8e1cda74165
parentde0cbb9401726d62df7eecf27102437fead62f7b
[TableGen] Allow DAG isel patterns to override default operands.

When a Tablegen instruction description uses `OperandWithDefaultOps`,
isel patterns for that instruction don't have to fill in the default
value for the operand in question. But the flip side is that they
actually //can't// override the defaults even if they want to.

This will be very inconvenient for the Arm backend, when we start
wanting to write isel patterns that generate the many MVE predicated
vector instructions, in the form with predication actually enabled. So
this small Tablegen fix makes it possible to write an isel pattern
either with or without values for a defaulted operand, and have the
default values filled in only if they are not overridden.

If all the defaulted operands come at the end of the instruction's
operand list, there's a natural way to match them up to the arguments
supplied in the pattern: consume pattern arguments until you run out,
then fill in any missing instruction operands with their default
values. But if defaulted and non-defaulted operands are interleaved,
it's less clear what to do. This does happen in existing targets (the
first example I came across was KILLGT, in the AMDGPU/R600 backend),
and of course they expect the previous behaviour (that the default for
those operands is used and a pattern argument is not consumed), so for
backwards compatibility I've stuck with that.

Reviewers: nhaehnle, hfinkel, dmgreen

Subscribers: mehdi_amini, javed.absar, tpr, kristof.beyls, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63814

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365114 91177308-0d34-0410-b5e6-96231b3b80d8
test/TableGen/DAGDefaultOps.td [new file with mode: 0644]
utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenDAGPatterns.h
utils/TableGen/DAGISelMatcherGen.cpp