[llvm] db9b6f4 - [Tablegen] Add keyword `dump`. (#68793)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 00:26:41 PDT 2023
Author: Francesco Petrogalli
Date: 2023-10-19T09:26:36+02:00
New Revision: db9b6f4987394c56102d08566422a867cde01a6d
URL: https://github.com/llvm/llvm-project/commit/db9b6f4987394c56102d08566422a867cde01a6d
DIFF: https://github.com/llvm/llvm-project/commit/db9b6f4987394c56102d08566422a867cde01a6d.diff
LOG: [Tablegen] Add keyword `dump`. (#68793)
The keyword is intended for debugging purpose. It prints a message to
stderr.
This patch is based on code originally written by Adam Nemet, and on the
feedback received by the reviewers in
https://reviews.llvm.org/D157492.
Added:
llvm/test/TableGen/dump.td
Modified:
llvm/docs/TableGen/ProgRef.rst
llvm/include/llvm/TableGen/Error.h
llvm/include/llvm/TableGen/Record.h
llvm/lib/TableGen/Error.cpp
llvm/lib/TableGen/Record.cpp
llvm/lib/TableGen/TGLexer.cpp
llvm/lib/TableGen/TGLexer.h
llvm/lib/TableGen/TGParser.cpp
llvm/lib/TableGen/TGParser.h
Removed:
################################################################################
diff --git a/llvm/docs/TableGen/ProgRef.rst b/llvm/docs/TableGen/ProgRef.rst
index 5a52466b66ee89b..e5420a05dad78c1 100644
--- a/llvm/docs/TableGen/ProgRef.rst
+++ b/llvm/docs/TableGen/ProgRef.rst
@@ -202,10 +202,10 @@ TableGen has the following reserved keywords, which cannot be used as
identifiers::
assert bit bits class code
- dag def else false foreach
- defm defset defvar field if
- in include int let list
- multiclass string then true
+ dag def dump else false
+ foreach defm defset defvar field
+ if in include int let
+ list multiclass string then true
.. warning::
The ``field`` reserved word is deprecated, except when used with the
@@ -571,7 +571,7 @@ files.
TableGenFile: (`Statement` | `IncludeDirective`
:| `PreprocessorDirective`)*
Statement: `Assert` | `Class` | `Def` | `Defm` | `Defset` | `Defvar`
- :| `Foreach` | `If` | `Let` | `MultiClass`
+ :| `Dump` | `Foreach` | `If` | `Let` | `MultiClass`
The following sections describe each of these top-level statements.
@@ -1275,6 +1275,29 @@ be nested.
This loop defines records named ``R0``, ``R1``, ``R2``, and ``R3``, along
with ``F0``, ``F1``, ``F2``, and ``F3``.
+``dump`` --- print messages to stderr
+-------------------------------------
+
+A ``dump`` statement prints the input string to standard error
+output. It is intended for debugging purpose.
+
+* At top level, the message is printed immediately.
+
+* Within a record/class/multiclass, `dump` gets evaluated at each
+ instantiation point of the containing record.
+
+.. productionlist::
+ Dump: "dump" `string` ";"
+
+For example, it can be used in combination with `!repr` to investigate
+the values passed to a multiclass:
+
+.. code-block:: text
+
+ multiclass MC<dag s> {
+ dump "s = " # !repr(s);
+ }
+
``if`` --- select statements based on a test
--------------------------------------------
diff --git a/llvm/include/llvm/TableGen/Error.h b/llvm/include/llvm/TableGen/Error.h
index 2e639224c9c0312..04618995e0fe6d4 100644
--- a/llvm/include/llvm/TableGen/Error.h
+++ b/llvm/include/llvm/TableGen/Error.h
@@ -43,6 +43,7 @@ void PrintError(const RecordVal *RecVal, const Twine &Msg);
[[noreturn]] void PrintFatalError(const RecordVal *RecVal, const Twine &Msg);
void CheckAssert(SMLoc Loc, Init *Condition, Init *Message);
+void dumpMessage(SMLoc Loc, Init *Message);
extern SourceMgr SrcMgr;
extern unsigned ErrorsPrinted;
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index 5d6877cfacdcf19..d1023a73d606847 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -1641,6 +1641,15 @@ class Record {
: Loc(Loc), Condition(Condition), Message(Message) {}
};
+ struct DumpInfo {
+ SMLoc Loc;
+ Init *Message;
+
+ // User-defined constructor to support std::make_unique(). It can be
+ // removed in C++20 when braced initialization is supported.
+ DumpInfo(SMLoc Loc, Init *Message) : Loc(Loc), Message(Message) {}
+ };
+
private:
Init *Name;
// Location where record was instantiated, followed by the location of
@@ -1652,6 +1661,7 @@ class Record {
SmallVector<Init *, 0> TemplateArgs;
SmallVector<RecordVal, 0> Values;
SmallVector<AssertionInfo, 0> Assertions;
+ SmallVector<DumpInfo, 0> Dumps;
// All superclasses in the inheritance forest in post-order (yes, it
// must be a forest; diamond-shaped inheritance is not allowed).
@@ -1742,6 +1752,7 @@ class Record {
ArrayRef<RecordVal> getValues() const { return Values; }
ArrayRef<AssertionInfo> getAssertions() const { return Assertions; }
+ ArrayRef<DumpInfo> getDumps() const { return Dumps; }
ArrayRef<std::pair<Record *, SMRange>> getSuperClasses() const {
return SuperClasses;
@@ -1802,11 +1813,18 @@ class Record {
Assertions.push_back(AssertionInfo(Loc, Condition, Message));
}
+ void addDump(SMLoc Loc, Init *Message) {
+ Dumps.push_back(DumpInfo(Loc, Message));
+ }
+
void appendAssertions(const Record *Rec) {
Assertions.append(Rec->Assertions);
}
+ void appendDumps(const Record *Rec) { Dumps.append(Rec->Dumps); }
+
void checkRecordAssertions();
+ void emitRecordDumps();
void checkUnusedTemplateArgs();
bool isSubClassOf(const Record *R) const {
diff --git a/llvm/lib/TableGen/Error.cpp b/llvm/lib/TableGen/Error.cpp
index ebe9129ebaeb59c..dabb265ef80ca1f 100644
--- a/llvm/lib/TableGen/Error.cpp
+++ b/llvm/lib/TableGen/Error.cpp
@@ -170,4 +170,11 @@ void CheckAssert(SMLoc Loc, Init *Condition, Init *Message) {
}
}
+// Dump a message to stderr.
+void dumpMessage(SMLoc Loc, Init *Message) {
+ auto *MessageInit = dyn_cast<StringInit>(Message);
+ assert(MessageInit && "no debug message to print");
+ PrintNote(Loc, MessageInit->getValue());
+}
+
} // end namespace llvm
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 24b48b453e63e55..675969003ab3cb4 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -806,9 +806,12 @@ Init *UnOpInit::Fold(Record *CurRec, bool IsFinal) const {
OS << *Def->getDef();
OS.flush();
return StringInit::get(RK, S);
- }
- // Otherwise, print the value of the variable.
- else {
+ } else {
+ // Otherwise, print the value of the variable.
+ //
+ // NOTE: we could recursively !repr the elements of a list,
+ // but that could produce a lot of output when printing a
+ // defset.
return StringInit::get(RK, LHS->getAsString());
}
}
@@ -2272,6 +2275,9 @@ DefInit *VarDefInit::instantiate() {
// Copy assertions from class to instance.
NewRec->appendAssertions(Class);
+ // Copy dumps from class to instance.
+ NewRec->appendDumps(Class);
+
// Substitute and resolve template arguments
ArrayRef<Init *> TArgs = Class->getTemplateArgs();
MapResolver R(NewRec);
@@ -2306,6 +2312,9 @@ DefInit *VarDefInit::instantiate() {
// Check the assertions.
NewRec->checkRecordAssertions();
+ // Check the assertions.
+ NewRec->emitRecordDumps();
+
Def = DefInit::get(NewRec);
}
@@ -2863,6 +2872,11 @@ void Record::resolveReferences(Resolver &R, const RecordVal *SkipVal) {
Value = Assertion.Message->resolveReferences(R);
Assertion.Message = Value;
}
+ // Resolve the dump expressions.
+ for (auto &Dump : Dumps) {
+ Init *Value = Dump.Message->resolveReferences(R);
+ Dump.Message = Value;
+ }
}
void Record::resolveReferences(Init *NewName) {
@@ -3119,6 +3133,16 @@ void Record::checkRecordAssertions() {
}
}
+void Record::emitRecordDumps() {
+ RecordResolver R(*this);
+ R.setFinal(true);
+
+ for (const auto &Dump : getDumps()) {
+ Init *Message = Dump.Message->resolveReferences(R);
+ dumpMessage(Dump.Loc, Message);
+ }
+}
+
// Report a warning if the record has unused template arguments.
void Record::checkUnusedTemplateArgs() {
for (const Init *TA : getTemplateArgs()) {
diff --git a/llvm/lib/TableGen/TGLexer.cpp b/llvm/lib/TableGen/TGLexer.cpp
index d5140e91fce9e94..c811a67d930d481 100644
--- a/llvm/lib/TableGen/TGLexer.cpp
+++ b/llvm/lib/TableGen/TGLexer.cpp
@@ -346,31 +346,32 @@ tgtok::TokKind TGLexer::LexIdentifier() {
StringRef Str(IdentStart, CurPtr-IdentStart);
tgtok::TokKind Kind = StringSwitch<tgtok::TokKind>(Str)
- .Case("int", tgtok::Int)
- .Case("bit", tgtok::Bit)
- .Case("bits", tgtok::Bits)
- .Case("string", tgtok::String)
- .Case("list", tgtok::List)
- .Case("code", tgtok::Code)
- .Case("dag", tgtok::Dag)
- .Case("class", tgtok::Class)
- .Case("def", tgtok::Def)
- .Case("true", tgtok::TrueVal)
- .Case("false", tgtok::FalseVal)
- .Case("foreach", tgtok::Foreach)
- .Case("defm", tgtok::Defm)
- .Case("defset", tgtok::Defset)
- .Case("multiclass", tgtok::MultiClass)
- .Case("field", tgtok::Field)
- .Case("let", tgtok::Let)
- .Case("in", tgtok::In)
- .Case("defvar", tgtok::Defvar)
- .Case("include", tgtok::Include)
- .Case("if", tgtok::If)
- .Case("then", tgtok::Then)
- .Case("else", tgtok::ElseKW)
- .Case("assert", tgtok::Assert)
- .Default(tgtok::Id);
+ .Case("int", tgtok::Int)
+ .Case("bit", tgtok::Bit)
+ .Case("bits", tgtok::Bits)
+ .Case("string", tgtok::String)
+ .Case("list", tgtok::List)
+ .Case("code", tgtok::Code)
+ .Case("dag", tgtok::Dag)
+ .Case("class", tgtok::Class)
+ .Case("def", tgtok::Def)
+ .Case("true", tgtok::TrueVal)
+ .Case("false", tgtok::FalseVal)
+ .Case("foreach", tgtok::Foreach)
+ .Case("defm", tgtok::Defm)
+ .Case("defset", tgtok::Defset)
+ .Case("multiclass", tgtok::MultiClass)
+ .Case("field", tgtok::Field)
+ .Case("let", tgtok::Let)
+ .Case("in", tgtok::In)
+ .Case("defvar", tgtok::Defvar)
+ .Case("include", tgtok::Include)
+ .Case("if", tgtok::If)
+ .Case("then", tgtok::Then)
+ .Case("else", tgtok::ElseKW)
+ .Case("assert", tgtok::Assert)
+ .Case("dump", tgtok::Dump)
+ .Default(tgtok::Id);
// A couple of tokens require special processing.
switch (Kind) {
diff --git a/llvm/lib/TableGen/TGLexer.h b/llvm/lib/TableGen/TGLexer.h
index 4429c91b7c9cf76..2e2aa59f344083d 100644
--- a/llvm/lib/TableGen/TGLexer.h
+++ b/llvm/lib/TableGen/TGLexer.h
@@ -98,6 +98,7 @@ enum TokKind {
Defm,
Defset,
Defvar,
+ Dump,
Foreach,
If,
Let,
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 2e61925f55651ea..7d8f91cf1222a6d 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -313,6 +313,9 @@ bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) {
// Copy the subclass record's assertions to the new record.
CurRec->appendAssertions(SC);
+ // Copy the subclass record's dumps to the new record.
+ CurRec->appendDumps(SC);
+
Init *Name;
if (CurRec->isClass())
Name = VarInit::get(QualifiedNameOfImplicitName(*CurRec),
@@ -376,7 +379,7 @@ bool TGParser::AddSubMultiClass(MultiClass *CurMC,
/// Add a record, foreach loop, or assertion to the current context.
bool TGParser::addEntry(RecordsEntry E) {
- assert((!!E.Rec + !!E.Loop + !!E.Assertion) == 1 &&
+ assert((!!E.Rec + !!E.Loop + !!E.Assertion + !!E.Dump) == 1 &&
"RecordsEntry has invalid number of items");
// If we are parsing a loop, add it to the loop's entries.
@@ -404,6 +407,11 @@ bool TGParser::addEntry(RecordsEntry E) {
return false;
}
+ if (E.Dump) {
+ dumpMessage(E.Dump->Loc, E.Dump->Message);
+ return false;
+ }
+
// It must be a record, so finish it off.
return addDefOne(std::move(E.Rec));
}
@@ -498,6 +506,18 @@ bool TGParser::resolve(const std::vector<RecordsEntry> &Source,
else
CheckAssert(E.Assertion->Loc, Condition, Message);
+ } else if (E.Dump) {
+ MapResolver R;
+ for (const auto &S : Substs)
+ R.set(S.first, S.second);
+ Init *Message = E.Dump->Message->resolveReferences(R);
+
+ if (Dest)
+ Dest->push_back(
+ std::make_unique<Record::DumpInfo>(E.Dump->Loc, Message));
+ else
+ dumpMessage(E.Dump->Loc, Message);
+
} else {
auto Rec = std::make_unique<Record>(*E.Rec);
if (Loc)
@@ -545,6 +565,9 @@ bool TGParser::addDefOne(std::unique_ptr<Record> Rec) {
// Check the assertions.
Rec->checkRecordAssertions();
+ // Run the dumps.
+ Rec->emitRecordDumps();
+
// If ObjectBody has template arguments, it's an error.
assert(Rec->getTemplateArgs().empty() && "How'd this get template args?");
@@ -3405,6 +3428,7 @@ bool TGParser::ParseTemplateArgList(Record *CurRec) {
/// BodyItem ::= Declaration ';'
/// BodyItem ::= LET ID OptionalBitList '=' Value ';'
/// BodyItem ::= Defvar
+/// BodyItem ::= Dump
/// BodyItem ::= Assert
///
bool TGParser::ParseBodyItem(Record *CurRec) {
@@ -3414,6 +3438,9 @@ bool TGParser::ParseBodyItem(Record *CurRec) {
if (Lex.getCode() == tgtok::Defvar)
return ParseDefvar(CurRec);
+ if (Lex.getCode() == tgtok::Dump)
+ return ParseDump(nullptr, CurRec);
+
if (Lex.getCode() != tgtok::Let) {
if (!ParseDeclaration(CurRec, false))
return true;
@@ -3510,6 +3537,10 @@ bool TGParser::ApplyLetStack(RecordsEntry &Entry) {
if (Entry.Assertion)
return false;
+ // Let bindings are not applied to dumps.
+ if (Entry.Dump)
+ return false;
+
for (auto &E : Entry.Loop->Entries) {
if (ApplyLetStack(E))
return true;
@@ -4090,13 +4121,14 @@ bool TGParser::ParseMultiClass() {
while (Lex.getCode() != tgtok::r_brace) {
switch (Lex.getCode()) {
default:
- return TokError("expected 'assert', 'def', 'defm', 'defvar', "
+ return TokError("expected 'assert', 'def', 'defm', 'defvar', 'dump', "
"'foreach', 'if', or 'let' in multiclass body");
case tgtok::Assert:
case tgtok::Def:
case tgtok::Defm:
case tgtok::Defvar:
+ case tgtok::Dump:
case tgtok::Foreach:
case tgtok::If:
case tgtok::Let:
@@ -4240,15 +4272,18 @@ bool TGParser::ParseDefm(MultiClass *CurMultiClass) {
/// Object ::= Defset
/// Object ::= Defvar
/// Object ::= Assert
+/// Object ::= Dump
bool TGParser::ParseObject(MultiClass *MC) {
switch (Lex.getCode()) {
default:
return TokError(
- "Expected assert, class, def, defm, defset, foreach, if, or let");
+ "Expected assert, class, def, defm, defset, dump, foreach, if, or let");
case tgtok::Assert: return ParseAssert(MC);
case tgtok::Def: return ParseDef(MC);
case tgtok::Defm: return ParseDefm(MC);
case tgtok::Defvar: return ParseDefvar();
+ case tgtok::Dump:
+ return ParseDump(MC);
case tgtok::Foreach: return ParseForeach(MC);
case tgtok::If: return ParseIf(MC);
case tgtok::Let: return ParseTopLevelLet(MC);
@@ -4359,3 +4394,30 @@ LLVM_DUMP_METHOD void MultiClass::dump() const {
E.dump();
}
#endif
+
+bool TGParser::ParseDump(MultiClass *CurMultiClass, Record *CurRec) {
+ // Location of the `dump` statement.
+ SMLoc Loc = Lex.getLoc();
+ assert(Lex.getCode() == tgtok::Dump && "Unknown tok");
+ Lex.Lex(); // eat the operation
+
+ Init *Message = ParseValue(CurRec);
+ if (!Message)
+ return true;
+
+ // Allow to use dump directly on `defvar` and `def`, by wrapping
+ // them with a `!repl`.
+ if (isa<DefInit>(Message))
+ Message = UnOpInit::get(UnOpInit::REPR, Message, StringRecTy::get(Records))
+ ->Fold(CurRec);
+
+ if (!consume(tgtok::semi))
+ return TokError("expected ';'");
+
+ if (CurRec)
+ CurRec->addDump(Loc, Message);
+ else
+ addEntry(std::make_unique<Record::DumpInfo>(Loc, Message));
+
+ return false;
+}
diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h
index d42cdad88a843da..c5365ff2709243f 100644
--- a/llvm/lib/TableGen/TGParser.h
+++ b/llvm/lib/TableGen/TGParser.h
@@ -41,6 +41,7 @@ struct RecordsEntry {
std::unique_ptr<Record> Rec;
std::unique_ptr<ForeachLoop> Loop;
std::unique_ptr<Record::AssertionInfo> Assertion;
+ std::unique_ptr<Record::DumpInfo> Dump;
void dump() const;
@@ -49,6 +50,8 @@ struct RecordsEntry {
RecordsEntry(std::unique_ptr<ForeachLoop> Loop) : Loop(std::move(Loop)) {}
RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion)
: Assertion(std::move(Assertion)) {}
+ RecordsEntry(std::unique_ptr<Record::DumpInfo> Dump)
+ : Dump(std::move(Dump)) {}
};
/// ForeachLoop - Record the iteration state associated with a for loop.
@@ -262,6 +265,7 @@ class TGParser {
bool ParseDef(MultiClass *CurMultiClass);
bool ParseDefset();
bool ParseDefvar(Record *CurRec = nullptr);
+ bool ParseDump(MultiClass *CurMultiClass, Record *CurRec = nullptr);
bool ParseForeach(MultiClass *CurMultiClass);
bool ParseIf(MultiClass *CurMultiClass);
bool ParseIfBody(MultiClass *CurMultiClass, StringRef Kind);
diff --git a/llvm/test/TableGen/dump.td b/llvm/test/TableGen/dump.td
new file mode 100644
index 000000000000000..633e73802ffa3ea
--- /dev/null
+++ b/llvm/test/TableGen/dump.td
@@ -0,0 +1,103 @@
+// RUN: llvm-tblgen %s -o - 2>&1 >/dev/null | FileCheck %s -DFILE=%s
+
+// CHECK: [[FILE]]:[[@LINE+1]]:1: note: Debug message
+dump "Debug message";
+
+def op;
+class A {
+ string A = "some text";
+ dag X =(op op);
+}
+def a : A;
+// CHECK: [[FILE]]:[[@LINE+5]]:1: note: The Value of A is:
+// CHECK-NEXT: a { // A
+// CHECK-NEXT: string A = "some text";
+// CHECK-NEXT: dag X = (op op);
+// CHECK-NEXT: }
+dump "The Value of A is: \n" # !repr(a);
+
+def b : A;
+// CHECK: [[FILE]]:[[@LINE+4]]:1: note: b { // A
+// CHECK-NEXT: string A = "some text";
+// CHECK-NEXT: dag X = (op op);
+// CHECK-NEXT: }
+dump b;
+
+defvar value_A = "some other text";
+// CHECK: [[FILE]]:[[@LINE+1]]:1: note: some other text
+dump value_A;
+
+defvar value_B = 12;
+def X;
+// CHECK: [[FILE]]:[[@LINE+3]]:1: note: got a pair of values ["some other text" : 12], and an empty record:
+// CHECK-NEXT: X {
+// CHECK-NEXT: }
+dump "got a pair of values [" # !repr(value_A) # " : " # !repr(value_B) # "], " # "and an empty record:\n" # !repr(X);
+
+multiclass MC<dag s> {
+// CHECK: [[FILE]]:[[@LINE+1]]:3: note: s = (op a)
+ dump "s = " # !repr(s);
+// CHECK: [[FILE]]:[[@LINE+4]]:3: note: args[0] = a { // A
+// CHECK-NEXT: string A = "some text";
+// CHECK-NEXT: dag X = (op op);
+// CHECK-NEXT: }
+ dump "args[0] = " # !repr(!getdagarg<A>(s,0));
+ def A;
+}
+defm X : MC<(op a)>;
+
+multiclass MMC<dag s> {
+// CHECK: [[FILE]]:[[@LINE+1]]:3: note: the operand of s is op
+ dump "the operand of s is " # !getdagop(s);
+// CHECK: [[FILE]]:[[@LINE-13]]:3: note: s = (op a, a)
+// CHECK: [[FILE]]:[[@LINE-9]]:3: note: args[0] = a { // A
+// CHECK-NEXT: string A = "some text";
+// CHECK-NEXT: dag X = (op op);
+// CHECK-NEXT: }
+ defm : MC<s>;
+}
+
+defm XX : MMC<(op a, a)>;
+
+
+foreach i = [-1, 2] in {
+// CHECK: [[FILE]]:[[@LINE+4]]:3: note: i = -1 (negative)
+// CHECK: [[FILE]]:[[@LINE+8]]:5: note: i + 1 <= 0
+// CHECK: [[FILE]]:[[@LINE+2]]:3: note: i = 2 (positive)
+// CHECK: [[FILE]]:[[@LINE+4]]:5: note: i + 1 > 0 (i + 1 = 3)
+ dump "i = " # !repr(i) # !if(!ge(i,0), " (positive)", " (negative)");
+ defvar ip1 = !add(i, 1);
+ if !gt(ip1,0) then {
+ dump "i + 1 > 0 (i + 1 = " # !repr(ip1) # ")";
+ } else {
+ dump "i + 1 <= 0" ;
+ }
+}
+
+class Code<code val> {
+ dump "val = " # !repr(val);
+ code Val = val;
+ int number = 0;
+}
+// CHECK: [[FILE]]:[[@LINE-4]]:3: note: val = [{a = a +1;}]
+def IncrementA : Code<[{a = a +1;}]>;
+class InheritFromCode : Code<[{f(x);}]>{
+ let number = 33;
+ dump "number = " # !repr(number);
+}
+// CHECK: [[FILE]]:[[@LINE-10]]:3: note: val = [{f(x);}]
+// CHECK: [[FILE]]:[[@LINE-3]]:3: note: number = 33
+def ModeCode : InheritFromCode;
+
+
+class BaseClassForSet;
+multiclass DefineSubSet {
+ def _One : BaseClassForSet;
+ def _Two : BaseClassForSet;
+}
+defset list<BaseClassForSet> TheSet = {
+defm Subset: DefineSubSet;
+def Three : BaseClassForSet;
+}
+// CHECK: [[FILE]]:[[@LINE+1]]:1: note: TheSet = [Subset_One, Subset_Two, Three]
+dump "TheSet = " # !repr(TheSet);
More information about the llvm-commits
mailing list