[PATCH] D71115: [TableGen] Add a permissive version of !con.

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 06:20:34 PST 2019


simon_tatham created this revision.
simon_tatham added a reviewer: nhaehnle.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

It can be inconvenient that `!con` will only let you concatenate dag
nodes if their operators match, because sometimes you need to combine
a dag fragment you've already got (e.g. passed in as a template
argument) with an operator you're making up on the spot (e.g. by
instantiating some other templated class, or constructing a string and
casting it to a record).

This patch introduces `!conp`, which works just like `!con` except
that it uses the operator from its first argument, and doesn't care
what the operators of subsequent arguments are.

`!conp` provides an alternative approach to programmatic dag node
construction, without the limitation of `!dag` that all the arguments
have to be of the same type: now you can give your sublists of dag
arguments in dag form, so they can take any types valid in a dag at
all, even if they're all different.

Another simple use of `!conp` is to replace just the operator of an
existing dag: `!conp((foo), (bar x, y, z))` returns `(foo x, y, z)`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71115

Files:
  llvm/docs/TableGen/LangIntro.rst
  llvm/docs/TableGen/LangRef.rst
  llvm/include/llvm/TableGen/Record.h
  llvm/lib/TableGen/Record.cpp
  llvm/lib/TableGen/TGLexer.cpp
  llvm/lib/TableGen/TGLexer.h
  llvm/lib/TableGen/TGParser.cpp
  llvm/test/TableGen/dag-functional.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71115.232543.patch
Type: text/x-patch
Size: 7062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191206/84e41666/attachment.bin>


More information about the llvm-commits mailing list