load("@heir//lib/Transforms:transforms.bzl", "add_heir_transforms")
load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(
    default_applicable_licenses = ["@heir//:license"],
    default_visibility = ["//visibility:public"],
)

cc_library(
    name = "Transforms",
    hdrs = ["Passes.h"],
    deps = [
        ":{{ pass_name }}",
        ":pass_inc_gen",
        "@heir//lib/Dialect/{{ dialect_name }}/IR:Dialect",
        "@llvm-project//mlir:IR",
    ],
)

cc_library(
    name = "{{ pass_name }}",
    srcs = ["{{ pass_name }}.cpp"],
    hdrs = ["{{ pass_name }}.h"],
    deps = [
        ":pass_inc_gen",
        "@heir//lib/Dialect/{{ dialect_name }}/IR:Dialect",
        "@llvm-project//mlir:IR",
        "@llvm-project//mlir:Pass",
        "@llvm-project//mlir:Transforms",
    ],
)

add_heir_transforms(
    header_filename = "Passes.h.inc",
    pass_name = "{{ dialect_name }}",
    td_file = "Passes.td",
)
