forked from OSchip/llvm-project
420e28c78c
Summary: Instantiating def's and defm's needs to perform the following steps: - for defm's, clone multiclass def prototypes and subsitute template args - for def's and defm's, add subclass definitions, substituting template args - clone the record based on foreach loops and substitute loop iteration variables - override record variables based on the global 'let' stack - resolve the record name (this should be simple, but unfortunately it's not due to existing .td files relying on rather silly implementation details) - for def(m)s in multiclasses, add the unresolved record as a multiclass prototype - for top-level def(m)s, resolve all internal variable references and add them to the record keeper and any active defsets This change streamlines how we go through these steps, by having both def's and defm's feed into a single addDef() method that handles foreach, final resolve, and routing the record to the right place. This happens to make foreach inside of multiclasses work, as the new test case demonstrates. Previously, foreach inside multiclasses was not forbidden by the parser, but it was de facto broken. Another side effect is that the order of "instantiated from" notes in error messages is reversed, as the modified test case shows. This is arguably clearer, since the initial error message ends up pointing directly to whatever triggered the error, and subsequent notes will point to increasingly outer layers of multiclasses. This is consistent with how C++ compilers report nested #includes and nested template instantiations. Change-Id: Ica146d0db2bc133dd7ed88054371becf24320447 Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D44478 llvm-svn: 328117 |
||
---|---|---|
.. | ||
2003-08-03-PassCode.td | ||
2006-09-18-LargeInt.td | ||
2010-03-24-PrematureDefaults.td | ||
AllowDuplicateRegisterNames.td | ||
AnonDefinitionOnDemand.td | ||
AsmPredicateCondsEmission.td | ||
AsmVariant.td | ||
BitOffsetDecoder.td | ||
BitsInit.td | ||
BitsInitOverflow.td | ||
CStyleComment.td | ||
ClassInstanceValue.td | ||
ConcatenatedSubregs.td | ||
Dag.td | ||
DefmInherit.td | ||
DefmInsideMultiClass.td | ||
DuplicateFieldValues.td | ||
FieldAccess.td | ||
ForeachList.td | ||
ForeachLoop.td | ||
ForwardRef.td | ||
GeneralList.td | ||
GlobalISelEmitter.td | ||
HwModeSelect.td | ||
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 | ||
MultiClass-defm.td | ||
MultiClass.td | ||
MultiClassDefName.td | ||
MultiClassInherit.td | ||
MultiPat.td | ||
NestedForeach.td | ||
Paste.td | ||
RegisterBankEmitter.td | ||
RegisterEncoder.td | ||
RelTest.td | ||
SetTheory.td | ||
SiblingForeach.td | ||
Slice.td | ||
String.td | ||
SuperSubclassSameName.td | ||
TargetInstrInfo.td | ||
TargetInstrSpec.td | ||
TemplateArgRename.td | ||
Tree.td | ||
TreeNames.td | ||
TwoLevelName.td | ||
UnsetBitInit.td | ||
UnterminatedComment.td | ||
ValidIdentifiers.td | ||
arithmetic.td | ||
cast-list-initializer.td | ||
cast-typeerror.td | ||
cast.td | ||
code.td | ||
compare.td | ||
dag-functional.td | ||
defmclass.td | ||
defset-typeerror.td | ||
defset.td | ||
eq.td | ||
eqbit.td | ||
foldl.td | ||
foreach-eval.td | ||
foreach-leak.td | ||
foreach-multiclass.td | ||
foreach.td | ||
if-empty-list-arg.td | ||
if-type.td | ||
if.td | ||
ifbit.td | ||
intrinsic-long-name.td | ||
intrinsic-struct.td | ||
intrinsic-varargs.td | ||
isa.td | ||
lisp.td | ||
list-element-bitref.td | ||
listconcat.td | ||
lit.local.cfg | ||
math.td | ||
name-resolution-consistency.td | ||
nested-comment.td | ||
pr8330.td | ||
self-reference-recursion.td | ||
self-reference-typeerror.td | ||
self-reference.td | ||
size.td | ||
strconcat.td | ||
subst.td | ||
subst2.td | ||
template-arg-dependency.td | ||
trydecode-emission.td | ||
trydecode-emission2.td | ||
trydecode-emission3.td | ||
usevalname.td |