<div dir="ltr">Hi Nicolai,<div><br></div><div>if you're open to it, I'd like suggest another smallish cleanup in libTablegen, namely doing something about the layering. Basicly what bit me a few times is that there is a `Main.cpp` file. This particular file adds CLI options such as -o, -d, -I. So if you build some out-of-tree tool and happen to link against `all` components because you're lazy, there is a high likelihood of an option clash, which are nasty to debug. Can we move these options outside of the library and put them in the tool instead?</div><div><br></div><div>Cheers,</div><div>Philip</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-19 20:26 GMT+01:00 Nicolai Hähnle via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
While working on some features for the AMDGPU backend -- specifically, explicit address components for image intrinsics, which involves generating both<br>
<br>
(a) a lot of intrinsics with different but somewhat regular parameter types, and<br>
<br>
(b) the patterns to select instructions for those intrinsics<br>
<br>
-- I got fed up with a lot of the TableGen bugs and limitations and set out to fix things.<br>
<br>
I now have an already rather long list of ~30 patches which do a bunch of things in lib/TableGen/ such as:<br>
<br>
- better and earlier error messages<br>
- cleanup type checking<br>
- cleanup variable resolving<br>
- cleanup record instantiation<br>
- late generation of anonymous records that appear in expressions<br>
- cleanup !foreach<br>
- add !foldl<br>
- add !isa<type>(...) and make !cast more useful<br>
- add !dag builtin to generate DAG nodes from lists<br>
- some other minor new built-ins like !size, !le, !lt, !ge, !gt<br>
- add a defset mechanism for collecting records which can then later be looped over in a foreach statement<br>
- make foreach statements in multiclass work<br>
- probably more...<br>
<br>
An earlier version of the patches is here if you already want to take a look: <a href="https://cgit.freedesktop.org/~nh/llvm/log/?h=mimg" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/~<wbr>nh/llvm/log/?h=mimg</a><br>
<br>
My plan is to clean those up over the next days and weeks and submit them to Phabricator.<br>
<br>
With the exception of !foreach, which doesn't actually seem to be used, all the changes should be backward compatible. In fact, most of the larger changes are simply refactoring TableGen in a way that makes things work that look like they should already work but don't.<br>
<br>
I would appreciate feedback and help in reviewing the patches when they arrive!<br>
<br>
Thanks,<br>
Nicolai<br>
<br>
P.S.: I'm going to document some of my findings and changes on my blog, the first entry is here: <a href="https://nhaehnle.blogspot.de/2018/02/tablegen-1-what-has-tablegen-ever-done.html" rel="noreferrer" target="_blank">https://nhaehnle.blogspot.de/2<wbr>018/02/tablegen-1-what-has-tab<wbr>legen-ever-done.html</a><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Lerne, wie die Welt wirklich ist,<br>
Aber vergiss niemals, wie sie sein sollte.<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</font></span></blockquote></div><br></div>