[llvm-dev] TableGen: spring cleaning, new features for "functional programming"

Philip Pfaffe via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 14 08:56:24 PDT 2018


Hi Nicolai,

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?

Cheers,
Philip

2018-02-19 20:26 GMT+01:00 Nicolai Hähnle via llvm-dev <
llvm-dev at lists.llvm.org>:

> Hi all,
>
> While working on some features for the AMDGPU backend -- specifically,
> explicit address components for image intrinsics, which involves generating
> both
>
> (a) a lot of intrinsics with different but somewhat regular parameter
> types, and
>
> (b) the patterns to select instructions for those intrinsics
>
> -- I got fed up with a lot of the TableGen bugs and limitations and set
> out to fix things.
>
> I now have an already rather long list of ~30 patches which do a bunch of
> things in lib/TableGen/ such as:
>
> - better and earlier error messages
> - cleanup type checking
> - cleanup variable resolving
> - cleanup record instantiation
> - late generation of anonymous records that appear in expressions
> - cleanup !foreach
> - add !foldl
> - add !isa<type>(...) and make !cast more useful
> - add !dag builtin to generate DAG nodes from lists
> - some other minor new built-ins like !size, !le, !lt, !ge, !gt
> - add a defset mechanism for collecting records which can then later be
> looped over in a foreach statement
> - make foreach statements in multiclass work
> - probably more...
>
> An earlier version of the patches is here if you already want to take a
> look: https://cgit.freedesktop.org/~nh/llvm/log/?h=mimg
>
> My plan is to clean those up over the next days and weeks and submit them
> to Phabricator.
>
> 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.
>
> I would appreciate feedback and help in reviewing the patches when they
> arrive!
>
> Thanks,
> Nicolai
>
> P.S.: I'm going to document some of my findings and changes on my blog,
> the first entry is here: https://nhaehnle.blogspot.de/2
> 018/02/tablegen-1-what-has-tablegen-ever-done.html
>
> --
> Lerne, wie die Welt wirklich ist,
> Aber vergiss niemals, wie sie sein sollte.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180314/ed8cf39f/attachment.html>


More information about the llvm-dev mailing list