[PATCH] D147131: [PoC][TabgleGen] Add new bang operator !apply
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 30 00:06:45 PDT 2023
pcwang-thead marked 2 inline comments as done.
pcwang-thead added a comment.
In D147131#4231378 <https://reviews.llvm.org/D147131#4231378>, @tra wrote:
> It would be great to update tablegen documentation, too.
Thanks. This patch is still in the early stage, doc and more operations will be added later.
> On the surface, I think we're reinventing a lambda here.
Yes, so I post this patch here to gather feedbacks to see if I am on the right track. :-)
================
Comment at: llvm/lib/TableGen/Record.cpp:1898
+ std::string OpStr = Op->getAsUnquotedString();
+ if (OpStr == "add")
+ return BinOpInit::get(BinOpInit::ADD, Args[0], Args[1], ReturnType)
----------------
tra wrote:
> tra wrote:
> > How about `mul`, `div`, and `mod` ?
> Does it mean that we make all these ops a reserved keyword which would no longer be available to users for other purposes?
>
> E.g. here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/SIRegisterInfo.td#L123
>
`mul`, `div`, `mod` and others will be added later.
================
Comment at: llvm/lib/TableGen/Record.cpp:1898
+ std::string OpStr = Op->getAsUnquotedString();
+ if (OpStr == "add")
+ return BinOpInit::get(BinOpInit::ADD, Args[0], Args[1], ReturnType)
----------------
pcwang-thead wrote:
> tra wrote:
> > tra wrote:
> > > How about `mul`, `div`, and `mod` ?
> > Does it mean that we make all these ops a reserved keyword which would no longer be available to users for other purposes?
> >
> > E.g. here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/SIRegisterInfo.td#L123
> >
> `mul`, `div`, `mod` and others will be added later.
No, I think they won't be reserved keywords. These ops are valid only if they are in the context of `!apply`. And they are just mapped to existed bang operators and the semantic meanings are target-independent.
For the example you pointed out, they are some set operations and implemented in `SetTheory.h/.cpp` and the semantic meanings are target-dependent.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147131/new/
https://reviews.llvm.org/D147131
More information about the llvm-commits
mailing list