Skip to content

Commit ba468d4

Browse files
author
Mogball
committed
[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.
1 parent eb86de6 commit ba468d4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

mlir/test/mlir-tblgen/bytecode-reserved.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
include "mlir/IR/BuiltinDialectBytecode.td"
44

5+
// CHECK static ::mlir::Type readIntegerType
6+
57
def TestDialectTypes : DialectTypes<"Test"> {
68
// CHECK: static Type readType
79
let elems = [

mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void Generator::emitParse(StringRef kind, Record &x) {
134134
R"(static {0} read{1}(MLIRContext* context, DialectBytecodeReader &reader) )";
135135
mlir::raw_indented_ostream os(output);
136136
std::string returnType = getCType(&x);
137-
os << formatv(head, returnType, x.getName());
137+
os << formatv(head, kind == "attribute" ? "::mlir::Attribute" : "::mlir::Type", x.getName());
138138
DagInit *members = x.getValueAsDag("members");
139139
SmallVector<std::string> argNames =
140140
llvm::to_vector(map_range(members->getArgNames(), [](StringInit *init) {

0 commit comments

Comments
 (0)