Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ getAllCppAttrConstraints(const RecordKeeper &records) {

/// Emit the declarations for the given constraints, of the form:
/// `bool <constraintCppFunctionName>(<parameterTypeName> <parameterName>);`
static void emitConstraintDecls(const std::vector<Constraint> &constraints,
static void emitConstraintDecls(ArrayRef<Constraint> constraints,
raw_ostream &os, StringRef parameterTypeName,
StringRef parameterName) {
static const char *const constraintDecl = "bool {0}({1} {2});\n";
Expand All @@ -1192,7 +1192,7 @@ static void emitAttrConstraintDecls(const RecordKeeper &records,
/// return (<condition>); }`
/// where `<condition>` is the condition template with the `self` variable
/// replaced with the `selfName` parameter.
static void emitConstraintDefs(const std::vector<Constraint> &constraints,
static void emitConstraintDefs(ArrayRef<Constraint> constraints,
raw_ostream &os, StringRef parameterTypeName,
StringRef selfName) {
static const char *const constraintDef = R"(
Expand Down
10 changes: 4 additions & 6 deletions mlir/tools/mlir-tblgen/EnumsGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,21 @@ static std::string makeIdentifier(StringRef str) {

static void emitEnumClass(const Record &enumDef, StringRef enumName,
StringRef underlyingType, StringRef description,
const std::vector<EnumCase> &enumerants,
raw_ostream &os) {
ArrayRef<EnumCase> enumerants, raw_ostream &os) {
os << "// " << description << "\n";
os << "enum class " << enumName;

if (!underlyingType.empty())
os << " : " << underlyingType;
os << " {\n";

for (const auto &enumerant : enumerants) {
for (const EnumCase &enumerant : enumerants) {
auto symbol = makeIdentifier(enumerant.getSymbol());
auto value = enumerant.getValue();
if (value >= 0) {
if (value >= 0)
os << formatv(" {0} = {1},\n", symbol, value);
} else {
else
os << formatv(" {0},\n", symbol);
}
}
os << "};\n\n";
}
Expand Down
13 changes: 5 additions & 8 deletions mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4801,11 +4801,9 @@ void OpOperandAdaptorEmitter::emitDef(
}

/// Emit the class declarations or definitions for the given op defs.
static void
emitOpClasses(const RecordKeeper &records,
const std::vector<const Record *> &defs, raw_ostream &os,
const StaticVerifierFunctionEmitter &staticVerifierEmitter,
bool emitDecl) {
static void emitOpClasses(
const RecordKeeper &records, ArrayRef<const Record *> defs, raw_ostream &os,
const StaticVerifierFunctionEmitter &staticVerifierEmitter, bool emitDecl) {
if (defs.empty())
return;

Expand Down Expand Up @@ -4840,11 +4838,10 @@ emitOpClasses(const RecordKeeper &records,

/// Emit the declarations for the provided op classes.
static void emitOpClassDecls(const RecordKeeper &records,
const std::vector<const Record *> &defs,
raw_ostream &os) {
ArrayRef<const Record *> defs, raw_ostream &os) {
// First emit forward declaration for each class, this allows them to refer
// to each others in traits for example.
for (auto *def : defs) {
for (const Record *def : defs) {
Operator op(*def);
NamespaceEmitter emitter(os, op.getCppNamespace());
std::string comments = tblgen::emitSummaryAndDescComments(
Expand Down
2 changes: 1 addition & 1 deletion mlir/tools/mlir-tblgen/TosaUtilsGen.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- TosaUtilsGen.cpp - Tosa utility generator -===//
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down