[PATCH] D109035: [TableGen][SelectionDAG] Use ComplexPattern type for non-leaf nodes

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 17:17:22 PDT 2021


jrtc27 created this revision.
jrtc27 added reviewers: arsenm, RKSimon, efriedma, kparzysz, bogner.
Herald added subscribers: ecnelises, kristof.beyls, tpr.
jrtc27 requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

When used as a non-leaf node, TableGen does not currently use the type
of a ComplexPattern for type inference, which also means it does not
check it doesn't conflict with the use. This differs from when used as a
leaf value, where the type is used for inference. This addresses that
discrepancy. The test case is not representative of most real-world uses
but is sufficient to demonstrate inference is working.

Some of these uses also make use of ValueTypeByHwMode rather than
SimpleValueType and so the existing type inference is extended to
support that alongside the new type inference.

There are also currently various cases of using ComplexPatterns with an
untyped type, but only for non-leaf nodes. For compatibility this is
permitted, and uses the old behaviour of not inferring for non-leaf
nodes, but the existing logic is still used for leaf values. This
remaining discrepancy should eventually be eliminated, either by
removing all such uses of untyped so the special case goes away (I
imagine Any, or a more specific type in certain cases, would be
perfectly sufficient), or by copying it to the leaf value case so
they're consistent with one another if this is something that does need
to keep being supported.

All non-experimental targets have been verified to produce bit-for-bit
identical TableGen output with this change applied, provided my existing
patches to fix the use of ComplexPatterns in the AArch64 and AMDGPU
backends are applied.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109035

Files:
  llvm/test/TableGen/dag-isel-complexpattern.td
  llvm/utils/TableGen/CodeGenDAGPatterns.cpp
  llvm/utils/TableGen/CodeGenTarget.cpp
  llvm/utils/TableGen/CodeGenTarget.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109035.369821.patch
Type: text/x-patch
Size: 4692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210901/9383b6d6/attachment-0001.bin>


More information about the llvm-commits mailing list