[llvm-dev] Extending TableGen's 'foreach' to work with 'multiclass' and 'defm'

Alex Bradbury via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 23 11:25:59 PDT 2017


On 23 August 2017 at 18:21, Hal Finkel via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> That could also be two separate questions: Would we replace the .td input
> language with Python completely in the long term? Would we rewrite the the
> backends (i.e., TableGen plugins) in Python? I don't yet have an opinion on
> either. I can see advantages to providing Python as input language. What do
> you think?

I see three options it's worth differentiating between due to the
different trade-offs in terms of benefit, disruption, build-time
dependencies etc etc:
1) Keep tablegen as-is, but encourage/allow backends to use a more
powerful language to generate very straight-forward .td. This might
take a template-based approach (e.g. Jinja2), or perhaps just
pretty-printing the preferred data structure in to .td.
2) Embed Python in tablegen (i.e. python will be linked in to the
tablegen binary).
3) Drop tablegen altogether, develop an alternative tool for
generating the necessary .inc files

A number of LLVM users already do something like option 1). e.g. the
Hexagon backend or a variety of companies who offer tools for
generating custom processor cores + compiler support based on
specifying new instructions in a custom DSL.

Best,

Alex


More information about the llvm-dev mailing list