aboutsummaryrefslogtreecommitdiff
path: root/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp')
-rw-r--r--mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 7e8e559..c3420d4 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -36,6 +36,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/TableGen/CodeGenHelpers.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
@@ -4855,7 +4856,7 @@ static void emitOpClassDecls(const RecordKeeper &records,
}
// Emit the op class declarations.
- IfDefScope scope("GET_OP_CLASSES", os);
+ IfDefEmitter scope(os, "GET_OP_CLASSES");
if (defs.empty())
return;
StaticVerifierFunctionEmitter staticVerifierEmitter(os, records);
@@ -4898,7 +4899,7 @@ static bool emitOpDecls(const RecordKeeper &records, raw_ostream &os) {
return false;
Dialect dialect = Operator(defs.front()).getDialect();
- NamespaceEmitter ns(os, dialect);
+ DialectNamespaceEmitter ns(os, dialect);
const char *const opRegistrationHook =
"void register{0}Operations{1}({2}::{0} *dialect);\n";
@@ -4921,7 +4922,7 @@ static void emitOpDefShard(const RecordKeeper &records,
std::string shardGuard = "GET_OP_DEFS_";
std::string indexStr = std::to_string(shardIndex);
shardGuard += indexStr;
- IfDefScope scope(shardGuard, os);
+ IfDefEmitter scope(os, shardGuard);
// Emit the op registration hook in the first shard.
const char *const opRegistrationHook =
@@ -4962,14 +4963,14 @@ static bool emitOpDefs(const RecordKeeper &records, raw_ostream &os) {
// If no shard was requested, emit the regular op list and class definitions.
if (shardedDefs.size() == 1) {
{
- IfDefScope scope("GET_OP_LIST", os);
+ IfDefEmitter scope(os, "GET_OP_LIST");
interleave(
defs, os,
[&](const Record *def) { os << Operator(def).getQualCppClassName(); },
",\n");
}
{
- IfDefScope scope("GET_OP_CLASSES", os);
+ IfDefEmitter scope(os, "GET_OP_CLASSES");
emitOpClassDefs(records, defs, os);
}
return false;