Skip to content

Commit e813750

Browse files
authored
[NFC] Rename variable recordKeeper to records (#110989)
1 parent 241f936 commit e813750

17 files changed

+128
-146
lines changed

mlir/include/mlir/TableGen/GenInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class RecordKeeper;
2121
namespace mlir {
2222

2323
/// Generator function to invoke.
24-
using GenFunction = std::function<bool(const llvm::RecordKeeper &recordKeeper,
25-
raw_ostream &os)>;
24+
using GenFunction =
25+
std::function<bool(const llvm::RecordKeeper &records, raw_ostream &os)>;
2626

2727
/// Structure to group information about a generator (argument to invoke via
2828
/// mlir-tblgen, description, and generator function).
@@ -34,9 +34,9 @@ class GenInfo {
3434
: arg(arg), description(description), generator(std::move(generator)) {}
3535

3636
/// Invokes the generator and returns whether the generator failed.
37-
bool invoke(const llvm::RecordKeeper &recordKeeper, raw_ostream &os) const {
37+
bool invoke(const llvm::RecordKeeper &records, raw_ostream &os) const {
3838
assert(generator && "Cannot call generator with null generator");
39-
return generator(recordKeeper, os);
39+
return generator(records, os);
4040
}
4141

4242
/// Returns the command line option that may be passed to 'mlir-tblgen' to

mlir/tools/mlir-tblgen/DialectGen.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,10 @@ static void emitDialectDecl(Dialect &dialect, raw_ostream &os) {
297297
<< "::" << dialect.getCppClassName() << ")\n";
298298
}
299299

300-
static bool emitDialectDecls(const RecordKeeper &recordKeeper,
301-
raw_ostream &os) {
302-
emitSourceFileHeader("Dialect Declarations", os, recordKeeper);
300+
static bool emitDialectDecls(const RecordKeeper &records, raw_ostream &os) {
301+
emitSourceFileHeader("Dialect Declarations", os, records);
303302

304-
auto dialectDefs = recordKeeper.getAllDerivedDefinitions("Dialect");
303+
auto dialectDefs = records.getAllDerivedDefinitions("Dialect");
305304
if (dialectDefs.empty())
306305
return false;
307306

@@ -342,7 +341,7 @@ static const char *const dialectDestructorStr = R"(
342341
343342
)";
344343

345-
static void emitDialectDef(Dialect &dialect, const RecordKeeper &recordKeeper,
344+
static void emitDialectDef(Dialect &dialect, const RecordKeeper &records,
346345
raw_ostream &os) {
347346
std::string cppClassName = dialect.getCppClassName();
348347

@@ -390,18 +389,18 @@ static void emitDialectDef(Dialect &dialect, const RecordKeeper &recordKeeper,
390389
os << llvm::formatv(dialectDestructorStr, cppClassName);
391390
}
392391

393-
static bool emitDialectDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
394-
emitSourceFileHeader("Dialect Definitions", os, recordKeeper);
392+
static bool emitDialectDefs(const RecordKeeper &records, raw_ostream &os) {
393+
emitSourceFileHeader("Dialect Definitions", os, records);
395394

396-
auto dialectDefs = recordKeeper.getAllDerivedDefinitions("Dialect");
395+
auto dialectDefs = records.getAllDerivedDefinitions("Dialect");
397396
if (dialectDefs.empty())
398397
return false;
399398

400399
SmallVector<Dialect> dialects(dialectDefs.begin(), dialectDefs.end());
401400
std::optional<Dialect> dialect = findDialectToGenerate(dialects);
402401
if (!dialect)
403402
return true;
404-
emitDialectDef(*dialect, recordKeeper, os);
403+
emitDialectDef(*dialect, records, os);
405404
return false;
406405
}
407406

mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using llvm::RecordKeeper;
4242
// Clause record in OMP.td. This name can be used to specify the type of the
4343
// OpenMP operation's operand. The allowedClauseValues field provides the list
4444
// of ClauseValues which are part of the enumeration.
45-
static bool emitDecls(const RecordKeeper &recordKeeper, llvm::StringRef dialect,
45+
static bool emitDecls(const RecordKeeper &records, llvm::StringRef dialect,
4646
raw_ostream &os) {
4747
// A dialect must be selected for the generated attributes.
4848
if (dialect.empty()) {
@@ -51,10 +51,10 @@ static bool emitDecls(const RecordKeeper &recordKeeper, llvm::StringRef dialect,
5151
}
5252

5353
const auto directiveLanguages =
54-
recordKeeper.getAllDerivedDefinitions("DirectiveLanguage");
54+
records.getAllDerivedDefinitions("DirectiveLanguage");
5555
assert(!directiveLanguages.empty() && "DirectiveLanguage missing.");
5656

57-
for (const Clause c : recordKeeper.getAllDerivedDefinitions("Clause")) {
57+
for (const Clause c : records.getAllDerivedDefinitions("Clause")) {
5858
const auto &clauseVals = c.getClauseVals();
5959
if (clauseVals.empty())
6060
continue;

mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ static bool emitDialectEnumAttributeBuilder(StringRef attrDefName,
132132

133133
/// Emits Python bindings for all enums in the record keeper. Returns
134134
/// `false` on success, `true` on failure.
135-
static bool emitPythonEnums(const RecordKeeper &recordKeeper, raw_ostream &os) {
135+
static bool emitPythonEnums(const RecordKeeper &records, raw_ostream &os) {
136136
os << fileHeader;
137137
for (const Record *it :
138-
recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo")) {
138+
records.getAllDerivedDefinitionsIfDefined("EnumAttrInfo")) {
139139
EnumAttr enumAttr(*it);
140140
emitEnumClass(enumAttr, os);
141141
emitAttributeBuilder(enumAttr, os);
142142
}
143143
for (const Record *it :
144-
recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttr")) {
144+
records.getAllDerivedDefinitionsIfDefined("EnumAttr")) {
145145
AttrOrTypeDef attr(&*it);
146146
if (!attr.getMnemonic()) {
147147
llvm::errs() << "enum case " << attr

mlir/tools/mlir-tblgen/EnumsGen.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,11 @@ class {1} : public ::mlir::{2} {
641641
emitDenseMapInfo(qualName, underlyingType, cppNamespace, os);
642642
}
643643

644-
static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
645-
llvm::emitSourceFileHeader("Enum Utility Declarations", os, recordKeeper);
644+
static bool emitEnumDecls(const RecordKeeper &records, raw_ostream &os) {
645+
llvm::emitSourceFileHeader("Enum Utility Declarations", os, records);
646646

647647
for (const Record *def :
648-
recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo"))
648+
records.getAllDerivedDefinitionsIfDefined("EnumAttrInfo"))
649649
emitEnumDecl(*def, os);
650650

651651
return false;
@@ -679,11 +679,11 @@ static void emitEnumDef(const Record &enumDef, raw_ostream &os) {
679679
os << "\n";
680680
}
681681

682-
static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
683-
llvm::emitSourceFileHeader("Enum Utility Definitions", os, recordKeeper);
682+
static bool emitEnumDefs(const RecordKeeper &records, raw_ostream &os) {
683+
llvm::emitSourceFileHeader("Enum Utility Definitions", os, records);
684684

685685
for (const Record *def :
686-
recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo"))
686+
records.getAllDerivedDefinitionsIfDefined("EnumAttrInfo"))
687687
emitEnumDef(*def, os);
688688

689689
return false;

mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ static LogicalResult emitOneBuilder(const Record &record, raw_ostream &os) {
177177

178178
// Emit all builders. Returns false on success because of the generator
179179
// registration requirements.
180-
static bool emitBuilders(const RecordKeeper &recordKeeper, raw_ostream &os) {
181-
for (const Record *def :
182-
recordKeeper.getAllDerivedDefinitions("LLVM_OpBase")) {
180+
static bool emitBuilders(const RecordKeeper &records, raw_ostream &os) {
181+
for (const Record *def : records.getAllDerivedDefinitions("LLVM_OpBase")) {
183182
if (failed(emitOneBuilder(*def, os)))
184183
return true;
185184
}
@@ -305,15 +304,14 @@ static LogicalResult emitOneMLIRBuilder(const Record &record, raw_ostream &os,
305304

306305
// Emit all intrinsic MLIR builders. Returns false on success because of the
307306
// generator registration requirements.
308-
static bool emitIntrMLIRBuilders(const RecordKeeper &recordKeeper,
309-
raw_ostream &os) {
307+
static bool emitIntrMLIRBuilders(const RecordKeeper &records, raw_ostream &os) {
310308
// Emit condition to check if "llvmEnumName" matches the intrinsic id.
311309
auto emitIntrCond = [](const Record &record) {
312310
return "intrinsicID == llvm::Intrinsic::" +
313311
record.getValueAsString("llvmEnumName");
314312
};
315313
for (const Record *def :
316-
recordKeeper.getAllDerivedDefinitions("LLVM_IntrOpBase")) {
314+
records.getAllDerivedDefinitions("LLVM_IntrOpBase")) {
317315
if (failed(emitOneMLIRBuilder(*def, os, emitIntrCond)))
318316
return true;
319317
}
@@ -322,15 +320,13 @@ static bool emitIntrMLIRBuilders(const RecordKeeper &recordKeeper,
322320

323321
// Emit all op builders. Returns false on success because of the
324322
// generator registration requirements.
325-
static bool emitOpMLIRBuilders(const RecordKeeper &recordKeeper,
326-
raw_ostream &os) {
323+
static bool emitOpMLIRBuilders(const RecordKeeper &records, raw_ostream &os) {
327324
// Emit condition to check if "llvmInstName" matches the instruction opcode.
328325
auto emitOpcodeCond = [](const Record &record) {
329326
return "inst->getOpcode() == llvm::Instruction::" +
330327
record.getValueAsString("llvmInstName");
331328
};
332-
for (const Record *def :
333-
recordKeeper.getAllDerivedDefinitions("LLVM_OpBase")) {
329+
for (const Record *def : records.getAllDerivedDefinitions("LLVM_OpBase")) {
334330
if (failed(emitOneMLIRBuilder(*def, os, emitOpcodeCond)))
335331
return true;
336332
}
@@ -536,17 +532,15 @@ static void emitOneCEnumFromConversion(const Record *record, raw_ostream &os) {
536532
// Emits conversion functions between MLIR enum attribute case and corresponding
537533
// LLVM API enumerants for all registered LLVM dialect enum attributes.
538534
template <bool ConvertTo>
539-
static bool emitEnumConversionDefs(const RecordKeeper &recordKeeper,
535+
static bool emitEnumConversionDefs(const RecordKeeper &records,
540536
raw_ostream &os) {
541-
for (const Record *def :
542-
recordKeeper.getAllDerivedDefinitions("LLVM_EnumAttr"))
537+
for (const Record *def : records.getAllDerivedDefinitions("LLVM_EnumAttr"))
543538
if (ConvertTo)
544539
emitOneEnumToConversion(def, os);
545540
else
546541
emitOneEnumFromConversion(def, os);
547542

548-
for (const Record *def :
549-
recordKeeper.getAllDerivedDefinitions("LLVM_CEnumAttr"))
543+
for (const Record *def : records.getAllDerivedDefinitions("LLVM_CEnumAttr"))
550544
if (ConvertTo)
551545
emitOneCEnumToConversion(def, os);
552546
else
@@ -562,10 +556,9 @@ static void emitOneIntrinsic(const Record &record, raw_ostream &os) {
562556

563557
// Emit the list of LLVM IR intrinsics identifiers that are convertible to a
564558
// matching MLIR LLVM dialect intrinsic operation.
565-
static bool emitConvertibleIntrinsics(const RecordKeeper &recordKeeper,
559+
static bool emitConvertibleIntrinsics(const RecordKeeper &records,
566560
raw_ostream &os) {
567-
for (const Record *def :
568-
recordKeeper.getAllDerivedDefinitions("LLVM_IntrOpBase"))
561+
for (const Record *def : records.getAllDerivedDefinitions("LLVM_IntrOpBase"))
569562
emitOneIntrinsic(*def, os);
570563

571564
return false;

mlir/tools/mlir-tblgen/OmpOpGen.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ static void genOperandsDef(const Record *op, raw_ostream &os) {
328328

329329
/// Verify that all properties of `OpenMP_Clause`s of records deriving from
330330
/// `OpenMP_Op`s have been inherited by the latter.
331-
static bool verifyDecls(const RecordKeeper &recordKeeper, raw_ostream &) {
332-
for (const Record *op : recordKeeper.getAllDerivedDefinitions("OpenMP_Op")) {
331+
static bool verifyDecls(const RecordKeeper &records, raw_ostream &) {
332+
for (const Record *op : records.getAllDerivedDefinitions("OpenMP_Op")) {
333333
for (const Record *clause : op->getValueAsListOfDefs("clauseList"))
334334
verifyClause(op, clause);
335335
}
@@ -341,16 +341,15 @@ static bool verifyDecls(const RecordKeeper &recordKeeper, raw_ostream &) {
341341
/// `OpenMP_Clause` definitions and aggregate them into operation-specific
342342
/// structures according to the `clauses` argument of each definition deriving
343343
/// from `OpenMP_Op`.
344-
static bool genClauseOps(const RecordKeeper &recordKeeper, raw_ostream &os) {
344+
static bool genClauseOps(const RecordKeeper &records, raw_ostream &os) {
345345
mlir::tblgen::NamespaceEmitter ns(os, "mlir::omp");
346-
for (const Record *clause :
347-
recordKeeper.getAllDerivedDefinitions("OpenMP_Clause"))
346+
for (const Record *clause : records.getAllDerivedDefinitions("OpenMP_Clause"))
348347
genClauseOpsStruct(clause, os);
349348

350349
// Produce base mixin class.
351350
os << baseMixinClass;
352351

353-
for (const Record *op : recordKeeper.getAllDerivedDefinitions("OpenMP_Op"))
352+
for (const Record *op : records.getAllDerivedDefinitions("OpenMP_Op"))
354353
genOperandsDef(op, os);
355354

356355
return false;

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4498,7 +4498,7 @@ void OpOperandAdaptorEmitter::emitDef(
44984498

44994499
/// Emit the class declarations or definitions for the given op defs.
45004500
static void
4501-
emitOpClasses(const RecordKeeper &recordKeeper,
4501+
emitOpClasses(const RecordKeeper &records,
45024502
const std::vector<const Record *> &defs, raw_ostream &os,
45034503
const StaticVerifierFunctionEmitter &staticVerifierEmitter,
45044504
bool emitDecl) {
@@ -4535,7 +4535,7 @@ emitOpClasses(const RecordKeeper &recordKeeper,
45354535
}
45364536

45374537
/// Emit the declarations for the provided op classes.
4538-
static void emitOpClassDecls(const RecordKeeper &recordKeeper,
4538+
static void emitOpClassDecls(const RecordKeeper &records,
45394539
const std::vector<const Record *> &defs,
45404540
raw_ostream &os) {
45414541
// First emit forward declaration for each class, this allows them to refer
@@ -4550,37 +4550,37 @@ static void emitOpClassDecls(const RecordKeeper &recordKeeper,
45504550
IfDefScope scope("GET_OP_CLASSES", os);
45514551
if (defs.empty())
45524552
return;
4553-
StaticVerifierFunctionEmitter staticVerifierEmitter(os, recordKeeper);
4553+
StaticVerifierFunctionEmitter staticVerifierEmitter(os, records);
45544554
staticVerifierEmitter.collectOpConstraints(defs);
4555-
emitOpClasses(recordKeeper, defs, os, staticVerifierEmitter,
4555+
emitOpClasses(records, defs, os, staticVerifierEmitter,
45564556
/*emitDecl=*/true);
45574557
}
45584558

45594559
/// Emit the definitions for the provided op classes.
4560-
static void emitOpClassDefs(const RecordKeeper &recordKeeper,
4560+
static void emitOpClassDefs(const RecordKeeper &records,
45614561
ArrayRef<const Record *> defs, raw_ostream &os,
45624562
StringRef constraintPrefix = "") {
45634563
if (defs.empty())
45644564
return;
45654565

45664566
// Generate all of the locally instantiated methods first.
4567-
StaticVerifierFunctionEmitter staticVerifierEmitter(os, recordKeeper,
4567+
StaticVerifierFunctionEmitter staticVerifierEmitter(os, records,
45684568
constraintPrefix);
45694569
os << formatv(opCommentHeader, "Local Utility Method", "Definitions");
45704570
staticVerifierEmitter.collectOpConstraints(defs);
45714571
staticVerifierEmitter.emitOpConstraints(defs);
45724572

45734573
// Emit the classes.
4574-
emitOpClasses(recordKeeper, defs, os, staticVerifierEmitter,
4574+
emitOpClasses(records, defs, os, staticVerifierEmitter,
45754575
/*emitDecl=*/false);
45764576
}
45774577

45784578
/// Emit op declarations for all op records.
4579-
static bool emitOpDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
4580-
emitSourceFileHeader("Op Declarations", os, recordKeeper);
4579+
static bool emitOpDecls(const RecordKeeper &records, raw_ostream &os) {
4580+
emitSourceFileHeader("Op Declarations", os, records);
45814581

4582-
std::vector<const Record *> defs = getRequestedOpDefinitions(recordKeeper);
4583-
emitOpClassDecls(recordKeeper, defs, os);
4582+
std::vector<const Record *> defs = getRequestedOpDefinitions(records);
4583+
emitOpClassDecls(records, defs, os);
45844584

45854585
// If we are generating sharded op definitions, emit the sharded op
45864586
// registration hooks.
@@ -4606,7 +4606,7 @@ static bool emitOpDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
46064606

46074607
/// Generate the dialect op registration hook and the op class definitions for a
46084608
/// shard of ops.
4609-
static void emitOpDefShard(const RecordKeeper &recordKeeper,
4609+
static void emitOpDefShard(const RecordKeeper &records,
46104610
ArrayRef<const Record *> defs,
46114611
const Dialect &dialect, unsigned shardIndex,
46124612
unsigned shardCount, raw_ostream &os) {
@@ -4640,14 +4640,14 @@ static void emitOpDefShard(const RecordKeeper &recordKeeper,
46404640
os << "}\n";
46414641

46424642
// Generate the per-shard op definitions.
4643-
emitOpClassDefs(recordKeeper, defs, os, indexStr);
4643+
emitOpClassDefs(records, defs, os, indexStr);
46444644
}
46454645

46464646
/// Emit op definitions for all op records.
4647-
static bool emitOpDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
4648-
emitSourceFileHeader("Op Definitions", os, recordKeeper);
4647+
static bool emitOpDefs(const RecordKeeper &records, raw_ostream &os) {
4648+
emitSourceFileHeader("Op Definitions", os, records);
46494649

4650-
std::vector<const Record *> defs = getRequestedOpDefinitions(recordKeeper);
4650+
std::vector<const Record *> defs = getRequestedOpDefinitions(records);
46514651
SmallVector<ArrayRef<const Record *>, 4> shardedDefs;
46524652
shardOpDefinitions(defs, shardedDefs);
46534653

@@ -4662,7 +4662,7 @@ static bool emitOpDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
46624662
}
46634663
{
46644664
IfDefScope scope("GET_OP_CLASSES", os);
4665-
emitOpClassDefs(recordKeeper, defs, os);
4665+
emitOpClassDefs(records, defs, os);
46664666
}
46674667
return false;
46684668
}
@@ -4671,7 +4671,7 @@ static bool emitOpDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
46714671
return false;
46724672
Dialect dialect = Operator(defs.front()).getDialect();
46734673
for (auto [idx, value] : llvm::enumerate(shardedDefs)) {
4674-
emitOpDefShard(recordKeeper, value, dialect, idx, shardedDefs.size(), os);
4674+
emitOpDefShard(records, value, dialect, idx, shardedDefs.size(), os);
46754675
}
46764676
return false;
46774677
}

0 commit comments

Comments
 (0)