TableGen: Add a defset statement
authorNicolai Haehnle <nhaehnle@gmail.com>
Fri, 9 Mar 2018 12:24:42 +0000 (12:24 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Fri, 9 Mar 2018 12:24:42 +0000 (12:24 +0000)
commitfcd6525a4516f0a4d83fd8dcaee25c81ac2c14cd
tree911a9e9413187f6d3c6c62d0aeba37d78d757f9e
parent8aa9d5839dbb4d457616a935eb2167ceb0087dfa
TableGen: Add a defset statement

Allows capturing a list of concrete instantiated defs.

This can be combined with foreach to create parallel sets of def
instantiations with less repetition in the source. This purpose is
largely also served by multiclasses, but in some cases multiclasses
can't be used.

The motivating example for this change is having a large set of
intrinsics, which are generated from the IntrinsicsBackend.td file
included by Intrinsics.td, and a corresponding set of instruction
selection patterns, which are generated via the backend's .td files.

Multiclasses cannot be used to eliminate the redundancy in this case,
because a multiclass cannot span both LLVM's common .td files and
the backend .td files at the same time.

Change-Id: I879e35042dceea542a5e6776fad23c5e0e69e76b

Differential revision: https://reviews.llvm.org/D44109

llvm-svn: 327121
llvm/docs/TableGen/LangRef.rst
llvm/include/llvm/TableGen/Record.h
llvm/lib/TableGen/TGLexer.cpp
llvm/lib/TableGen/TGLexer.h
llvm/lib/TableGen/TGParser.cpp
llvm/lib/TableGen/TGParser.h
llvm/test/TableGen/defset-typeerror.td [new file with mode: 0644]
llvm/test/TableGen/defset.td [new file with mode: 0644]