[PATCH] D147131: [PoC][TabgleGen] Add new bang operator !apply
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 03:02:36 PDT 2023
pcwang-thead created this revision.
pcwang-thead added reviewers: Paul-C-Anagnostopoulos, nhaehnle, craig.topper, tra, jdoerfert, michaelmaitland, reames.
Herald added a subscriber: hiraditya.
Herald added a project: All.
pcwang-thead requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
There is no way to pass function as a value in TableGen, but we can
treat DAGs as S-expression and evaluate them.
In this patch, a new bang operator is added:
type value = !apply<type>(dag[, param]);
We can treat `dag` as function and evaluate it on `params`.
To not increase complexity, we map DAGs to subset of existed bang
operators. But we may support more bang operator or even user-definded
subroutines.
The need of `!apply` has been discussed in D146198 <https://reviews.llvm.org/D146198>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147131
Files:
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/apply.td
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147131.509277.patch
Type: text/x-patch
Size: 12334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230329/cea5a2a9/attachment.bin>
More information about the llvm-commits
mailing list