[PATCH] D63814: [TableGen] Allow DAG isel patterns to override default operands.

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 05:23:51 PDT 2019


simon_tatham created this revision.
simon_tatham added reviewers: nhaehnle, hfinkel, dmgreen.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, kristof.beyls, tpr, javed.absar, mehdi_amini.
Herald added a project: LLVM.

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.

It would be nice to make this overridability property universal across
all instances of `OperandWithDefaultOps`. But that's difficult,
because some existing instructions have operand lists in which the
defaulted operands come *before* mandatory ones, and they depend on
the DAG patterns being interpreted as containing only the mandatory
operands. (The first example of this I came across was KILLGT, in the
AMDGPU/R600 backend.)

So instead I've made the feature opt-in, by defining a subclass of
`OperandWithDefaultOps` called `OperandWithOverridableDefaultOps`, and
making the new semantics apply only to that one. Any backend that
doesn't deliberately switch to using that new subclass should see no
change in the interpretation of their existing isel patterns.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63814

Files:
  llvm/include/llvm/Target/Target.td
  llvm/test/TableGen/DAGDefaultOps.td
  llvm/utils/TableGen/CodeGenDAGPatterns.cpp
  llvm/utils/TableGen/CodeGenDAGPatterns.h
  llvm/utils/TableGen/DAGISelMatcherGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63814.206638.patch
Type: text/x-patch
Size: 7492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190626/2426d4e9/attachment.bin>


More information about the llvm-commits mailing list