# Description:
# MLIR Tutorial
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
td_library(
name = "ToyOpsTdFiles",
srcs = [
"include/toy/Ops.td",
],
includes = ["include"],
deps = [
"//mlir:FunctionInterfacesTdFiles",
"//mlir:OpBaseTdFiles",
"//mlir:SideEffectInterfacesTdFiles",
],
)
gentbl_cc_library(
name = "ToyOpsIncGen",
tbl_outs = [
(
["-gen-op-decls"],
"include/toy/Ops.h.inc",
),
(
["-gen-op-defs"],
"include/toy/Ops.cpp.inc",
),
(
["-gen-dialect-decls"],
"include/toy/Dialect.h.inc",
),
(
["-gen-dialect-defs"],
"include/toy/Dialect.cpp.inc",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "include/toy/Ops.td",
deps = [":ToyOpsTdFiles"],
)
gentbl_cc_library(
name = "ToyCombineIncGen",
strip_include_prefix = "mlir",
tbl_outs = [
(
["-gen-rewriters"],
"mlir/ToyCombine.inc",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/ToyCombine.td",
deps = [":ToyOpsTdFiles"],
)
cc_binary(
name = "toyc-ch3",
srcs = [
"mlir/Dialect.cpp",
"mlir/MLIRGen.cpp",
"mlir/ToyCombine.cpp",
"parser/AST.cpp",
"toyc.cpp",
] + glob(["include/toy/*.h"]),
includes = ["include/"],
deps = [
":ToyCombineIncGen",
":ToyOpsIncGen",
"//llvm:Support",
"//mlir:Analysis",
"//mlir:BytecodeReader",
"//mlir:FunctionInterfaces",
"//mlir:IR",
"//mlir:Parser",
"//mlir:Pass",
"//mlir:SideEffectInterfaces",
"//mlir:Support",
"//mlir:Transforms",
],
)