llvm-project/llvm/test/TableGen
Nicolai Haehnle 01d261f18d TableGen: Streamline the semantics of NAME
Summary:
The new rules are straightforward. The main rules to keep in mind
are:

1. NAME is an implicit template argument of class and multiclass,
   and will be substituted by the name of the instantiating def/defm.

2. The name of a def/defm in a multiclass must contain a reference
   to NAME. If such a reference is not present, it is automatically
   prepended.

And for some additional subtleties, consider these:

3. defm with no name generates a unique name but has no special
   behavior otherwise.

4. def with no name generates an anonymous record, whose name is
   unique but undefined. In particular, the name won't contain a
   reference to NAME.

Keeping rules 1&2 in mind should allow a predictable behavior of
name resolution that is simple to follow.

The old "rules" were rather surprising: sometimes (but not always),
NAME would correspond to the name of the toplevel defm. They were
also plain bonkers when you pushed them to their limits, as the old
version of the TableGen test case shows.

Having NAME correspond to the name of the toplevel defm introduces
"spooky action at a distance" and breaks composability:
refactoring the upper layers of a hierarchy of nested multiclass
instantiations can cause unexpected breakage by changing the value
of NAME at a lower level of the hierarchy. The new rules don't
suffer from this problem.

Some existing .td files have to be adjusted because they ended up
depending on the details of the old implementation.

Change-Id: I694095231565b30f563e6fd0417b41ee01a12589

Reviewers: tra, simon_tatham, craig.topper, MartinO, arsenm, javed.absar

Subscribers: wdng, llvm-commits

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

llvm-svn: 333900
2018-06-04 14:26:05 +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
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
CStyleComment.td
ClassInstanceValue.td
ConcatenatedSubregs.td Address r311914 review comments 2017-08-28 20:11:27 +00:00
Dag.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
DefmInherit.td
DefmInsideMultiClass.td
DuplicateFieldValues.td [tablegen] Delete duplicates from a vector without skipping elements 2016-12-01 19:38:50 +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
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
GlobalISelEmitter.td [GlobalISel][InstructionSelect] Moving Reg Bank Checks forward, perf patch 9 2018-05-23 23:58:10 +00:00
HwModeSelect.td TableGen support for parameterized register class information 2017-09-14 16:56:21 +00:00
Include.inc
Include.td
IntBitInit.td
LazyChange.td
LetInsideMultiClasses.td
ListArgs.td
ListArgsSimple.td
ListConversion.td
ListManip.td
ListOfList.td
ListSlices.td
LoLoL.td
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
NestedForeach.td
Paste.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
RegisterBankEmitter.td TableGen: Fix infinite recursion in RegisterBankEmitter 2017-01-30 15:07:01 +00:00
RegisterEncoder.td [TableGen] Add EncoderMethod to RegisterOperand 2017-05-15 10:13:07 +00:00
RelTest.td [mips] Improve diagnostics for instruction mapping 2018-01-08 16:25:40 +00:00
SetTheory.td
SiblingForeach.td
Slice.td
String.td
SuperSubclassSameName.td
TargetInstrInfo.td
TargetInstrSpec.td TableGen: Reimplement !foreach using the resolving mechanism 2018-03-05 15:21:04 +00:00
TemplateArgRename.td
Tree.td
TreeNames.td
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
ValidIdentifiers.td
arithmetic.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +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
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
dag-functional.td TableGen: Allow dag operators to be resolved late 2018-03-14 11:00:48 +00:00
defmclass.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
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
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: Streamline how defs are instantiated 2018-03-21 17:12:53 +00:00
foreach.td TableGen: Reimplement !foreach using the resolving mechanism 2018-03-05 15:21:04 +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
intrinsic-long-name.td TableGen: Allow setting SDNodeProperties on intrinsics 2017-12-20 19:36:28 +00:00
intrinsic-struct.td TableGen: Allow setting SDNodeProperties on intrinsics 2017-12-20 19:36:28 +00:00
intrinsic-varargs.td TableGen: Allow setting SDNodeProperties on intrinsics 2017-12-20 19:36:28 +00:00
isa.td TableGen: add !isa operation 2018-03-09 12:24:06 +00:00
lisp.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
list-element-bitref.td
listconcat.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
lit.local.cfg
math.td TableGen: Type-check BinOps 2018-03-14 11:00:43 +00:00
name-resolution-consistency.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
nested-comment.td
pr8330.td
searchabletables-intrinsic.td TableGen: Support Intrinsic values in SearchableTable 2018-04-01 17:08:58 +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
size.td TableGen: Add !size operation 2018-02-23 10:46:07 +00:00
strconcat.td
subst.td TableGen: Streamline the semantics of NAME 2018-06-04 14:26:05 +00:00
subst2.td
template-arg-dependency.td TableGen: Resolve all template args simultaneously in AddSubClass 2018-03-05 15:21:11 +00:00
trydecode-emission.td
trydecode-emission2.td
trydecode-emission3.td
usevalname.td