[PATCH] D156420: [TableGen] Add `!dump` and `dump`.
Francesco Petrogalli via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 27 05:04:38 PDT 2023
fpetrogalli created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fpetrogalli requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This allows dumping expressions (Init *) as soon as they become
concrete. Both of these take a string as the first operand that
prefixes the dump of the expression.
`!dump` can be used in a expression/functional context. For example:
!foreach(i, lst, !dump("elt = ", i))
`dump` can be used in a "statement" context:
def c: C<3>;
dump "c = ", c;
`dump` is implemented as a syntactic sugar. The above dump is parsed
into:
assert 1, !cast<string>(!dump("c = ", c));
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156420
Files:
llvm/docs/TableGen/ProgRef.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/lib/TableGen/TGParser.h
llvm/test/TableGen/dump.td
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156420.544717.patch
Type: text/x-patch
Size: 13485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230727/71263930/attachment.bin>
More information about the llvm-commits
mailing list