[Mlir-commits] [mlir] ba468d4 - [mlir][ods] Emit bytecode readers with generic Attribute/Type (NFC)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 24 01:07:01 PDT 2023
Author: Mogball
Date: 2023-10-24T08:06:51Z
New Revision: ba468d4dab4e528532b57144e564b2fc782035fe
URL: https://github.com/llvm/llvm-project/commit/ba468d4dab4e528532b57144e564b2fc782035fe
DIFF: https://github.com/llvm/llvm-project/commit/ba468d4dab4e528532b57144e564b2fc782035fe.diff
LOG: [mlir][ods] Emit bytecode readers with generic Attribute/Type (NFC)
This aligns the API with the builder API that allows arbitrary
attributes or types to be returned.
Added:
Modified:
mlir/test/mlir-tblgen/bytecode-reserved.td
mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
Removed:
################################################################################
diff --git a/mlir/test/mlir-tblgen/bytecode-reserved.td b/mlir/test/mlir-tblgen/bytecode-reserved.td
index 028c52927867305..1a7bcd306d075ed 100644
--- a/mlir/test/mlir-tblgen/bytecode-reserved.td
+++ b/mlir/test/mlir-tblgen/bytecode-reserved.td
@@ -2,6 +2,8 @@
include "mlir/IR/BuiltinDialectBytecode.td"
+// CHECK static ::mlir::Type readIntegerType
+
def TestDialectTypes : DialectTypes<"Test"> {
// CHECK: static Type readType
let elems = [
diff --git a/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp b/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
index 919a1804eab2d03..66a3750d7c82662 100644
--- a/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
+++ b/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
@@ -134,7 +134,7 @@ void Generator::emitParse(StringRef kind, Record &x) {
R"(static {0} read{1}(MLIRContext* context, DialectBytecodeReader &reader) )";
mlir::raw_indented_ostream os(output);
std::string returnType = getCType(&x);
- os << formatv(head, returnType, x.getName());
+ os << formatv(head, kind == "attribute" ? "::mlir::Attribute" : "::mlir::Type", x.getName());
DagInit *members = x.getValueAsDag("members");
SmallVector<std::string> argNames =
llvm::to_vector(map_range(members->getArgNames(), [](StringInit *init) {
More information about the Mlir-commits
mailing list