diff options
author | Jacques Pienaar <jpienaar@google.com> | 2023-04-24 11:53:58 -0700 |
---|---|---|
committer | Jacques Pienaar <jpienaar@google.com> | 2023-04-24 11:53:58 -0700 |
commit | 09115580056fc57d5cdaa1de20631a838a4ea1c4 (patch) | |
tree | 822b73e5192eedae1c3a2a9b1ae4f961dcad7a22 /utils | |
parent | 8e091b1220e09c0c1000ed676c1c92a09e871129 (diff) | |
download | llvm-09115580056fc57d5cdaa1de20631a838a4ea1c4.tar.gz |
[mlir] Dialect type/attr bytecode read/write generator.
Tool to help generate dialect bytecode Attribute & Type reader/writing.
Show usage by flipping builtin dialect.
It helps reduce boilerplate when writing dialect bytecode attribute and
type readers/writers. It is not an attempt at a generic spec mechanism
but rather practically focussing on boilerplate reduction while also
considering that it need not be the only in memory format and make it
relatively easy to change.
There should be some cleanup in follow up as we expand to more dialects.
Differential Revision: https://reviews.llvm.org/D144820
Diffstat (limited to 'utils')
-rw-r--r-- | utils/bazel/llvm-project-overlay/mlir/BUILD.bazel | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index 881a12426baf..fc189556b864 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -91,6 +91,7 @@ td_library( ], includes = ["include"], deps = [ + ":BytecodeTdFiles", ":CallInterfacesTdFiles", ":CastInterfacesTdFiles", ":DataLayoutInterfacesTdFiles", @@ -118,6 +119,20 @@ gentbl_cc_library( ) gentbl_cc_library( + name = "BuiltinDialectBytecodeGen", + strip_include_prefix = "include", + tbl_outs = [ + ( + ["-gen-bytecode", "-bytecode-dialect=Builtin"], + "include/mlir/IR/BuiltinDialectBytecode.cpp.inc", + ), + ], + tblgen = ":mlir-tblgen", + td_file = "include/mlir/IR/BuiltinDialectBytecode.td", + deps = [":BuiltinDialectTdFiles"], +) + +gentbl_cc_library( name = "BuiltinAttributesIncGen", strip_include_prefix = "include", tbl_outs = [ @@ -277,6 +292,7 @@ cc_library( deps = [ ":BuiltinAttributeInterfacesIncGen", ":BuiltinAttributesIncGen", + ":BuiltinDialectBytecodeGen", ":BuiltinDialectIncGen", ":BuiltinLocationAttributesIncGen", ":BuiltinOpsIncGen", @@ -930,6 +946,12 @@ td_library( ) td_library( + name = "BytecodeTdFiles", + srcs = ["include/mlir/IR/BytecodeBase.td"], + includes = ["include"], +) + +td_library( name = "CallInterfacesTdFiles", srcs = ["include/mlir/Interfaces/CallInterfaces.td"], includes = ["include"], |