1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/TableGen
Simon Tatham 7aeb5f145e [TableGen] Add a general-purpose JSON backend.
The aim of this backend is to output everything TableGen knows about
the record set, similarly to the default -print-records backend. But
where -print-records produces output in TableGen's input syntax
(convenient for humans to read), this backend produces it as
structured JSON data, which is convenient for loading into standard
scripting languages such as Python, in order to extract information
from the data set in an automated way.

The output data contains a JSON representation of the variable
definitions in output 'def' records, and a few pieces of metadata such
as which of those definitions are tagged with the 'field' prefix and
which defs are derived from which classes. It doesn't dump out
absolutely every piece of knowledge it _could_ produce, such as type
information and complicated arithmetic operator nodes in abstract
superclasses; the main aim is to allow consumers of this JSON dump to
essentially act as new backends, and backends don't generally need to
depend on that kind of data.

The new backend is implemented as an EmitJSON() function similar to
all of llvm-tblgen's other EmitFoo functions, except that it lives in
lib/TableGen instead of utils/TableGen on the basis that I'm expecting
to add it to clang-tblgen too in a future patch.

To test it, I've written a Python script that loads the JSON output
and tests properties of it based on comments in the .td source - more
or less like FileCheck, except that the CHECK: lines have Python
expressions after them instead of textual pattern matches.

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: arichardson, labath, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D46054

llvm-svn: 336771
2018-07-11 08:40:19 +00:00
..
2003-08-03-PassCode.td
2006-09-18-LargeInt.td
2010-03-24-PrematureDefaults.td
AllowDuplicateRegisterNames.td [TableGen] Give the option of tolerating duplicate register names 2017-12-07 09:51:55 +00:00
AnonDefinitionOnDemand.td TableGen: Delay instantiating inline anonymous records 2018-03-06 13:49:01 +00:00
arithmetic.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
AsmPredicateCondsEmission.td
AsmVariant.td [TableGen] Add a proper namespace to an Instruction in an AsmMatcher test. This is required after r307358. 2017-07-07 05:50:45 +00:00
BitOffsetDecoder.td TableGen: Explicitly check whether a record has been resolved 2018-03-06 13:48:47 +00:00
BitsInit.td TableGen: Allow !cast of records, cleanup conversion machinery 2018-03-06 13:48:39 +00:00
BitsInitOverflow.td TableGen: Explicitly check whether a record has been resolved 2018-03-06 13:48:47 +00:00
cast-list-initializer.td
cast-typeerror.td TableGen: Check the dynamic type of !cast<Rec>(string) 2018-03-19 14:14:20 +00:00
cast.td
ClassInstanceValue.td
code.td TableGen: Allow !cast of records, cleanup conversion machinery 2018-03-06 13:48:39 +00:00
compare.td TableGen: Add !ne, !le, !lt, !ge, and !gt comparisons 2018-03-14 11:00:57 +00:00
ConcatenatedSubregs.td Address r311914 review comments 2017-08-28 20:11:27 +00:00
CStyleComment.td
dag-functional.td TableGen: Allow dag operators to be resolved late 2018-03-14 11:00:48 +00:00
Dag.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
defmclass.td
DefmInherit.td
DefmInsideMultiClass.td
defset-typeerror.td TableGen: Add a defset statement 2018-03-09 12:24:42 +00:00
defset.td TableGen: Add a defset statement 2018-03-09 12:24:42 +00:00
DuplicateFieldValues.td
eq.td TableGen: Add !ne, !le, !lt, !ge, and !gt comparisons 2018-03-14 11:00:57 +00:00
eqbit.td TableGen: Add !ne, !le, !lt, !ge, and !gt comparisons 2018-03-14 11:00:57 +00:00
FastISelEmitter.td [FastISel] Permit instructions to be skipped for FastISel generation. 2018-05-22 14:36:58 +00:00
FieldAccess.td TableGen: Allow !cast of records, cleanup conversion machinery 2018-03-06 13:48:39 +00:00
foldl.td TableGen: Add !foldl operation 2018-03-06 13:49:16 +00:00
foreach-eval.td TableGen: Reimplement !foreach using the resolving mechanism 2018-03-05 15:21:04 +00:00
foreach-leak.td [TableGen] Don't quote variable name when printing !foreach. 2018-05-02 13:17:26 +00:00
foreach-multiclass.td TableGen: Allow foreach in multiclass to depend on template args 2018-06-21 13:35:44 +00:00
foreach.td TableGen: Reimplement !foreach using the resolving mechanism 2018-03-05 15:21:04 +00:00
ForeachList.td TableGen: Allow arbitrary list values as ranges of foreach 2018-03-09 12:24:30 +00:00
ForeachLoop.td
ForwardRef.td
GeneralList.td
generic-tables-instruction.td TableGen/SearchableTables: Support more generic enums and tables 2018-06-21 13:36:22 +00:00
generic-tables.td TableGen/SearchableTables: Support more generic enums and tables 2018-06-21 13:36:22 +00:00
GlobalISelEmitter.td [globalisel][tablegen] Add support for C++ predicates on PatFrags and use it to support BFC on ARM. 2018-06-15 23:13:43 +00:00
HwModeSelect.td TableGen support for parameterized register class information 2017-09-14 16:56:21 +00:00
if-empty-list-arg.td
if-type.td TableGen: Generalize record types to fix typeIsConvertibleTo et al. 2018-03-06 13:48:20 +00:00
if.td TableGen: Generalize record types to fix typeIsConvertibleTo et al. 2018-03-06 13:48:20 +00:00
ifbit.td
Include.inc
Include.td
IntBitInit.td
intrinsic-long-name.td [IR] Split Intrinsics.inc into enums and implementations 2018-06-23 02:02:38 +00:00
intrinsic-struct.td [IR] Split Intrinsics.inc into enums and implementations 2018-06-23 02:02:38 +00:00
intrinsic-varargs.td [IR] Split Intrinsics.inc into enums and implementations 2018-06-23 02:02:38 +00:00
isa.td TableGen: add !isa operation 2018-03-09 12:24:06 +00:00
JSON-check.py [TableGen] Add a general-purpose JSON backend. 2018-07-11 08:40:19 +00:00
JSON.td [TableGen] Add a general-purpose JSON backend. 2018-07-11 08:40:19 +00:00
LazyChange.td
LetInsideMultiClasses.td
lisp.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
list-element-bitref.td
ListArgs.td
ListArgsSimple.td
listconcat.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
ListConversion.td
ListManip.td
ListOfList.td
ListSlices.td
lit.local.cfg
LoLoL.td
math.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
MultiClass-defm-fail.td TableGen: Streamline how defs are instantiated 2018-03-21 17:12:53 +00:00
MultiClass-defm.td TableGen: Allow NAME in template arguments in defm in multiclass 2018-03-05 14:01:38 +00:00
MultiClass.td
MultiClassDefName.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
MultiClassInherit.td
MultiPat.td TableGen: Reimplement !foreach using the resolving mechanism 2018-03-05 15:21:04 +00:00
name-resolution-consistency.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
nested-comment.td
NestedForeach.td TableGen: Allow foreach in multiclass to depend on template args 2018-06-21 13:35:44 +00:00
Paste.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
pr8330.td
RegisterBankEmitter.td
RegisterEncoder.td
RelTest.td [mips] Improve diagnostics for instruction mapping 2018-01-08 16:25:40 +00:00
searchabletables-intrinsic.td TableGen/SearchableTables: Support more generic enums and tables 2018-06-21 13:36:22 +00:00
self-reference-recursion.td TableGen: Explicitly forbid self-references to field members 2018-03-19 14:14:28 +00:00
self-reference-typeerror.td TableGen: Explicitly test some cases of self-references and !cast errors 2018-03-19 14:14:10 +00:00
self-reference.td TableGen: Streamline how defs are instantiated 2018-03-21 17:12:53 +00:00
SetTheory.td
SiblingForeach.td
size.td TableGen: Add !size operation 2018-02-23 10:46:07 +00:00
Slice.td
strconcat.td
String.td
subst2.td
subst.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
SuperSubclassSameName.td
TargetInstrInfo.td
TargetInstrSpec.td TableGen: Reimplement !foreach using the resolving mechanism 2018-03-05 15:21:04 +00:00
template-arg-dependency.td TableGen: Resolve all template args simultaneously in AddSubClass 2018-03-05 15:21:11 +00:00
TemplateArgRename.td
Tree.td
TreeNames.td
trydecode-emission2.td [TableGen] Increase the number of supported decoder fix-ups. 2018-07-05 10:39:15 +00:00
trydecode-emission3.td [TableGen] Increase the number of supported decoder fix-ups. 2018-07-05 10:39:15 +00:00
trydecode-emission.td [TableGen] Increase the number of supported decoder fix-ups. 2018-07-05 10:39:15 +00:00
TwoLevelName.td
UnsetBitInit.td TableGen: Simplify BitsInit::resolveReferences 2018-03-06 13:48:30 +00:00
UnterminatedComment.td Make shell redirection construct portable 2017-07-12 13:24:46 +00:00
usevalname.td
ValidIdentifiers.td