llvm/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Description:
#   The MLIR "Multi-Level Intermediate Representation" Compiler Infrastructure

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load(
    ":build_defs.bzl",
    "cc_headers_only",
    "if_cuda_available",
    "mlir_c_api_cc_library",
)
load(":linalggen.bzl", "genlinalg")
load(":tblgen.bzl", "gentbl_cc_library", "td_library")

package(
    default_visibility = ["//visibility:public"],
    features = ["layering_check"],
)

licenses(["notice"])

exports_files([
    "LICENSE.TXT",
    "run_lit.sh",
    "utils/lldb-scripts/mlirDataFormatters.py",
    "utils/textmate/mlir.json",
])

bool_flag(
    name = "enable_cuda",
    build_setting_default = False,
)

config_setting(
    name = "enable_cuda_config",
    flag_values = {
        ":enable_cuda": "True",
    },
)

expand_template(
    name = "mlir_config_h_gen",
    out = "include/mlir/Config/mlir-config.h",
    substitutions = {
        "#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE": "#define MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE 0",
        "#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS": "#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 0",
        "#cmakedefine MLIR_GREEDY_REWRITE_RANDOMIZER_SEED ${MLIR_GREEDY_REWRITE_RANDOMIZER_SEED}": "/* #undef MLIR_GREEDY_REWRITE_RANDOMIZER_SEED */",
        "#cmakedefine01 MLIR_ENABLE_NVPTXCOMPILER": "#define MLIR_ENABLE_NVPTXCOMPILER 0",
        "#cmakedefine01 MLIR_ENABLE_PDL_IN_PATTERNMATCH": "#define MLIR_ENABLE_PDL_IN_PATTERNMATCH 1",
        "#cmakedefine01 MLIR_ENABLE_ROCM_CONVERSIONS": "#define MLIR_ENABLE_ROCM_CONVERSIONS 0",
    },
    template = "include/mlir/Config/mlir-config.h.cmake",
)

cc_library(
    name = "config",
    hdrs = [
        "include/mlir/Config/mlir-config.h",
    ],
)

filegroup(
    name = "c_headers",
    srcs = glob(["include/mlir-c/**/*"]),  # <== i.e. match the entire tree
)

exports_files(glob(["include/**/*.td"]))

[
    gentbl_cc_library(
        name = name + "IncGen",
        tbl_outs = [
            (
                ["-gen-op-interface-decls"],
                "include/mlir/IR/" + name + ".h.inc",
            ),
            (
                ["-gen-op-interface-defs"],
                "include/mlir/IR/" + name + ".cpp.inc",
            ),
        ],
        tblgen = ":mlir-tblgen",
        td_file = "include/mlir/IR/" + name + ".td",
        deps = [":OpBaseTdFiles"],
    )
    for name in [
        "OpAsmInterface",
        "RegionKindInterface",
        "SymbolInterfaces",
    ]
]

gentbl_cc_library(
    name = "TensorEncodingIncGen",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/IR/TensorEncInterfaces.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/IR/TensorEncInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/TensorEncoding.td",
    deps = [":TensorOpsTdFiles"],
)

td_library(
    name = "BuiltinDialectTdFiles",
    srcs = [
        "include/mlir/IR/BuiltinAttributeInterfaces.td",
        "include/mlir/IR/BuiltinAttributes.td",
        "include/mlir/IR/BuiltinDialect.td",
        "include/mlir/IR/BuiltinLocationAttributes.td",
        "include/mlir/IR/BuiltinOps.td",
        "include/mlir/IR/BuiltinTypeInterfaces.td",
        "include/mlir/IR/BuiltinTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":BytecodeTdFiles",
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":DataLayoutInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

td_library(
    name = "BuiltinDialectBytecodeTdFiles",
    srcs = ["include/mlir/IR/BuiltinDialectBytecode.td"],
    includes = ["include"],
    deps = [
        ":BytecodeTdFiles",
    ],
)

gentbl_cc_library(
    name = "BuiltinDialectIncGen",
    tbl_outs = [
        (
            ["-gen-dialect-decls"],
            "include/mlir/IR/BuiltinDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/IR/BuiltinDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinDialect.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinDialectBytecodeGen",
    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",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/IR/BuiltinAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/IR/BuiltinAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinAttributes.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinAttributeInterfacesIncGen",
    tbl_outs = [
        (
            ["--gen-attr-interface-decls"],
            "include/mlir/IR/BuiltinAttributeInterfaces.h.inc",
        ),
        (
            ["--gen-attr-interface-defs"],
            "include/mlir/IR/BuiltinAttributeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinAttributeInterfaces.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinLocationAttributesIncGen",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/IR/BuiltinLocationAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/IR/BuiltinLocationAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinLocationAttributes.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/IR/BuiltinOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/IR/BuiltinOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinOps.td",
    deps = [
        ":BuiltinDialectTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "BuiltinTypesIncGen",
    tbl_outs = [
        (
            ["--gen-typedef-decls"],
            "include/mlir/IR/BuiltinTypes.h.inc",
        ),
        (
            ["--gen-typedef-defs"],
            "include/mlir/IR/BuiltinTypes.cpp.inc",
        ),
        (
            ["-gen-type-constraint-decls"],
            "include/mlir/IR/BuiltinTypeConstraints.h.inc",
        ),
        (
            ["-gen-type-constraint-defs"],
            "include/mlir/IR/BuiltinTypeConstraints.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinTypes.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinTypeInterfacesIncGen",
    tbl_outs = [
        (
            ["--gen-type-interface-decls"],
            "include/mlir/IR/BuiltinTypeInterfaces.h.inc",
        ),
        (
            ["--gen-type-interface-defs"],
            "include/mlir/IR/BuiltinTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinTypeInterfaces.td",
    deps = [
        ":BuiltinDialectTdFiles",
    ],
)

td_library(
    name = "FunctionInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/FunctionInterfaces.td"],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "FunctionInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/FunctionInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/FunctionInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/FunctionInterfaces.td",
    deps = [
        ":FunctionInterfacesTdFiles",
    ],
)

cc_library(
    name = "FunctionInterfaces",
    srcs = [
        "lib/Interfaces/FunctionImplementation.cpp",
        "lib/Interfaces/FunctionInterfaces.cpp",
    ],
    hdrs = [
        "include/mlir/Interfaces/FunctionImplementation.h",
        "include/mlir/Interfaces/FunctionInterfaces.h",
    ],
    includes = ["include"],
    deps = [
        ":CallOpInterfaces",
        ":FunctionInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "IR",
    srcs = glob([
        "lib/IR/*.cpp",
        "lib/IR/*.h",
        "lib/IR/PDL/*.cpp",
        "lib/Bytecode/Writer/*.h",
        "include/mlir/Bytecode/*.h",
    ]) + [
        "include/mlir/IR/PDLPatternMatch.h.inc",
        "include/mlir/Interfaces/CallInterfaces.h",
        "include/mlir/Interfaces/DataLayoutInterfaces.h",
        "include/mlir/Interfaces/InferIntRangeInterface.h",
        "include/mlir/Interfaces/SideEffectInterfaces.h",
    ],
    hdrs = glob([
        "include/mlir/IR/*.h",
    ]) + [
        "include/mlir/Interfaces/FoldInterfaces.h",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinAttributeInterfacesIncGen",
        ":BuiltinAttributesIncGen",
        ":BuiltinDialectBytecodeGen",
        ":BuiltinDialectIncGen",
        ":BuiltinLocationAttributesIncGen",
        ":BuiltinOpsIncGen",
        ":BuiltinTypeInterfacesIncGen",
        ":BuiltinTypesIncGen",
        ":BytecodeOpInterfaceIncGen",
        ":CallOpInterfacesIncGen",
        ":DataLayoutInterfacesIncGen",
        ":InferIntRangeInterfaceIncGen",
        ":OpAsmInterfaceIncGen",
        ":RegionKindInterfaceIncGen",
        ":SideEffectInterfacesIncGen",
        ":Support",
        ":SymbolInterfacesIncGen",
        ":TensorEncodingIncGen",
        ":config",
        "//llvm:Support",
        "//llvm:config",
    ],
)

cc_library(
    name = "Pass",
    srcs = glob([
        "lib/Pass/*.cpp",
        "lib/Pass/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Pass/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":Support",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIIR",
    srcs = [
        "lib/CAPI/Dialect/Func.cpp",
        "lib/CAPI/Dialect/IRDL.cpp",
        "lib/CAPI/IR/AffineExpr.cpp",
        "lib/CAPI/IR/AffineMap.cpp",
        "lib/CAPI/IR/BuiltinAttributes.cpp",
        "lib/CAPI/IR/BuiltinTypes.cpp",
        "lib/CAPI/IR/Diagnostics.cpp",
        "lib/CAPI/IR/DialectHandle.cpp",
        "lib/CAPI/IR/IR.cpp",
        "lib/CAPI/IR/IntegerSet.cpp",
        "lib/CAPI/IR/Pass.cpp",
        "lib/CAPI/IR/Support.cpp",
    ],
    hdrs = [
        "include/mlir-c/AffineExpr.h",
        "include/mlir-c/AffineMap.h",
        "include/mlir-c/BuiltinAttributes.h",
        "include/mlir-c/BuiltinTypes.h",
        "include/mlir-c/Diagnostics.h",
        "include/mlir-c/Dialect/Func.h",
        "include/mlir-c/Dialect/IRDL.h",
        "include/mlir-c/ExecutionEngine.h",
        "include/mlir-c/IR.h",
        "include/mlir-c/IntegerSet.h",
        "include/mlir-c/Interfaces.h",
        "include/mlir-c/Pass.h",
        "include/mlir-c/RegisterEverything.h",
        "include/mlir-c/Rewrite.h",
        "include/mlir-c/Support.h",
        "include/mlir/CAPI/AffineExpr.h",
        "include/mlir/CAPI/AffineMap.h",
        "include/mlir/CAPI/Diagnostics.h",
        "include/mlir/CAPI/IR.h",
        "include/mlir/CAPI/IntegerSet.h",
        "include/mlir/CAPI/Interfaces.h",
        "include/mlir/CAPI/Pass.h",
        "include/mlir/CAPI/Registration.h",
        "include/mlir/CAPI/Rewrite.h",
        "include/mlir/CAPI/Support.h",
        "include/mlir/CAPI/Utils.h",
        "include/mlir/CAPI/Wrap.h",
    ],
    header_deps = [
        ":BytecodeWriter",
        ":IR",
        ":Pass",
        ":Support",
        ":config",
        "//llvm:Support",
    ],
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IRDLDialect",
        ":InferTypeOpInterface",
        ":Parser",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIInterfaces",
    srcs = [
        "lib/CAPI/Interfaces/Interfaces.cpp",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterface",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIAMDGPU",
    srcs = ["lib/CAPI/Dialect/AMDGPU.cpp"],
    hdrs = ["include/mlir-c/Dialect/AMDGPU.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":AMDGPUDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIArith",
    srcs = ["lib/CAPI/Dialect/Arith.cpp"],
    hdrs = ["include/mlir-c/Dialect/Arith.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIAsync",
    srcs = [
        "lib/CAPI/Dialect/Async.cpp",
        "lib/CAPI/Dialect/AsyncPasses.cpp",
    ],
    hdrs = ["include/mlir-c/Dialect/Async.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":AsyncPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":AsyncDialect",
        ":AsyncTransforms",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPILinalg",
    srcs = [
        "lib/CAPI/Dialect/Linalg.cpp",
        "lib/CAPI/Dialect/LinalgPasses.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/Linalg.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":LinalgPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":LinalgDialect",
        ":LinalgTransforms",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPILLVM",
    srcs = [
        "lib/CAPI/Dialect/LLVM.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/LLVM.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":LLVMDialect",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIMath",
    srcs = ["lib/CAPI/Dialect/Math.cpp"],
    hdrs = ["include/mlir-c/Dialect/Math.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":MathDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIMemRef",
    srcs = ["lib/CAPI/Dialect/MemRef.cpp"],
    hdrs = ["include/mlir-c/Dialect/MemRef.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":MemRefDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPINVGPU",
    srcs = ["lib/CAPI/Dialect/NVGPU.cpp"],
    hdrs = ["include/mlir-c/Dialect/NVGPU.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":IR",
        ":NVGPUDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPINVVM",
    srcs = ["lib/CAPI/Dialect/NVVM.cpp"],
    hdrs = ["include/mlir-c/Dialect/NVVM.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":NVVMDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPITarget",
    srcs = ["lib/CAPI/Target/LLVMIR.cpp"],
    hdrs = ["include/mlir-c/Target/LLVMIR.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        "//llvm:Support",
    ],
    includes = ["include"],
    deps = [
        ":LLVMToLLVMIRTranslation",
        ":Support",
        ":ToLLVMIRTranslation",
        ":ToLLVMIRTranslationRegistration",
        "//llvm:Core",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIGPU",
    srcs = [
        "lib/CAPI/Dialect/GPU.cpp",
        "lib/CAPI/Dialect/GPUPasses.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/GPU.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":GPUPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":GPUTransforms",
        ":Pass",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIROCDL",
    srcs = ["lib/CAPI/Dialect/ROCDL.cpp"],
    hdrs = ["include/mlir-c/Dialect/ROCDL.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":ROCDLDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPISCF",
    srcs = ["lib/CAPI/Dialect/SCF.cpp"],
    hdrs = ["include/mlir-c/Dialect/SCF.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":SCFDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPISparseTensor",
    srcs = [
        "lib/CAPI/Dialect/SparseTensor.cpp",
        "lib/CAPI/Dialect/SparseTensorPasses.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/SparseTensor.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":SparseTensorPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":Pass",
        ":SparseTensorDialect",
        ":SparseTensorTransforms",
        ":Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIQuant",
    srcs = [
        "lib/CAPI/Dialect/Quant.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/Quant.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":QuantOps",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIPDL",
    srcs = [
        "lib/CAPI/Dialect/PDL.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/PDL.h",
    ],
    header_deps = [
        ":CAPIIRHeaders",
    ],
    includes = ["include"],
    deps = [
        ":CAPIIR",
        ":PDLDialect",
        ":PDLOpsIncGen",
        ":PDLTypesIncGen",
    ],
)

mlir_c_api_cc_library(
    name = "CAPITransformDialect",
    srcs = [
        "lib/CAPI/Dialect/Transform.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/Transform.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPITransformDialectTransforms",
    srcs = [
        "lib/CAPI/Dialect/TransformInterpreter.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/Transform/Interpreter.h",
    ],
    capi_deps = [
        ":CAPIIR",
        ":CAPITransformDialect",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformDialectTransforms",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIMLProgram",
    srcs = [
        "lib/CAPI/Dialect/MLProgram.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/MLProgram.h",
    ],
    header_deps = [
        ":CAPIIRHeaders",
    ],
    includes = ["include"],
    deps = [
        ":CAPIIR",
        ":MLProgramDialect",
        ":MLProgramOpsIncGen",
        ":MLProgramTypesIncGen",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIVector",
    srcs = ["lib/CAPI/Dialect/Vector.cpp"],
    hdrs = ["include/mlir-c/Dialect/Vector.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":VectorDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIConversion",
    srcs = ["lib/CAPI/Conversion/Passes.cpp"],
    hdrs = ["include/mlir-c/Conversion.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":ConversionPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":ConversionPasses",
        ":ConvertToSPIRV",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIDebug",
    srcs = ["lib/CAPI/Debug/Debug.cpp"],
    hdrs = ["include/mlir-c/Debug.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIExecutionEngine",
    srcs = ["lib/CAPI/ExecutionEngine/ExecutionEngine.cpp"],
    hdrs = [
        "include/mlir-c/ExecutionEngine.h",
        "include/mlir/CAPI/ExecutionEngine.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":ExecutionEngine",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinToLLVMIRTranslation",
        ":ExecutionEngineUtils",
        ":LLVMToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        "//llvm:OrcJIT",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPITransforms",
    srcs = [
        "lib/CAPI/Transforms/Passes.cpp",
        "lib/CAPI/Transforms/Rewrite.cpp",
    ],
    hdrs = ["include/mlir-c/Transforms.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":TransformsPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":IR",
        ":Pass",
        ":Rewrite",
        ":TransformUtils",
        ":Transforms",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIRegisterEverything",
    srcs = ["lib/CAPI/RegisterEverything/RegisterEverything.cpp"],
    hdrs = ["include/mlir-c/RegisterEverything.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":AllExtensions",
        ":AllPassesAndDialects",
        ":AllToLLVMIRTranslations",
        ":BuiltinToLLVMIRTranslation",
        ":IR",
        ":LLVMToLLVMIRTranslation",
    ],
)

##---------------------------------------------------------------------------##
# Sources of Python bindings.
#----------------------------------------------------------------------------##

exports_files(
    glob(["lib/Bindings/Python/**/*.cpp"]),
)

filegroup(
    name = "MLIRBindingsPythonHeaderFiles",
    srcs = glob([
        "lib/Bindings/Python/*.h",
        "include/mlir-c/Bindings/Python/*.h",
        "include/mlir/Bindings/Python/*.h",
    ]),
)

cc_library(
    name = "MLIRBindingsPythonHeaders",
    includes = [
        "include",
        "lib/Bindings/Python",
    ],
    textual_hdrs = [":MLIRBindingsPythonHeaderFiles"],
    deps = [
        ":CAPIIRHeaders",
        ":CAPITransformsHeaders",
        "@pybind11",
        "@rules_python//python/cc:current_py_cc_headers",
    ],
)

cc_library(
    name = "MLIRBindingsPythonHeadersAndDeps",
    includes = [
        "include",
        "lib/Bindings/Python",
    ],
    textual_hdrs = [":MLIRBindingsPythonHeaderFiles"],
    deps = [
        ":CAPIIR",
        ":CAPITransforms",
        "@pybind11",
        "@rules_python//python/cc:current_py_cc_headers",
    ],
)

# These flags are needed for pybind11 to work.
PYBIND11_COPTS = [
    "-fexceptions",
    "-frtti",
]

PYBIND11_FEATURES = [
    # Cannot use header_modules (parse_headers feature fails).
    "-use_header_modules",
]

filegroup(
    name = "MLIRBindingsPythonSourceFiles",
    srcs = [
        "lib/Bindings/Python/IRAffine.cpp",
        "lib/Bindings/Python/IRAttributes.cpp",
        "lib/Bindings/Python/IRCore.cpp",
        "lib/Bindings/Python/IRInterfaces.cpp",
        "lib/Bindings/Python/IRModule.cpp",
        "lib/Bindings/Python/IRTypes.cpp",
        "lib/Bindings/Python/Pass.cpp",
        "lib/Bindings/Python/Rewrite.cpp",
    ],
)

cc_library(
    name = "MLIRBindingsPythonCore",
    srcs = [":MLIRBindingsPythonSourceFiles"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    deps = [
        ":CAPIAsync",
        ":CAPIDebug",
        ":CAPIIR",
        ":CAPIInterfaces",
        ":MLIRBindingsPythonHeadersAndDeps",
        ":Support",
        ":config",
        "//llvm:Support",
        "@pybind11",
        "@rules_python//python/cc:current_py_cc_headers",
    ],
)

cc_library(
    name = "MLIRBindingsPythonCoreNoCAPI",
    srcs = [":MLIRBindingsPythonSourceFiles"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    deps = [
        ":CAPIAsyncHeaders",
        ":CAPIDebugHeaders",
        ":CAPIIRHeaders",
        ":MLIRBindingsPythonHeaders",
        ":Support",
        ":config",
        "//llvm:Support",
        "@pybind11",
        "@rules_python//python/cc:current_py_cc_headers",
    ],
)

# Target that bundles together the CAPI objects needed for
# MLIRBindingsPythonCoreNoCAPI.
cc_library(
    name = "MLIRBindingsPythonCAPIObjects",
    deps = [
        ":CAPIAsyncObjects",
        ":CAPIDebugObjects",
        ":CAPIIRObjects",
        ":CAPIInterfacesObjects",
        ":CAPITransformsObjects",
    ],
)

# Dynamic library with the MLIR Python extension.
cc_binary(
    name = "_mlir.so",
    srcs = ["lib/Bindings/Python/MainModule.cpp"],
    # These flags are needed for pybind11 to work.
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":MLIRBindingsPythonCore",
        ":MLIRBindingsPythonHeadersAndDeps",
    ],
)

cc_binary(
    name = "_mlirDialectsLinalg.so",
    srcs = ["lib/Bindings/Python/DialectLinalg.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":CAPIIR",
        ":CAPILinalg",
        ":MLIRBindingsPythonHeadersAndDeps",
    ],
)

cc_binary(
    name = "_mlirDialectsLLVM.so",
    srcs = ["lib/Bindings/Python/DialectLLVM.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":CAPIIR",
        ":CAPILLVM",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
    ],
)

cc_binary(
    name = "_mlirDialectsQuant.so",
    srcs = ["lib/Bindings/Python/DialectQuant.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":CAPIIR",
        ":CAPIQuant",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
    ],
)

cc_binary(
    name = "_mlirDialectsSparseTensor.so",
    srcs = ["lib/Bindings/Python/DialectSparseTensor.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":CAPIIR",
        ":CAPISparseTensor",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
    ],
)

# Dynamic library with the MLIR Conversions Python extension.
cc_binary(
    name = "_mlirExecutionEngine.so",
    srcs = ["lib/Bindings/Python/ExecutionEngineModule.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":CAPIExecutionEngine",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
        "@rules_python//python/cc:current_py_cc_headers",
    ],
)

# Dynamic library with the MLIR Linalg dialect+passes Python extension.
cc_binary(
    name = "_mlirLinalgPasses.so",
    srcs = ["lib/Bindings/Python/LinalgPasses.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    deps = [
        ":CAPILinalg",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
        "@rules_python//python/cc:current_py_cc_headers",
    ],
)

##---------------------------------------------------------------------------##

td_library(
    name = "AttrTdFiles",
    srcs = [
        "include/mlir/IR/AttrTypeBase.td",
        "include/mlir/IR/EnumAttr.td",
    ],
    includes = ["include"],
)

td_library(
    name = "OpBaseTdFiles",
    srcs = [
        "include/mlir/IR/CommonAttrConstraints.td",
        "include/mlir/IR/CommonTypeConstraints.td",
        "include/mlir/IR/Constraints.td",
        "include/mlir/IR/DialectBase.td",
        "include/mlir/IR/Interfaces.td",
        "include/mlir/IR/OpAsmInterface.td",
        "include/mlir/IR/OpBase.td",
        "include/mlir/IR/PatternBase.td",
        "include/mlir/IR/Properties.td",
        "include/mlir/IR/RegionKindInterface.td",
        "include/mlir/IR/SymbolInterfaces.td",
        "include/mlir/IR/TensorEncoding.td",
        "include/mlir/IR/Traits.td",
        "include/mlir/IR/Utils.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
    ],
)

td_library(
    name = "BytecodeTdFiles",
    srcs = ["include/mlir/IR/BytecodeBase.td"],
    includes = ["include"],
)

td_library(
    name = "CallInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/CallInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "CastInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/CastInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ControlFlowInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/ControlFlowInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "BytecodeOpInterfaceTdFiles",
    srcs = ["include/mlir/Bytecode/BytecodeOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "CopyOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/CopyOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "DerivedAttributeOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/DerivedAttributeOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "DestinationStyleOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/DestinationStyleOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "InferIntRangeInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/InferIntRangeInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "InferTypeOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/InferTypeOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "LoopLikeInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/LoopLikeInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "MemorySlotInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/MemorySlotInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ShapedOpInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/ShapedOpInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ParallelCombiningOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/ParallelCombiningOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "RuntimeVerifiableOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/RuntimeVerifiableOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "SideEffectInterfacesTdFiles",
    srcs = [
        "include/mlir/Interfaces/SideEffectInterfaceBase.td",
        "include/mlir/Interfaces/SideEffectInterfaces.td",
    ],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "TilingInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/TilingInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "VectorInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/VectorInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ViewLikeInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/ViewLikeInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ReducerTdFiles",
    srcs = ["include/mlir/Reducer/Passes.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

##---------------------------------------------------------------------------##
# Affine dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "PassBaseTdFiles",
    srcs = ["include/mlir/Pass/PassBase.td"],
    includes = ["include"],
)

td_library(
    name = "RewritePassBaseTdFiles",
    srcs = ["include/mlir/Rewrite/PassUtil.td"],
    includes = ["include"],
)

td_library(
    name = "AffineOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td",
        "include/mlir/Dialect/Affine/IR/AffineOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsTdFiles",
        ":FuncTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AffineOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Affine/IR/AffineOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=affine",
            ],
            "include/mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=affine",
            ],
            "include/mlir/Dialect/Affine/IR/AffineOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/IR/AffineOps.td",
    deps = [":AffineOpsTdFiles"],
)

gentbl_cc_library(
    name = "AffineMemoryOpInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td",
    deps = [":AffineOpsTdFiles"],
)

td_library(
    name = "AffineTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "AffineTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.td",
    deps = [
        ":AffineTransformOpsTdFiles",
    ],
)

cc_library(
    name = "AffineTransformOps",
    srcs = glob(["lib/Dialect/Affine/TransformOps/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Affine/TransformOps/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffineTransformOpsIncGen",
        ":AffineUtils",
        ":BytecodeOpInterface",
        ":IR",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformUtils",
    ],
)

##---------------------------------------------------------------------------##
# AMDGPU dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "AMDGPUTdFiles",
    srcs = ["include/mlir/Dialect/AMDGPU/IR/AMDGPU.td"],
    includes = ["include"],
    deps = [
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AMDGPUIncGen",
    tbl_outs = [
        (
            [
                "-gen-attrdef-decls",
                "-dialect=amdgpu",
            ],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-dialect=amdgpu",
            ],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=amdgpu",
            ],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=amdgpu",
            ],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPU.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/AMDGPU/IR/AMDGPU.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/AMDGPU/IR/AMDGPU.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMDGPU/IR/AMDGPU.td",
    deps = [":AMDGPUTdFiles"],
)

cc_library(
    name = "AMDGPUDialect",
    srcs = ["lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp"],
    hdrs = ["include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h"],
    includes = ["include"],
    deps = [
        ":AMDGPUIncGen",
        ":ArithDialect",
        ":BytecodeOpInterface",
        ":GPUDialect",
        ":IR",
        ":ROCDLDialect",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "AMDGPUPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=AMDGPU",
            ],
            "include/mlir/Dialect/AMDGPU/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMDGPU/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "AMDGPUTransforms",
    srcs = glob(
        [
            "lib/Dialect/AMDGPU/Transforms/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/AMDGPU/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AMDGPUDialect",
        ":AMDGPUPassIncGen",
        ":AMDGPUUtils",
        ":ArithDialect",
        ":ControlFlowDialect",
        ":FuncDialect",
        ":GPUDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

cc_library(
    name = "AMDGPUUtils",
    srcs = glob(["lib/Dialect/AMDGPU/Utils/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/AMDGPU/Utils/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# EmitC dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "EmitCTdFiles",
    srcs = [
        "include/mlir/Dialect/EmitC/IR/EmitC.td",
        "include/mlir/Dialect/EmitC/IR/EmitCAttributes.td",
        "include/mlir/Dialect/EmitC/IR/EmitCBase.td",
        "include/mlir/Dialect/EmitC/IR/EmitCTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "EmitCAttributesIncGen",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/EmitC/IR/EmitCAttributes.td",
    deps = [":EmitCTdFiles"],
)

gentbl_cc_library(
    name = "EmitCOpsIncGen",
    tbl_outs = [
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCEnums.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitC.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitC.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/EmitC/IR/EmitC.td",
    deps = [":EmitCTdFiles"],
)

gentbl_cc_library(
    name = "EmitCPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=EmitC",
            ],
            "include/mlir/Dialect/EmitC/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/EmitC/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "TargetCpp",
    srcs = glob([
        "lib/Target/Cpp/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Target/Cpp/*.h"]),
    deps = [
        ":ControlFlowDialect",
        ":EmitCDialect",
        ":FuncDialect",
        ":IR",
        ":Support",
        ":TranslateLib",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# Async dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "AsyncOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Async/IR/AsyncDialect.td",
        "include/mlir/Dialect/Async/IR/AsyncOps.td",
        "include/mlir/Dialect/Async/IR/AsyncTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AsyncOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Async/IR/AsyncOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Async/IR/AsyncOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Async/IR/AsyncOpsDialect.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/Async/IR/AsyncOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Async/IR/AsyncOps.td",
    deps = [":AsyncOpsTdFiles"],
)

gentbl_cc_library(
    name = "AsyncPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Async",
            ],
            "include/mlir/Dialect/Async/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Async",
            ],
            "include/mlir/Dialect/Async/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Async",
            ],
            "include/mlir/Dialect/Async/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Async/Passes.td",
    deps = [":PassBaseTdFiles"],
)

##---------------------------------------------------------------------------##
# ArmNeon dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "ArmNeonTdFiles",
    srcs = ["include/mlir/Dialect/ArmNeon/ArmNeon.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArmNeonIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=arm_neon",
            ],
            "include/mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arm_neon",
            ],
            "include/mlir/Dialect/ArmNeon/ArmNeonDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmNeon/ArmNeon.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmNeon/ArmNeon.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/ArmNeon/ArmNeon.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmNeon/ArmNeon.td",
    deps = [":ArmNeonTdFiles"],
)

cc_library(
    name = "ArmNeonDialect",
    srcs = ["lib/Dialect/ArmNeon/IR/ArmNeonDialect.cpp"],
    hdrs = ["include/mlir/Dialect/ArmNeon/ArmNeonDialect.h"],
    includes = ["include"],
    deps = [
        ":ArmNeonIncGen",
        ":BytecodeOpInterface",
        ":IR",
        ":SideEffectInterfaces",
        ":VectorDialect",
    ],
)

cc_library(
    name = "ArmNeonTransforms",
    srcs = glob(["lib/Dialect/ArmNeon/Transforms/*.cpp"]),
    hdrs = ["include/mlir/Dialect/ArmNeon/Transforms.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArmNeonDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":Support",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

gentbl_cc_library(
    name = "ArmNeonConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/ArmNeon/ArmNeonConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmNeon/ArmNeon.td",
    deps = [":ArmNeonTdFiles"],
)

cc_library(
    name = "ArmNeon2dToIntr",
    srcs = glob([
        "lib/Conversion/ArmNeon2dToIntr/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ArmNeon2dToIntr/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArmNeonDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

##---------------------------------------------------------------------------##
# ArmSME dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "ArmSMETdFiles",
    srcs = [
        "include/mlir/Dialect/ArmSME/IR/ArmSME.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsTdFiles",
        ":FuncTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArmSMETransformsPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=ArmSME",
            ],
            "include/mlir/Dialect/ArmSME/Transforms/Passes.h.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/ArmSME/Transforms/PassesEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/ArmSME/Transforms/PassesEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSME/Transforms/Passes.td",
    deps = [
        ":OpBaseTdFiles",
        ":PassBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArmSMEIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmSME/IR/ArmSME.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmSME/IR/ArmSME.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMETypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMETypes.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=arm_sme",
            ],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arm_sme",
            ],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSME/IR/ArmSME.td",
    deps = [":ArmSMETdFiles"],
)

gentbl_cc_library(
    name = "ArmSMEOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=arm_sme",
            ],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=arm_sme",
            ],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td",
    deps = [":ArmSMETdFiles"],
)

gentbl_cc_library(
    name = "ArmSMEConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEOpsConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td",
    deps = [":ArmSMETdFiles"],
)

gentbl_cc_library(
    name = "ArmSMEOpInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td",
    deps = [":ArmSMETdFiles"],
)

cc_library(
    name = "ArmSMEOpInterfaces",
    hdrs = [
        "include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h",
    ],
    includes = ["include"],
    deps = [
        ":ArmSMEOpInterfacesIncGen",
        ":IR",
        ":Support",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ArmSMEIntrinsicOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.cpp.inc",
        ),
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.td",
    deps = [":ArmSMETdFiles"],
)

cc_library(
    name = "ArmSMEEnums",
    hdrs = [
        "include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h",
    ],
    deps = [
        ":ArmSMEIncGen",
        ":ArmSMEOpsIncGen",
        ":IR",
    ],
)

cc_library(
    name = "ArmSMEDialect",
    srcs = glob(["lib/Dialect/ArmSME/IR/*.cpp"]),
    hdrs = [
        "include/mlir/Dialect/ArmSME/IR/ArmSME.h",
        "include/mlir/Dialect/ArmSME/Utils/Utils.h",
    ],
    includes = ["include"],
    deps = [
        ":ArmSMEEnums",
        ":ArmSMEIncGen",
        ":ArmSMEIntrinsicOpsIncGen",
        ":ArmSMEOpInterfaces",
        ":ArmSMEOpInterfacesIncGen",
        ":ArmSMEOpsIncGen",
        ":BytecodeOpInterface",
        ":FunctionInterfaces",
        ":IR",
        ":LLVMDialect",
        ":MemRefDialect",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmSMETransforms",
    srcs = glob(["lib/Dialect/ArmSME/Transforms/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/ArmSME/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithUtils",
        ":ArmSMEDialect",
        ":ArmSMETransformsPassIncGen",
        ":ControlFlowDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":FunctionInterfaces",
        ":IR",
        ":IndexDialect",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFTransforms",
        ":TransformUtils",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmSMEToSCF",
    srcs = glob(["lib/Conversion/ArmSMEToSCF/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ArmSMEToSCF/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArmSMEDialect",
        ":ConversionPassIncGen",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "ArmSMEToLLVM",
    srcs = glob(["lib/Conversion/ArmSMEToLLVM/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ArmSMEToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArmSMEDialect",
        ":ArmSMETransforms",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FunctionInterfaces",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# ArmSVE dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "ArmSVETdFiles",
    srcs = [
        "include/mlir/Dialect/ArmSVE/IR/ArmSVE.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsTdFiles",
        ":FuncTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArmSVEIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVE.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=arm_sve",
            ],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arm_sve",
            ],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSVE/IR/ArmSVE.td",
    deps = [":ArmSVETdFiles"],
)

cc_library(
    name = "ArmSVEDialect",
    srcs = ["lib/Dialect/ArmSVE/IR/ArmSVEDialect.cpp"],
    hdrs = ["include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h"],
    includes = ["include"],
    deps = [
        ":ArmSVEIncGen",
        ":BytecodeOpInterface",
        ":IR",
        ":LLVMDialect",
        ":SideEffectInterfaces",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ArmSVEPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=ArmSVE",
            ],
            "include/mlir/Dialect/ArmSVE/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSVE/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ArmSVETransforms",
    srcs = glob(["lib/Dialect/ArmSVE/Transforms/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/ArmSVE/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":ArmSVEDialect",
        ":ArmSVEPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

gentbl_cc_library(
    name = "ArmSVEConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/ArmSVE/IR/ArmSVEConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSVE/IR/ArmSVE.td",
    deps = [":ArmSVETdFiles"],
)

##---------------------------------------------------------------------------##
# AMX dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "AMXTdFiles",
    srcs = ["include/mlir/Dialect/AMX/AMX.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AMXIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=amx",
            ],
            "include/mlir/Dialect/AMX/AMXDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=amx",
            ],
            "include/mlir/Dialect/AMX/AMXDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/AMX/AMX.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/AMX/AMX.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/AMX/AMX.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMX/AMX.td",
    deps = [":AMXTdFiles"],
)

cc_library(
    name = "AMXDialect",
    srcs = ["lib/Dialect/AMX/IR/AMXDialect.cpp"],
    hdrs = ["include/mlir/Dialect/AMX/AMXDialect.h"],
    includes = ["include"],
    deps = [
        ":AMXIncGen",
        ":BytecodeOpInterface",
        ":IR",
        ":LLVMDialect",
        ":SideEffectInterfaces",
    ],
)

cc_library(
    name = "AMXTransforms",
    srcs = glob(["lib/Dialect/AMX/Transforms/*.cpp"]),
    hdrs = ["include/mlir/Dialect/AMX/Transforms.h"],
    includes = ["include"],
    deps = [
        ":AMXDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
    ],
)

gentbl_cc_library(
    name = "AMXConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/AMX/AMXConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMX/AMX.td",
    deps = [":AMXTdFiles"],
)

##---------------------------------------------------------------------------##
# X86Vector dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "X86VectorTdFiles",
    srcs = ["include/mlir/Dialect/X86Vector/X86Vector.td"],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":LLVMOpsTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "X86VectorIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=x86vector",
            ],
            "include/mlir/Dialect/X86Vector/X86VectorDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=x86vector",
            ],
            "include/mlir/Dialect/X86Vector/X86VectorDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/X86Vector/X86Vector.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/X86Vector/X86Vector.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/X86Vector/X86Vector.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/X86Vector/X86Vector.td",
    deps = [":X86VectorTdFiles"],
)

cc_library(
    name = "X86VectorDialect",
    srcs = ["lib/Dialect/X86Vector/IR/X86VectorDialect.cpp"],
    hdrs = ["include/mlir/Dialect/X86Vector/X86VectorDialect.h"],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":IR",
        ":InferTypeOpInterface",
        ":LLVMDialect",
        ":SideEffectInterfaces",
        ":X86VectorIncGen",
    ],
)

cc_library(
    name = "X86VectorTransforms",
    srcs = glob(["lib/Dialect/X86Vector/Transforms/*.cpp"]),
    hdrs = ["include/mlir/Dialect/X86Vector/Transforms.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":VectorDialect",
        ":VectorUtils",
        ":X86VectorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "X86VectorConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/X86Vector/X86VectorConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/X86Vector/X86Vector.td",
    deps = [":X86VectorTdFiles"],
)

##---------------------------------------------------------------------------##
# IRDL dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "IRDLTdFiles",
    srcs = [
        "include/mlir/Dialect/IRDL/IR/IRDL.td",
        "include/mlir/Dialect/IRDL/IR/IRDLAttributes.td",
        "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td",
        "include/mlir/Dialect/IRDL/IR/IRDLOps.td",
        "include/mlir/Dialect/IRDL/IR/IRDLTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "IRDLIncGen",
    tbl_outs = [
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDL.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDL.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/IRDL/IR/IRDLOps.td",
    deps = [":IRDLTdFiles"],
)

gentbl_cc_library(
    name = "IRDLInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td",
    deps = [":IRDLTdFiles"],
)

gentbl_cc_library(
    name = "IRDLAttributesIncGen",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/IRDL/IR/IRDLAttributes.td",
    deps = [":IRDLTdFiles"],
)

gentbl_cc_library(
    name = "IRDLEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/IRDL/IR/IRDLAttributes.td",
    deps = [":IRDLTdFiles"],
)

gentbl_cc_library(
    name = "IRDLOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/IRDL/IR/IRDLOps.td",
    deps = [":IRDLTdFiles"],
)

gentbl_cc_library(
    name = "IRDLTypesIncGen",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/IRDL/IR/IRDLTypesGen.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/IRDL/IR/IRDLTypesGen.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/IRDL/IR/IRDLTypes.td",
    deps = [":IRDLTdFiles"],
)

cc_library(
    name = "IRDLDialect",
    srcs = [
        "lib/Dialect/IRDL/IR/IRDL.cpp",
        "lib/Dialect/IRDL/IR/IRDLOps.cpp",
        "lib/Dialect/IRDL/IRDLLoading.cpp",
        "lib/Dialect/IRDL/IRDLSymbols.cpp",
        "lib/Dialect/IRDL/IRDLVerifiers.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/IRDL/IR/IRDL.h",
        "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h",
        "include/mlir/Dialect/IRDL/IR/IRDLTraits.h",
        "include/mlir/Dialect/IRDL/IRDLLoading.h",
        "include/mlir/Dialect/IRDL/IRDLSymbols.h",
        "include/mlir/Dialect/IRDL/IRDLVerifiers.h",
    ],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":Dialect",
        ":IR",
        ":IRDLAttributesIncGen",
        ":IRDLEnumsIncGen",
        ":IRDLIncGen",
        ":IRDLInterfacesIncGen",
        ":IRDLOpsIncGen",
        ":IRDLTypesIncGen",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# SCF dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "SCFTdFiles",
    srcs = [
        "include/mlir/Dialect/SCF/IR/DeviceMappingInterface.td",
        "include/mlir/Dialect/SCF/IR/SCFOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":DestinationStyleOpInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":ParallelCombiningOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "SCFIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SCF/IR/SCFOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SCF/IR/SCFOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/SCF/IR/SCFOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/SCF/IR/SCFOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/IR/SCFOps.td",
    deps = [":SCFTdFiles"],
)

gentbl_cc_library(
    name = "SCFDeviceMappingInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/SCF/IR/DeviceMappingAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/SCF/IR/DeviceMappingAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/IR/DeviceMappingInterface.td",
    deps = [":SCFTdFiles"],
)

gentbl_cc_library(
    name = "SCFPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=SCF",
            ],
            "include/mlir/Dialect/SCF/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "SCFTransforms",
    srcs = glob([
        "lib/Dialect/SCF/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SCF/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":DestinationStyleOpInterface",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFPassIncGen",
        ":SCFUtils",
        ":SideEffectInterfaces",
        ":Support",
        ":TensorDialect",
        ":TensorTransforms",
        ":TilingInterface",
        ":TransformUtils",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

td_library(
    name = "SCFTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":PDLDialect",
        ":TransformLoopExtensionTdFiles",
    ],
)

gentbl_cc_library(
    name = "SCFTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td",
    deps = [
        ":SCFTransformOpsTdFiles",
    ],
)

cc_library(
    name = "SCFTransformOps",
    srcs = glob(["lib/Dialect/SCF/TransformOps/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/SCF/TransformOps/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithDialect",
        ":ArithUtils",
        ":BytecodeOpInterface",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LoopLikeInterface",
        ":SCFDialect",
        ":SCFToControlFlow",
        ":SCFTransformOpsIncGen",
        ":SCFTransforms",
        ":SCFUtils",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":VectorDialect",
    ],
)

##---------------------------------------------------------------------------##
# SparseTensor dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "SparseTensorTdFiles",
    srcs = glob([
        "include/mlir/Dialect/SparseTensor/IR/*.td",
    ]),
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "SparseTensorAttrDefsIncGen",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.cpp.inc",
        ),
        (
            ["--gen-enum-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrEnums.h.inc",
        ),
        (
            ["--gen-enum-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td",
    deps = [":SparseTensorTdFiles"],
)

gentbl_cc_library(
    name = "SparseTensorOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=sparse_tensor",
            ],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=sparse_tensor",
            ],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/SparseTensor/SparseTensor.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td",
    deps = [":SparseTensorTdFiles"],
)

gentbl_cc_library(
    name = "SparseTensorTypesIncGen",
    tbl_outs = [
        (
            ["--gen-typedef-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.h.inc",
        ),
        (
            ["--gen-typedef-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.td",
    deps = [":SparseTensorTdFiles"],
)

gentbl_cc_library(
    name = "SparseTensorPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=SparseTensor",
            ],
            "include/mlir/Dialect/SparseTensor/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=SparseTensor",
            ],
            "include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=SparseTensor",
            ],
            "include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

gentbl_cc_library(
    name = "SparseTensorInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td",
    deps = [":SparseTensorTdFiles"],
)

td_library(
    name = "SparseTensorTransformOpsTdFiles",
    srcs = glob([
        "include/mlir/Dialect/SparseTensor/TransformOps/*.td",
    ]),
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "SparseTensorTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.td",
    deps = [
        ":SparseTensorTransformOpsTdFiles",
    ],
)

# This library is shared by both SparseTensorDialect and
# SparseTensorRuntime, so it must not depend on any of the MLIR/LLVM
# internals or else mlir_c_runner_utils will inherit that dependency.
cc_library(
    name = "SparseTensorEnums",
    hdrs = ["include/mlir/Dialect/SparseTensor/IR/Enums.h"],
    includes = ["include"],
)

cc_library(
    name = "SparseTensorDialect",
    srcs = glob([
        "lib/Dialect/SparseTensor/IR/*.cpp",
        "lib/Dialect/SparseTensor/IR/Detail/*.cpp",
        "lib/Dialect/SparseTensor/IR/Detail/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/SparseTensor/IR/SparseTensor.h",
        "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.h",
        "include/mlir/Dialect/SparseTensor/IR/SparseTensorStorageLayout.h",
        "include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":ComplexDialect",
        ":ControlFlowInterfaces",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":LoopLikeInterface",
        ":SideEffectInterfaces",
        ":SparseTensorAttrDefsIncGen",
        ":SparseTensorEnums",
        ":SparseTensorInterfacesIncGen",
        ":SparseTensorOpsIncGen",
        ":SparseTensorTypesIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SparseTensorTransformOps",
    srcs = glob([
        "lib/Dialect/SparseTensor/TransformOps/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SparseTensor/TransformOps/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":LinalgTransformOps",
        ":SparseTensorDialect",
        ":SparseTensorTransformOpsIncGen",
        ":TransformDialect",
        ":TransformDialectInterfaces",
    ],
)

cc_library(
    name = "SparseTensorUtils",
    srcs = glob([
        "lib/Dialect/SparseTensor/Utils/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SparseTensor/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ComplexDialect",
        ":IR",
        ":LinalgDialect",
        ":MathDialect",
        ":SparseTensorDialect",
        ":SparseTensorEnums",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SparseTensorTransforms",
    srcs = glob([
        "lib/Dialect/SparseTensor/Transforms/*.cpp",
        "lib/Dialect/SparseTensor/Transforms/Utils/*.cpp",
        "lib/Dialect/SparseTensor/Transforms/Utils/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/SparseTensor/Transforms/Passes.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":ComplexDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":GPUDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":LinalgUtils",
        ":MathDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFTransforms",
        ":SparseTensorDialect",
        ":SparseTensorEnums",
        ":SparseTensorPassIncGen",
        ":SparseTensorUtils",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SparseTensorPipelines",
    srcs = glob([
        "lib/Dialect/SparseTensor/Pipelines/*.cpp",
    ]),
    hdrs = [
        "include/mlir/Dialect/SparseTensor/Pipelines/Passes.h",
    ],
    includes = ["include"],
    local_defines = if_cuda_available(["MLIR_GPU_TO_CUBIN_PASS_ENABLE"]),
    deps = [
        ":ArithTransforms",
        ":BufferizationTransforms",
        ":ConversionPasses",
        ":FuncDialect",
        ":GPUDialect",
        ":GPUToNVVMTransforms",
        ":GPUTransforms",
        ":LinalgTransforms",
        ":MemRefTransforms",
        ":NVVMDialect",
        ":Pass",
        ":SparseTensorDialect",
        ":SparseTensorTransforms",
        ":Transforms",
        ":VectorToLLVM",
    ],
)

##---------------------------------------------------------------------------##
# Mesh Dialect
##---------------------------------------------------------------------------##

td_library(
    name = "MeshTdFiles",
    srcs = [
        "include/mlir/Dialect/Mesh/IR/MeshBase.td",
        "include/mlir/Dialect/Mesh/IR/MeshOps.td",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "MeshIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-decls",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshOps.h.inc",
        ),
        (
            [
                "-gen-op-defs",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshDialect.cpp.inc",
        ),
        (
            [
                "-gen-enum-decls",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshEnums.h.inc",
        ),
        (
            [
                "-gen-enum-defs",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshAttributes.cpp.inc",
        ),
        (
            [
                "-gen-typedef-decls",
                "-typedefs-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshTypes.h.inc",
        ),
        (
            [
                "-gen-typedef-defs",
                "-typedefs-dialect=mesh",
            ],
            "include/mlir/Dialect/Mesh/IR/MeshTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Mesh/IR/MeshOps.td",
    deps = [
        ":MeshTdFiles",
        ":ShapeOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "MeshShardingInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.td",
    deps = [":OpBaseTdFiles"],
)

cc_library(
    name = "MeshShardingInterface",
    srcs = ["lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp"],
    hdrs = [
        "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.h",
        "include/mlir/Dialect/Mesh/Interfaces/ShardingInterfaceImpl.h",
    ],
    includes = ["include"],
    deps = [
        ":DialectUtils",
        ":IR",
        ":MeshDialect",
        ":MeshShardingInterfaceIncGen",
        ":Support",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MeshDialect",
    srcs = ["lib/Dialect/Mesh/IR/MeshOps.cpp"],
    hdrs = [
        "include/mlir/Dialect/Mesh/IR/MeshDialect.h",
        "include/mlir/Dialect/Mesh/IR/MeshOps.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BytecodeOpInterface",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MeshIncGen",
        ":SideEffectInterfaces",
        ":Support",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "MeshTransformsPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Mesh",
            ],
            "include/mlir/Dialect/Mesh/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Mesh/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "MeshTransforms",
    srcs = glob([
        "lib/Dialect/Mesh/Transforms/*.cpp",
        "lib/Dialect/Mesh/Transforms/*.h",
    ]),
    hdrs = glob(["include/mlir/Dialect/Mesh/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithDialect",
        ":ArithUtils",
        ":ControlFlowDialect",
        ":ControlFlowInterfaces",
        ":DialectUtils",
        ":FuncDialect",
        ":FunctionInterfaces",
        ":IR",
        ":MeshDialect",
        ":MeshShardingInterface",
        ":MeshTransformsPassIncGen",
        ":Pass",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# NVGPU dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "NVGPUTdFiles",
    srcs = ["include/mlir/Dialect/NVGPU/IR/NVGPU.td"],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "NVGPUIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=nvgpu",
            ],
            "include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=nvgpu",
            ],
            "include/mlir/Dialect/NVGPU/IR/NVGPUDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/NVGPU/IR/NVGPU.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/NVGPU/IR/NVGPU.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/NVGPU/NVGPU.md",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/NVGPU/IR/NVGPUTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/NVGPU/IR/NVGPUTypes.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/NVGPU/IR/NVGPUEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/NVGPU/IR/NVGPUEnums.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/NVGPU/IR/NVGPU.td",
    deps = [":NVGPUTdFiles"],
)

gentbl_cc_library(
    name = "NVGPUPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=NVGPU",
            ],
            "include/mlir/Dialect/NVGPU/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/NVGPU/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "NVGPUDialect",
    srcs = ["lib/Dialect/NVGPU/IR/NVGPUDialect.cpp"],
    hdrs = ["include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h"],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":GPUDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":LLVMDialect",
        ":NVGPUIncGen",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "NVGPUTransformOps",
    srcs = glob([
        "lib/Dialect/NVGPU/TransformOps/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/NVGPU/TransformOps/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":DialectUtils",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LinalgDialect",
        ":MemRefDialect",
        ":NVGPUDialect",
        ":NVGPUToNVVM",
        ":NVGPUTransformOpsIncGen",
        ":NVGPUTransforms",
        ":NVVMDialect",
        ":SCFDialect",
        ":SCFTransforms",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

td_library(
    name = "NVGPUTransformOpsTdFiles",
    srcs = glob([
        "include/mlir/Dialect/NVGPU/TransformOps/*.td",
    ]),
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "NVGPUTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.td",
    deps = [
        ":NVGPUTransformOpsTdFiles",
    ],
)

cc_library(
    name = "NVGPUUtils",
    srcs = ["lib/Dialect/NVGPU/Utils/MMAUtils.cpp"],
    hdrs = ["include/mlir/Dialect/NVGPU/Utils/MMAUtils.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":IR",
        ":NVGPUDialect",
        ":NVVMDialect",
        ":VectorDialect",
    ],
)

cc_library(
    name = "NVGPUTransforms",
    srcs = glob([
        "lib/Dialect/NVGPU/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/NVGPU/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":GPUDialect",
        ":IR",
        ":MemRefDialect",
        ":NVGPUDialect",
        ":NVGPUPassIncGen",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# XeGPU dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "XeGPUTdFiles",
    srcs = glob(["include/mlir/Dialect/XeGPU/IR/*.td"]),
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":OpBaseTdFiles",
        ":ShapedOpInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "XeGPUIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=xegpu",
            ],
            "include/mlir/Dialect/XeGPU/IR/XeGPUDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=xegpu",
            ],
            "include/mlir/Dialect/XeGPU/IR/XeGPUDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/XeGPU/IR/XeGPU.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/XeGPU/IR/XeGPU.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/XeGPU/XeGPU.md",
        ),
        (
            [
                "-gen-typedef-decls",
                "-typedefs-dialect=xegpu",
            ],
            "include/mlir/Dialect/XeGPU/IR/XeGPUTypes.h.inc",
        ),
        (
            [
                "-gen-typedef-defs",
                "-typedefs-dialect=xegpu",
            ],
            "include/mlir/Dialect/XeGPU/IR/XeGPUTypes.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=xegpu",
            ],
            "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=xegpu",
            ],
            "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/XeGPU/IR/XeGPU.td",
    deps = [
        ":ArithOpsTdFiles",
        ":XeGPUTdFiles",
    ],
)

td_library(
    name = "XeGPUAttrTdFiles",
    srcs = [
        "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.td",
        "include/mlir/Dialect/XeGPU/IR/XeGPUDialect.td",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":OpBaseTdFiles",
        ":ShapedOpInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

# Separated from the XeGPUIncGen target because the enum declaration causes
# duplicate declarations with the Arith enums.
gentbl_cc_library(
    name = "XeGPUEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/XeGPU/IR/XeGPUEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/XeGPU/IR/XeGPUEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.td",
    deps = [":XeGPUAttrTdFiles"],
)

cc_library(
    name = "XeGPUDialect",
    srcs = [
        "lib/Dialect/XeGPU/IR/XeGPUDialect.cpp",
        "lib/Dialect/XeGPU/IR/XeGPUOps.cpp",
    ],
    hdrs = ["include/mlir/Dialect/XeGPU/IR/XeGPU.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArithUtils",
        ":BytecodeOpInterface",
        ":DialectUtils",
        ":IR",
        ":MaskableOpInterface",
        ":ShapedOpInterfaces",
        ":SideEffectInterfaces",
        ":VectorDialect",
        ":ViewLikeInterface",
        ":XeGPUEnumsIncGen",
        ":XeGPUIncGen",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "XeGPUPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=XeGPU",
            ],
            "include/mlir/Dialect/XeGPU/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/XeGPU/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "XeGPUTransforms",
    srcs = glob([
        "lib/Dialect/XeGPU/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/XeGPU/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineUtils",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformUtils",
        ":XeGPUDialect",
        ":XeGPUPassIncGen",
        "//llvm:Support",
    ],
)

td_library(
    name = "FuncTdFiles",
    srcs = [
        "include/mlir/Dialect/Func/IR/FuncOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "FuncIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Func/IR/FuncOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Func/IR/FuncOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Func/IR/FuncOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Func/IR/FuncOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Func/IR/FuncOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Func/IR/FuncOps.td",
    deps = [":FuncTdFiles"],
)

cc_library(
    name = "Dialect",
    srcs = glob([
        "lib/Dialect/*.cpp",
    ]),
    hdrs = glob(
        include = ["include/mlir/Dialect/*.h"],
        exclude = ["include/mlir/Dialect/CommonFolders.h"],
    ),
    includes = ["include"],
    deps = [
        ":IR",
        "//llvm:Support",
    ],
)

td_library(
    name = "DialectUtilsTdFiles",
    srcs = [
        "include/mlir/Dialect/Utils/StructuredOpsUtils.td",
    ],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "DialectUtilsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Utils/DialectUtilsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Utils/DialectUtilsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Utils/StructuredOpsUtils.td",
    deps = [":DialectUtilsTdFiles"],
)

cc_library(
    name = "DialectUtils",
    srcs = glob([
        "lib/Dialect/Utils/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":DialectUtilsIncGen",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineDialect",
    srcs = glob([
        "lib/Dialect/Affine/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Affine/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineMemoryOpInterfacesIncGen",
        ":AffineOpsIncGen",
        ":ArithDialect",
        ":ControlFlowInterfaces",
        ":IR",
        ":InliningUtils",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":ShapedOpInterfaces",
        ":Support",
        ":UBDialect",
        ":ValueBoundsOpInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "EmitCDialect",
    srcs = glob([
        "lib/Dialect/EmitC/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/EmitC/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":CastInterfaces",
        ":ControlFlowInterfaces",
        ":EmitCAttributesIncGen",
        ":EmitCOpsIncGen",
        ":FunctionInterfaces",
        ":IR",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "EmitCTransforms",
    srcs = glob([
        "lib/Dialect/EmitC/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/EmitC/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":EmitCDialect",
        ":EmitCPassIncGen",
        ":IR",
        ":Pass",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AsyncDialect",
    srcs = glob([
        "lib/Dialect/Async/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Async/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AsyncOpsIncGen",
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AsyncTransforms",
    srcs = glob([
        "lib/Dialect/Async/Transforms/*.cpp",
        "lib/Dialect/Async/Transforms/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/Async/Passes.h",
        "include/mlir/Dialect/Async/Transforms.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithDialect",
        ":AsyncDialect",
        ":AsyncPassIncGen",
        ":ControlFlowDialect",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SCFDialect",
        ":SCFToControlFlow",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineAnalysis",
    srcs = glob([
        "lib/Dialect/Affine/Analysis/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Dialect/Affine/Analysis/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":CallOpInterfaces",
        ":DialectUtils",
        ":IR",
        ":SideEffectInterfaces",
        ":Support",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineUtils",
    srcs = glob(
        [
            "lib/Dialect/Affine/Utils/*.cpp",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/Affine/LoopFusionUtils.h",
        "include/mlir/Dialect/Affine/LoopUtils.h",
        "include/mlir/Dialect/Affine/Utils.h",
        "include/mlir/Dialect/Affine/ViewLikeInterfaceUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":Analysis",
        ":ArithUtils",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "AffinePassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Affine",
            ],
            "include/mlir/Dialect/Affine/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "AffineTransforms",
    srcs = glob([
        "lib/Dialect/Affine/Transforms/*.cpp",
    ]),
    hdrs = [
        "include/mlir/Dialect/Affine/Passes.h",
        "include/mlir/Dialect/Affine/Transforms/Transforms.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffinePassIncGen",
        ":AffineUtils",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFUtils",
        ":SideEffectInterfaces",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        ":Transforms",
        ":ValueBoundsOpInterface",
        ":VectorDialect",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ConversionPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Conversion",
            ],
            "include/mlir/Conversion/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Conversion",
            ],
            "include/mlir/Conversion/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Conversion",
            ],
            "include/mlir/Conversion/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Conversion/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ConversionPasses",
    hdrs = ["include/mlir/Conversion/Passes.h"],
    includes = ["include"],
    deps = [
        ":AMDGPUToROCDL",
        ":AffineToStandard",
        ":ArithToAMDGPU",
        ":ArithToArmSME",
        ":ArithToEmitC",
        ":ArithToLLVM",
        ":ArithToSPIRV",
        ":ArmNeon2dToIntr",
        ":ArmSMEToLLVM",
        ":ArmSMEToSCF",
        ":AsyncToLLVM",
        ":BufferizationToMemRef",
        ":ComplexToLLVM",
        ":ComplexToLibm",
        ":ComplexToSPIRV",
        ":ComplexToStandard",
        ":ControlFlowToLLVM",
        ":ControlFlowToSCF",
        ":ControlFlowToSPIRV",
        ":ConversionPassIncGen",
        ":ConvertToLLVM",
        ":ConvertToSPIRV",
        ":FuncToEmitC",
        ":FuncToLLVM",
        ":FuncToSPIRV",
        ":GPUToGPURuntimeTransforms",
        ":GPUToLLVMSPVTransforms",
        ":GPUToNVVMTransforms",
        ":GPUToROCDLTransforms",
        ":GPUToSPIRV",
        ":GPUToVulkanTransforms",
        ":IndexToLLVM",
        ":IndexToSPIRV",
        ":LinalgToStandard",
        ":MathToFuncs",
        ":MathToLLVM",
        ":MathToLibm",
        ":MathToROCDL",
        ":MathToSPIRV",
        ":MemRefToEmitC",
        ":MemRefToLLVM",
        ":MemRefToSPIRV",
        ":NVGPUToNVVM",
        ":NVVMToLLVM",
        ":OpenACCToSCF",
        ":OpenMPToLLVM",
        ":PDLToPDLInterp",
        ":ReconcileUnrealizedCasts",
        ":SCFToControlFlow",
        ":SCFToEmitC",
        ":SCFToGPU",
        ":SCFToOpenMP",
        ":SCFToSPIRV",
        ":SPIRVToLLVM",
        ":ShapeToStandard",
        ":TensorToLinalg",
        ":TensorToSPIRV",
        ":TosaToArith",
        ":TosaToLinalg",
        ":TosaToMLProgram",
        ":TosaToSCF",
        ":TosaToTensor",
        ":UBToLLVM",
        ":UBToSPIRV",
        ":VectorToArmSME",
        ":VectorToGPU",
        ":VectorToLLVM",
        ":VectorToSCF",
        ":VectorToSPIRV",
        ":VectorToXeGPU",
    ],
)

cc_library(
    name = "AsyncToLLVM",
    srcs = glob([
        "lib/Conversion/AsyncToLLVM/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Conversion/AsyncToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":AsyncDialect",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineToStandard",
    srcs = glob([
        "lib/Conversion/AffineToStandard/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Conversion/AffineToStandard/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineTransforms",
        ":AffineUtils",
        ":ConversionPassIncGen",
        ":IR",
        ":MemRefDialect",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
    ],
)

cc_library(
    name = "SCFDialect",
    srcs = glob(
        [
            "lib/Dialect/SCF/IR/*.cpp",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Dialect/SCF/IR/*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationInterfaces",
        ":ControlFlowDialect",
        ":ControlFlowInterfaces",
        ":DestinationStyleOpInterface",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":ParallelCombiningOpInterface",
        ":SCFDeviceMappingInterfacesIncGen",
        ":SCFIncGen",
        ":SideEffectInterfaces",
        ":Support",
        ":TensorDialect",
        ":ValueBoundsOpInterface",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFUtils",
    srcs = glob(
        [
            "lib/Dialect/SCF/Utils/*.cpp",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Dialect/SCF/Utils/*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "InferIntRangeCommon",
    srcs = [
        "lib/Interfaces/Utils/InferIntRangeCommon.cpp",
    ],
    hdrs = ["include/mlir/Interfaces/Utils/InferIntRangeCommon.h"],
    includes = ["include"],
    deps = [
        ":InferIntRangeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "DataLayoutInterfaces",
    srcs = ["lib/Interfaces/DataLayoutInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/DataLayoutInterfaces.h"],
    includes = ["include"],
    deps = [
        ":DataLayoutInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "InliningUtils",
    srcs = ["lib/Transforms/Utils/InliningUtils.cpp"],
    hdrs = ["include/mlir/Transforms/InliningUtils.h"],
    includes = ["include"],
    deps = [
        ":CallOpInterfaces",
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LoopLikeInterface",
    srcs = ["lib/Interfaces/LoopLikeInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/LoopLikeInterface.h"],
    includes = ["include"],
    deps = [
        ":FunctionInterfaces",
        ":IR",
        ":LoopLikeInterfaceIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MemorySlotInterfaces",
    srcs = ["lib/Interfaces/MemorySlotInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/MemorySlotInterfaces.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":MemorySlotInterfacesIncGen",
    ],
)

cc_library(
    name = "ShapedOpInterfaces",
    srcs = ["lib/Interfaces/ShapedOpInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/ShapedOpInterfaces.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":ShapedOpInterfacesIncGen",
    ],
)

cc_library(
    name = "ParallelCombiningOpInterface",
    srcs = ["lib/Interfaces/ParallelCombiningOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/ParallelCombiningOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":ParallelCombiningOpInterfaceIncGen",
    ],
)

cc_library(
    name = "RuntimeVerifiableOpInterface",
    srcs = ["lib/Interfaces/RuntimeVerifiableOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/RuntimeVerifiableOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":RuntimeVerifiableOpInterfaceIncGen",
    ],
)

cc_library(
    name = "VectorInterfaces",
    srcs = ["lib/Interfaces/VectorInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/VectorInterfaces.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":VectorInterfacesIncGen",
    ],
)

cc_library(
    name = "ViewLikeInterface",
    srcs = ["lib/Interfaces/ViewLikeInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/ViewLikeInterface.h"],
    includes = ["include"],
    deps = [
        ":DialectUtils",
        ":IR",
        ":ViewLikeInterfaceIncGen",
    ],
)

cc_library(
    name = "CopyOpInterface",
    srcs = ["lib/Interfaces/CopyOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/CopyOpInterface.h"],
    includes = ["include"],
    deps = [
        ":CopyOpInterfaceIncGen",
        ":IR",
    ],
)

td_library(
    name = "ShapeOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Shape/IR/ShapeBase.td",
        "include/mlir/Dialect/Shape/IR/ShapeOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ShapeOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Shape/IR/ShapeOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Shape/IR/ShapeOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsDialect.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Shape/IR/ShapeOps.td",
    deps = [":ShapeOpsTdFiles"],
)

gentbl_cc_library(
    name = "MLIRShapeCanonicalizationIncGen",
    strip_include_prefix = "include/mlir/Dialect/Shape/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "include/mlir/Dialect/Shape/IR/ShapeCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/Shape/IR/ShapeCanonicalization.td",
    deps = [
        ":FuncTdFiles",
        ":ShapeOpsTdFiles",
        ":TensorOpsTdFiles",
    ],
)

cc_library(
    name = "ShapeDialect",
    srcs = glob(["lib/Dialect/Shape/IR/*.cpp"]),
    hdrs = ["include/mlir/Dialect/Shape/IR/Shape.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":CastInterfaces",
        ":CommonFolders",
        ":ControlFlowInterfaces",
        ":Dialect",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MLIRShapeCanonicalizationIncGen",
        ":ShapeOpsIncGen",
        ":SideEffectInterfaces",
        ":TensorDialect",
        ":UBDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ShapeToStandardGen",
    strip_include_prefix = "lib/Conversion/ShapeToStandard",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Conversion/ShapeToStandard/ShapeToStandard.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Conversion/ShapeToStandard/ShapeToStandard.td",
    deps = [":ShapeOpsTdFiles"],
)

cc_library(
    name = "ShapeToStandard",
    srcs = glob([
        "lib/Conversion/ShapeToStandard/*.cpp",
    ]),
    hdrs = ["include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SCFDialect",
        ":ShapeDialect",
        ":ShapeToStandardGen",
        ":TensorDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ShapeTransformsPassIncGen",
    tbl_outs = [(
        [
            "-gen-pass-decls",
            "-name=Shape",
        ],
        "include/mlir/Dialect/Shape/Transforms/Passes.h.inc",
    )],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Shape/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ShapeTransforms",
    srcs = glob([
        "lib/Dialect/Shape/Transforms/*.cpp",
    ]),
    hdrs = [
        "include/mlir/Dialect/Shape/Analysis/ShapeMappingAnalysis.h",
        "include/mlir/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/Shape/Transforms/Passes.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":ShapeDialect",
        ":ShapeTransformsPassIncGen",
        ":TensorDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

td_library(
    name = "ControlFlowOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ControlFlowOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td",
    deps = [
        ":AttrTdFiles",
        ":ControlFlowOpsTdFiles",
    ],
)

cc_library(
    name = "ControlFlowDialect",
    srcs = glob(
        [
            "lib/Dialect/ControlFlow/IR/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/ControlFlow/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":ControlFlowInterfaces",
        ":ControlFlowOpsIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":InliningUtils",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ControlFlowTransforms",
    srcs = glob([
        "lib/Dialect/ControlFlow/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/ControlFlow/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":ControlFlowDialect",
        ":IR",
        ":MemRefDialect",
    ],
)

cc_library(
    name = "FuncDialect",
    srcs = glob(
        [
            "lib/Dialect/Func/IR/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Func/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":ConvertToLLVMInterface",
        ":FuncIncGen",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "FuncExtensions",
    srcs = glob(["lib/Dialect/Func/Extensions/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Func/Extensions/*.h"]),
    includes = ["include"],
    deps = [
        ":ControlFlowDialect",
        ":FuncDialect",
        ":IR",
        ":InliningUtils",
        ":MeshShardingInterface",
    ],
)

td_library(
    name = "FuncTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "FuncTransformOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.td",
    deps = [
        ":FuncTransformOpsTdFiles",
    ],
)

cc_library(
    name = "FuncTransformOps",
    srcs = [
        "lib/Dialect/Func/TransformOps/FuncTransformOps.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.h",
    ],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncTransformOpsIncGen",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformUtils",
    ],
)

cc_library(
    name = "AllExtensions",
    hdrs = ["include/mlir/InitAllExtensions.h"],
    deps = [
        ":AffineTransformOps",
        ":ArithToLLVM",
        ":BufferizationTransformOps",
        ":BuiltinToLLVMIRTranslation",
        ":ComplexToLLVM",
        ":ControlFlowToLLVM",
        ":DLTITransformOps",
        ":FuncExtensions",
        ":FuncToLLVM",
        ":FuncTransformOps",
        ":GPUToLLVMIRTranslation",
        ":GPUTransformOps",
        ":IndexToLLVM",
        ":LLVMToLLVMIRTranslation",
        ":LinalgTransformOps",
        ":MathToLLVM",
        ":MemRefToLLVM",
        ":MemRefTransformOps",
        ":MeshDialect",
        ":NVGPUTransformOps",
        ":NVVMTarget",
        ":NVVMToLLVM",
        ":ROCDLTarget",
        ":ROCDLToLLVMIRTranslation",
        ":SCFTransformOps",
        ":SparseTensorTransformOps",
        ":TensorExtensions",
        ":TensorTransformOps",
        ":TransformDebugExtension",
        ":TransformIRDLExtension",
        ":TransformLoopExtension",
        ":TransformPDLExtension",
        ":UBToLLVM",
        ":VCIXToLLVMIRTranslation",
        ":VectorTransformOps",
    ],
)

# TODO(zinenko): remove this after updating users.

gentbl_cc_library(
    name = "FuncTransformsPassIncGen",
    tbl_outs = [(
        [
            "-gen-pass-decls",
            "-name=Func",
        ],
        "include/mlir/Dialect/Func/Transforms/Passes.h.inc",
    )],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Func/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "FuncTransforms",
    srcs = glob([
        "lib/Dialect/Func/Transforms/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Dialect/Func/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":FuncDialect",
        ":FuncTransformsPassIncGen",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorDialect",
    srcs = glob(
        [
            "lib/Dialect/Vector/IR/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Vector/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":ControlFlowInterfaces",
        ":DestinationStyleOpInterface",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MaskableOpInterface",
        ":MaskingOpInterface",
        ":MemRefDialect",
        ":SideEffectInterfaces",
        ":SubsetOpInterface",
        ":Support",
        ":TensorDialect",
        ":ValueBoundsOpInterface",
        ":VectorAttributesIncGen",
        ":VectorDialectIncGen",
        ":VectorInterfaces",
        ":VectorOpsIncGen",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorTransformOps",
    srcs = [
        "lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h",
    ],
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorToLLVM",
        ":VectorToSCF",
        ":VectorTransformOpsIncGen",
        ":VectorTransforms",
        ":X86VectorTransforms",
    ],
)

td_library(
    name = "VectorTransformsTdFiles",
    srcs = ["include/mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "VectorEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Vector/Transforms/VectorTransformsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Vector/Transforms/VectorTransformsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/Transforms/VectorTransformsBase.td",
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "VectorPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Vector",
            ],
            "include/mlir/Dialect/Vector/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "VectorTransforms",
    srcs = glob(
        [
            "lib/Dialect/Vector/Transforms/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Vector/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":ArithTransforms",
        ":ArithUtils",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":FunctionInterfaces",
        ":IR",
        ":LinalgDialect",
        ":MemRefDialect",
        ":MemRefUtils",
        ":Pass",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":SubsetOpInterface",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorEnumsIncGen",
        ":VectorInterfaces",
        ":VectorPassIncGen",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorUtils",
    srcs = glob(
        [
            "lib/Dialect/Vector/Utils/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Vector/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":ArithDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Support",
        ":TensorDialect",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "Support",
    srcs = glob([
        "lib/Support/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Support/*.h"]),
    includes = ["include"],
    deps = ["//llvm:Support"],
)

cc_library(
    name = "Debug",
    srcs = glob([
        "lib/Debug/*.cpp",
        "lib/Debug/BreakpointManagers/*.cpp",
        "lib/Debug/Observers/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Debug/*.h",
        "include/mlir/Debug/BreakpointManagers/*.h",
        "include/mlir/Debug/Observers/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":CAPIIR",
        ":IR",
        ":Rewrite",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirLspServerSupportLib",
    srcs = glob(
        [
            "lib/Tools/lsp-server-support/*.cpp",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Tools/lsp-server-support/*.h",
        ],
    ),
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirLspServerLib",
    srcs = glob(
        [
            "lib/Tools/mlir-lsp-server/*.cpp",
            "lib/Tools/mlir-lsp-server/*.h",
        ],
    ),
    hdrs = glob(
        ["include/mlir/Tools/mlir-lsp-server/*.h"],
    ),
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":BytecodeWriter",
        ":FunctionInterfaces",
        ":IR",
        ":MlirLspServerSupportLib",
        ":Parser",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirPdllLspServerLib",
    srcs = glob(
        [
            "lib/Tools/mlir-pdll-lsp-server/*.cpp",
            "lib/Tools/mlir-pdll-lsp-server/*.h",
        ],
    ),
    hdrs = glob(
        ["include/mlir/Tools/mlir-pdll-lsp-server/*.h"],
    ),
    includes = ["include"],
    deps = [
        ":IR",
        ":MlirLspServerSupportLib",
        ":PDLLAST",
        ":PDLLCodeGen",
        ":PDLLODS",
        ":PDLLParser",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TableGenLspServerLib",
    srcs = glob([
        "lib/Tools/tblgen-lsp-server/*.cpp",
        "lib/Tools/tblgen-lsp-server/*.h",
    ]),
    hdrs = glob(["include/mlir/Tools/tblgen-lsp-server/*.h"]),
    includes = ["include"],
    deps = [
        ":MlirLspServerSupportLib",
        ":Support",
        "//llvm:Support",
        "//llvm:TableGen",
    ],
)

cc_binary(
    name = "tblgen-lsp-server",
    srcs = ["tools/tblgen-lsp-server/tblgen-lsp-server.cpp"],
    includes = ["include"],
    deps = [
        ":Support",
        ":TableGenLspServerLib",
    ],
)

cc_library(
    name = "AsmParserTokenKinds",
    # strip_include_prefix does not apply to textual_hdrs.
    hdrs = ["lib/AsmParser/TokenKinds.def"],
    strip_include_prefix = "lib/AsmParser",
    textual_hdrs = ["lib/AsmParser/TokenKinds.def"],
)

cc_library(
    name = "AsmParser",
    srcs = glob([
        "lib/AsmParser/*.cpp",
        "lib/AsmParser/*.h",
    ]),
    hdrs = glob([
        "include/mlir/AsmParser/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AsmParserTokenKinds",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "BytecodeReader",
    srcs = glob([
        "lib/Bytecode/Reader/*.cpp",
    ]),
    hdrs = ["include/mlir/Bytecode/BytecodeReader.h"],
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":BytecodeOpInterface",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "BytecodeWriter",
    srcs = glob([
        "lib/Bytecode/Writer/*.cpp",
        "lib/Bytecode/Writer/*.h",
    ]),
    hdrs = ["include/mlir/Bytecode/BytecodeWriter.h"],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":IR",
        ":Support",
        "//llvm:Support",
        "//llvm:config",
    ],
)

cc_library(
    name = "Parser",
    srcs = glob([
        "lib/Parser/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Parser/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":BytecodeReader",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LLVMDialectInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMInterfaces.cpp.inc",
        ),
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMAttrInterfaces.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMAttrInterfaces.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMInterfaces.td",
    deps = [":LLVMOpsTdFiles"],
)

cc_library(
    name = "LLVMDialect",
    srcs = glob(
        [
            "lib/Dialect/LLVMIR/IR/*.cpp",
            "lib/Dialect/LLVMIR/IR/*.h",
        ],
        exclude = [
            "lib/Dialect/LLVMIR/IR/*AMX*.cpp",
            "lib/Dialect/LLVMIR/IR/*AMX*.h",
            "lib/Dialect/LLVMIR/IR/*ArmSVE*.cpp",
            "lib/Dialect/LLVMIR/IR/*ArmSVE*.h",
            "lib/Dialect/LLVMIR/IR/NVVM*.cpp",
            "lib/Dialect/LLVMIR/IR/NVVM*.h",
            "lib/Dialect/LLVMIR/IR/ROCDL*.cpp",
            "lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp",
            "lib/Dialect/LLVMIR/IR/ROCDL*.h",
            "lib/Dialect/LLVMIR/IR/VCIX*.cpp",
            "lib/Dialect/LLVMIR/IR/VCIX*.h",
            "lib/Dialect/LLVMIR/IR/*X86Vector*.cpp",
            "lib/Dialect/LLVMIR/IR/*X86Vector*.h",
        ],
    ),
    hdrs = glob(
        ["include/mlir/Dialect/LLVMIR/*.h"],
        exclude = [
            "include/mlir/Dialect/LLVMIR/*AMX*.h",
            "include/mlir/Dialect/LLVMIR/*ArmSVE*.h",
            "include/mlir/Dialect/LLVMIR/NVVM*.h",
            "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h",
            "include/mlir/Dialect/LLVMIR/ROCDL*.h",
            "include/mlir/Dialect/LLVMIR/VCIX*.h",
            "include/mlir/Dialect/LLVMIR/*X86Vector*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":DataLayoutInterfaces",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":LLVMDialectInterfaceIncGen",
        ":LLVMIntrinsicOpsIncGen",
        ":LLVMOpsIncGen",
        ":LLVMTypesIncGen",
        ":MemorySlotInterfaces",
        ":MemorySlotInterfacesIncGen",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:AsmParser",
        "//llvm:BinaryFormat",
        "//llvm:BitReader",
        "//llvm:BitWriter",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LLVMPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=LLVM",
            ],
            "include/mlir/Dialect/LLVMIR/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "LLVMIRTransforms",
    srcs = glob([
        "lib/Dialect/LLVMIR/Transforms/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Dialect/LLVMIR/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":DataLayoutInterfaces",
        ":FuncDialect",
        ":IR",
        ":InliningUtils",
        ":LLVMDialect",
        ":LLVMPassIncGen",
        ":NVVMDialect",
        ":Pass",
        ":TransformUtils",
        "//llvm:BinaryFormat",
        "//llvm:Support",
    ],
)

td_library(
    name = "GPUOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td",
        "include/mlir/Dialect/GPU/IR/CompilationAttrs.td",
        "include/mlir/Dialect/GPU/IR/GPUBase.td",
        "include/mlir/Dialect/GPU/IR/GPUDeviceMappingAttr.td",
        "include/mlir/Dialect/GPU/IR/GPUOps.td",
        "include/mlir/Dialect/GPU/IR/ParallelLoopMapperAttr.td",
    ],
    includes = ["include"],
    deps = [
        ":DLTIDialectTdFiles",
        ":DataLayoutInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferIntRangeInterfaceTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SCFTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "GPUDeviceMapperEnumsGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/GPU/TransformOps/GPUDeviceMapperEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/GPU/TransformOps/GPUDeviceMapperEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/IR/GPUDeviceMappingAttr.td",
    deps = [
        ":GPUOpsTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "GPUCompilationAttrInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td",
    deps = [
        ":AttrTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "GPUBaseIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/IR/GPUBase.td",
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "GPUOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=gpu",
            ],
            "include/mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=gpu",
            ],
            "include/mlir/Dialect/GPU/IR/GPUOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOpsEnums.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/IR/GPUOps.td",
    deps = [
        ":DLTIDialectTdFiles",
        ":GPUOpsTdFiles",
    ],
)

cc_library(
    name = "GPUDialect",
    srcs = glob(
        [
            "lib/Dialect/GPU/IR/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/GPU/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":ControlFlowInterfaces",
        ":DLTIDialect",
        ":FunctionInterfaces",
        ":GPUBaseIncGen",
        ":GPUCompilationAttrInterfacesIncGen",
        ":GPUOpsIncGen",
        ":IR",
        ":InferIntRangeInterface",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MemRefDialect",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "GPUPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=GPU",
            ],
            "include/mlir/Dialect/GPU/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=GPU",
            ],
            "include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=GPU",
            ],
            "include/mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "GPUPipelines",
    srcs = ["lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp"],
    hdrs = ["include/mlir/Dialect/GPU/Pipelines/Passes.h"],
    includes = ["include"],
    deps = [
        ":AffineToStandard",
        ":ArithToLLVM",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":GPUToNVVMTransforms",
        ":GPUTransforms",
        ":IndexToLLVM",
        ":LLVMDialect",
        ":LinalgTransforms",
        ":MathToLLVM",
        ":MemRefToLLVM",
        ":MemRefTransforms",
        ":NVGPUToNVVM",
        ":NVVMToLLVM",
        ":Pass",
        ":ReconcileUnrealizedCasts",
        ":SCFToControlFlow",
        ":Transforms",
        ":VectorToLLVM",
        ":VectorToSCF",
    ],
)

cc_library(
    name = "GPUTransforms",
    srcs = glob(
        [
            "lib/Dialect/GPU/Transforms/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/GPU/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithDialect",
        ":AsmParser",
        ":AsyncDialect",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":ControlFlowDialect",
        ":DLTIDialect",
        ":DialectUtils",
        ":ExecutionEngineUtils",
        ":FuncDialect",
        ":GPUDialect",
        ":GPUPassIncGen",
        ":GPUToLLVMIRTranslation",
        ":IR",
        ":IndexDialect",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":MemRefDialect",
        ":NVVMDialect",
        ":NVVMTarget",
        ":Pass",
        ":ROCDLDialect",
        ":ROCDLTarget",
        ":ROCDLToLLVMIRTranslation",
        ":SCFDialect",
        ":SPIRVDialect",
        ":SPIRVTarget",
        ":SideEffectInterfaces",
        ":Support",
        ":ToLLVMIRTranslation",
        ":TransformUtils",
        ":Transforms",
        ":VCIXToLLVMIRTranslation",
        ":VectorDialect",
        ":config",
        "//llvm:Core",
        "//llvm:MC",
        "//llvm:Support",
        "//llvm:Target",
    ] + if_cuda_available([
        ":NVVMToLLVMIRTranslation",
        "//llvm:NVPTXCodeGen",
    ]),
)

td_library(
    name = "GPUTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "GPUTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.td",
    deps = [
        ":GPUTransformOpsTdFiles",
    ],
)

cc_library(
    name = "GPUTransformOps",
    srcs = glob([
        "lib/Dialect/GPU/TransformOps/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/GPU/TransformOps/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":GPUToNVVMTransforms",
        ":GPUTransformOpsIncGen",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":MemRefDialect",
        ":NVVMDialect",
        ":SCFDialect",
        ":Support",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorTransforms",
        "//llvm:Support",
    ],
)

td_library(
    name = "LLVMOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td",
        "include/mlir/Dialect/LLVMIR/LLVMDialect.td",
        "include/mlir/Dialect/LLVMIR/LLVMEnums.td",
        "include/mlir/Dialect/LLVMIR/LLVMInterfaces.td",
        "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td",
        "include/mlir/Dialect/LLVMIR/LLVMOpBase.td",
        "include/mlir/Dialect/LLVMIR/LLVMOps.td",
        "include/mlir/Dialect/LLVMIR/LLVMTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":DataLayoutInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":MemorySlotInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

cc_library(
    name = "GPUCommonTransforms",
    hdrs = [
        "lib/Conversion/GPUCommon/GPUOpsLowering.h",
        "lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h",
        "lib/Conversion/GPUCommon/OpToFuncCallLowering.h",
    ],
    deps = [
        ":ArithDialect",
        ":GPUDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
    ],
)

gentbl_cc_library(
    name = "GPUToNVVMGen",
    strip_include_prefix = "lib/Conversion/GPUToNVVM",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Conversion/GPUToNVVM/GPUToNVVM.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Conversion/GPUToNVVM/GPUToNVVM.td",
    deps = [
        ":GPUOpsTdFiles",
        ":NVVMOpsTdFiles",
    ],
)

cc_library(
    name = "GPUToLLVMSPVTransforms",
    srcs = glob([
        "lib/Conversion/GPUToLLVMSPV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/GPUToLLVMSPV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":SPIRVCommonAttrToLLVMConversion",
        ":SPIRVDialect",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToNVVMTransforms",
    srcs = glob([
        "lib/Conversion/GPUToNVVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/GPUToNVVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithToLLVM",
        ":ControlFlowDialect",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUCommonTransforms",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":GPUToNVVMGen",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":NVGPUDialect",
        ":NVVMDialect",
        ":TransformUtils",
        ":VectorToLLVM",
    ],
)

cc_library(
    name = "AMDGPUToROCDL",
    srcs = glob([
        "lib/Conversion/AMDGPUToROCDL/*.cpp",
    ]) + ["include/mlir/Conversion/GPUToROCDL/Runtimes.h"],
    hdrs = glob([
        "include/mlir/Conversion/AMDGPUToROCDL/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AMDGPUDialect",
        ":AMDGPUUtils",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":ROCDLDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "NVGPUToNVVM",
    srcs = glob([
        "lib/Conversion/NVGPUToNVVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/NVGPUToNVVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":NVGPUDialect",
        ":NVVMDialect",
        ":Pass",
        ":SCFTransforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToSPIRV",
    srcs = glob([
        "lib/Conversion/VectorToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/VectorToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":TransformUtils",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "GPUToROCDLTGen",
    strip_include_prefix = "lib/Conversion/GPUToROCDL",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Conversion/GPUToROCDL/GPUToROCDL.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Conversion/GPUToROCDL/GPUToROCDL.td",
    deps = [
        ":GPUOpsTdFiles",
        ":ROCDLOpsTdFiles",
    ],
)

cc_library(
    name = "GPUToROCDLTransforms",
    srcs = [
        "include/mlir/Conversion/GPUToROCDL/Runtimes.h",
        "lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp",
    ],
    hdrs = ["include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h"],
    includes = ["include"],
    deps = [
        ":AMDGPUToROCDL",
        ":ArithToLLVM",
        ":ArithTransforms",
        ":ControlFlowDialect",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUCommonTransforms",
        ":GPUDialect",
        ":GPUToGPURuntimeTransforms",
        ":GPUToROCDLTGen",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":MathToLLVM",
        ":MathToROCDL",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":Pass",
        ":ROCDLDialect",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
        ":VectorToLLVM",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToVulkanTransforms",
    srcs = [
        "lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp",
        "lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp",
    ],
    hdrs = ["include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"],
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":GPUDialect",
        ":IR",
        ":LLVMDialect",
        ":Pass",
        ":SPIRVDialect",
        ":SPIRVSerialization",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToGPURuntimeTransforms",
    srcs = [
        "lib/Conversion/GPUCommon/AttrToSPIRVConverter.cpp",
        "lib/Conversion/GPUCommon/GPUOpsLowering.cpp",
        "lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp",
    ],
    hdrs = [
        "include/mlir/Conversion/GPUCommon/AttrToSPIRVConverter.h",
        "include/mlir/Conversion/GPUCommon/GPUCommonPass.h",
        "lib/Conversion/GPUCommon/GPUOpsLowering.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithToLLVM",
        ":AsyncDialect",
        ":AsyncToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":ConvertToLLVM",
        ":ConvertToLLVMInterface",
        ":FuncToLLVM",
        ":GPUCommonTransforms",
        ":GPUDialect",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":SPIRVDialect",
        ":Support",
        ":VectorToLLVM",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToSPIRV",
    srcs = glob([
        "lib/Conversion/GPUToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/GPUToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversions/GPUToSPIRV",
    ],
    deps = [
        ":ArithToSPIRV",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToSPIRV",
        ":GPUDialect",
        ":IR",
        ":MemRefToSPIRV",
        ":SCFToSPIRV",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":TransformUtils",
        ":VectorToSPIRV",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLToPDLInterp",
    srcs = glob([
        "lib/Conversion/PDLToPDLInterp/*.cpp",
        "lib/Conversion/PDLToPDLInterp/*.h",
    ]),
    hdrs = [
        "include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h",
        "lib/Conversion/PDLToPDLInterp/RootOrdering.h",
    ],
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":InferTypeOpInterface",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVToLLVM",
    srcs = glob([
        "lib/Conversion/SPIRVToLLVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/SPIRVToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefToLLVM",
        ":Pass",
        ":SPIRVCommonAttrToLLVMConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LLVMOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.cpp.inc",
        ),
        (
            [
                "--gen-attrdef-decls",
                "-attrdefs-dialect=llvm",
            ],
            "include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc",
        ),
        (
            [
                "--gen-attrdef-defs",
                "-attrdefs-dialect=llvm",
            ],
            "include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMOps.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMTypesIncGen",
    tbl_outs = [
        (
            [
                "-gen-typedef-decls",
                "-typedefs-dialect=llvm",
            ],
            "include/mlir/Dialect/LLVMIR/LLVMTypes.h.inc",
        ),
        (
            [
                "-gen-typedef-defs",
                "-typedefs-dialect=llvm",
            ],
            "include/mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMTypes.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMIntrinsicOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMConversions.inc",
        ),
        (
            ["-gen-enum-to-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc",
        ),
        (
            ["-gen-enum-from-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc",
        ),
        (
            ["-gen-op-from-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMOps.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMIntrinsicConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc",
        ),
        (
            ["-gen-intr-from-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicFromLLVMIRConversions.inc",
        ),
        (
            ["-gen-convertible-llvmir-intrinsics"],
            "include/mlir/Dialect/LLVMIR/LLVMConvertibleLLVMIRIntrinsics.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td",
    deps = [":LLVMOpsTdFiles"],
)

cc_library(
    name = "NVVMDialect",
    srcs = ["lib/Dialect/LLVMIR/IR/NVVMDialect.cpp"],
    hdrs = ["include/mlir/Dialect/LLVMIR/NVVMDialect.h"],
    includes = ["include"],
    deps = [
        ":BasicPtxBuilderInterface",
        ":BytecodeOpInterface",
        ":ConvertToLLVMInterface",
        ":DialectUtils",
        ":GPUDialect",
        ":IR",
        ":LLVMDialect",
        ":NVVMOpsIncGen",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:AsmParser",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TargetLLVM",
    srcs = ["lib/Target/LLVM/ModuleToObject.cpp"],
    hdrs = glob(["include/mlir/Target/LLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ExecutionEngineUtils",
        ":IR",
        ":LLVMToLLVMIRTranslation",
        ":ToLLVMIRTranslation",
        "//llvm:BitWriter",
        "//llvm:Core",
        "//llvm:IPO",
        "//llvm:IRReader",
        "//llvm:Linker",
        "//llvm:MC",
        "//llvm:Passes",
        "//llvm:Support",
        "//llvm:Target",
        "//llvm:TargetParser",
    ],
)

cc_library(
    name = "NVVMTarget",
    srcs = ["lib/Target/LLVM/NVVM/Target.cpp"],
    hdrs = glob(["include/mlir/Target/LLVM/NVVM/*.h"]),
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":GPUToLLVMIRTranslation",
        ":LLVMToLLVMIRTranslation",
        ":NVVMDialect",
        ":NVVMToLLVMIRTranslation",
        ":TargetLLVM",
        ":ToLLVMIRTranslation",
        "//llvm:NVPTXCodeGen",
        "//llvm:Support",
        "//llvm:config",
    ],
)

td_library(
    name = "BasicPtxBuilderIntTdFiles",
    srcs = [
        "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":GPUOpsTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
    ],
)

td_library(
    name = "NVVMOpsTdFiles",
    srcs = ["include/mlir/Dialect/LLVMIR/NVVMOps.td"],
    includes = ["include"],
    deps = [
        ":BasicPtxBuilderIntTdFiles",
        ":GPUOpsTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "BasicPtxBuilderIntGen",
    tbl_outs = [
        (
            [
                "-gen-op-interface-decls",
            ],
            "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h.inc",
        ),
        (
            [
                "-gen-op-interface-defs",
            ],
            "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td",
    deps = [
        ":BasicPtxBuilderIntTdFiles",
        ":GPUOpsTdFiles",
        ":LLVMOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "NVVMOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/NVVMOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/LLVMIR/NVVMOpsEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td",
    deps = [":NVVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "NVVMConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/NVVMConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td",
    deps = [":NVVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "NVVMFromLLVMIRConversionsIncGen",
    tbl_outs = [
        (
            ["-gen-intr-from-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/NVVMFromLLVMIRConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td",
    deps = [":NVVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "NVVMConvertibleLLVMIRIntrinsicsIncGen",
    tbl_outs = [
        (
            ["-gen-convertible-llvmir-intrinsics"],
            "include/mlir/Dialect/LLVMIR/NVVMConvertibleLLVMIRIntrinsics.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td",
    deps = [":NVVMOpsTdFiles"],
)

cc_library(
    name = "BasicPtxBuilderInterface",
    srcs = ["lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp"],
    hdrs = [
        "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h",
    ],
    includes = ["include"],
    deps = [
        ":BasicPtxBuilderIntGen",
        ":IR",
        ":LLVMDialect",
        ":Support",
    ],
)

cc_library(
    name = "NVVMToLLVM",
    srcs = ["lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp"],
    hdrs = glob(["include/mlir/Conversion/NVVMToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":NVVMDialect",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ROCDLDialect",
    srcs = ["lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp"],
    hdrs = ["include/mlir/Dialect/LLVMIR/ROCDLDialect.h"],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":GPUDialect",
        ":IR",
        ":LLVMDialect",
        ":ROCDLOpsIncGen",
        ":SideEffectInterfaces",
        "//llvm:AsmParser",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ROCDLTarget",
    srcs = [
        "lib/Target/LLVM/ROCDL/Target.cpp",
        "lib/Target/LLVM/ROCDL/Utils.cpp",
    ],
    hdrs = glob(["include/mlir/Target/LLVM/ROCDL/*.h"]),
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":GPUToLLVMIRTranslation",
        ":LLVMToLLVMIRTranslation",
        ":ROCDLDialect",
        ":ROCDLToLLVMIRTranslation",
        ":Support",
        ":TargetLLVM",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:FrontendOffloading",
        "//llvm:MC",
        "//llvm:MCParser",
        "//llvm:Support",
        "//llvm:TargetParser",
    ],
)

td_library(
    name = "ROCDLOpsTdFiles",
    srcs = ["include/mlir/Dialect/LLVMIR/ROCDLOps.td"],
    includes = ["include"],
    deps = [
        ":GPUOpsTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ROCDLOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/ROCDLOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=rocdl",
            ],
            "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=rocdl",
            ],
            "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=rocdl",
            ],
            "include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=rocdl",
            ],
            "include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td",
    deps = [":ROCDLOpsTdFiles"],
)

gentbl_cc_library(
    name = "ROCDLConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/ROCDLConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td",
    deps = [":ROCDLOpsTdFiles"],
)

cc_library(
    name = "PDLDialect",
    srcs = glob([
        "lib/Dialect/PDL/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/PDL/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":IR",
        ":InferTypeOpInterface",
        ":PDLOpsIncGen",
        ":PDLTypesIncGen",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

td_library(
    name = "PDLDialectTdFiles",
    srcs = [
        "include/mlir/Dialect/PDL/IR/PDLDialect.td",
        "include/mlir/Dialect/PDL/IR/PDLOps.td",
        "include/mlir/Dialect/PDL/IR/PDLTypes.td",
    ],
    deps = [
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "PDLOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/PDL/IR/PDLOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/PDL/IR/PDLOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/PDL/IR/PDLOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/PDL/IR/PDLOps.td",
    deps = [":PDLDialectTdFiles"],
)

gentbl_cc_library(
    name = "PDLTypesIncGen",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/PDL/IR/PDLTypes.td",
    deps = [":PDLDialectTdFiles"],
)

cc_library(
    name = "PDLInterpDialect",
    srcs = glob([
        "lib/Dialect/PDLInterp/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/PDLInterp/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":PDLDialect",
        ":PDLInterpOpsIncGen",
        ":SideEffectInterfaces",
    ],
)

td_library(
    name = "PDLInterpOpsTdFiles",
    srcs = ["include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td"],
    includes = ["include"],
    deps = [
        ":FunctionInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":PDLDialectTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "PDLInterpOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=pdl_interp",
            ],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=pdl_interp",
            ],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td",
    deps = [":PDLInterpOpsTdFiles"],
)

cc_library(
    name = "PolynomialDialect",
    srcs = glob([
        "lib/Dialect/Polynomial/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Polynomial/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":PolynomialAttributesIncGen",
        ":PolynomialCanonicalizationIncGen",
        ":PolynomialIncGen",
        ":Support",
        "//llvm:Support",
    ],
)

td_library(
    name = "PolynomialTdFiles",
    srcs = glob(["include/mlir/Dialect/Polynomial/IR/*.td"]),
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "PolynomialIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Polynomial/IR/Polynomial.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Polynomial/IR/Polynomial.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=polynomial",
            ],
            "include/mlir/Dialect/Polynomial/IR/PolynomialDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=polynomial",
            ],
            "include/mlir/Dialect/Polynomial/IR/PolynomialDialect.cpp.inc",
        ),
        (
            [
                "--gen-typedef-decls",
                "-typedefs-dialect=polynomial",
            ],
            "include/mlir/Dialect/Polynomial/IR/PolynomialTypes.h.inc",
        ),
        (
            [
                "--gen-typedef-defs",
                "-typedefs-dialect=polynomial",
            ],
            "include/mlir/Dialect/Polynomial/IR/PolynomialTypes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Polynomial/Polynomial.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Polynomial/IR/Polynomial.td",
    deps = [":PolynomialTdFiles"],
)

gentbl_cc_library(
    name = "PolynomialAttributesIncGen",
    tbl_outs = [
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=polynomial",
            ],
            "include/mlir/Dialect/Polynomial/IR/PolynomialAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=polynomial",
            ],
            "include/mlir/Dialect/Polynomial/IR/PolynomialAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Polynomial/IR/Polynomial.td",
    deps = [":PolynomialTdFiles"],
)

gentbl_cc_library(
    name = "PolynomialCanonicalizationIncGen",
    strip_include_prefix = "include/mlir/Dialect/Polynomial/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "include/mlir/Dialect/Polynomial/IR/PolynomialCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/Polynomial/IR/PolynomialCanonicalization.td",
    deps = [
        ":ArithOpsTdFiles",
        ":PolynomialTdFiles",
    ],
)

td_library(
    name = "PtrTdFiles",
    srcs = [
        "include/mlir/Dialect/Ptr/IR/PtrAttrDefs.td",
        "include/mlir/Dialect/Ptr/IR/PtrDialect.td",
        "include/mlir/Dialect/Ptr/IR/PtrOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
        ":BuiltinDialectTdFiles",
        ":DataLayoutInterfacesTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "PtrDialectIncGen",
    tbl_outs = [
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Ptr/IR/PtrOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Ptr/IR/PtrOpsDialect.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/Ptr/IR/PtrOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/Ptr/IR/PtrOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Ptr/IR/PtrDialect.td",
    deps = [
        ":PtrTdFiles",
    ],
)

gentbl_cc_library(
    name = "PtrOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Ptr/IR/PtrOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Ptr/IR/PtrOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Ptr/IR/PtrOps.td",
    deps = [
        ":PtrTdFiles",
    ],
)

gentbl_cc_library(
    name = "PtrAttrsIncGen",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Ptr/IR/PtrOpsAttrs.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Ptr/IR/PtrOpsAttrs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Ptr/IR/PtrAttrDefs.td",
    deps = [
        ":PtrTdFiles",
    ],
)

cc_library(
    name = "PtrDialect",
    srcs = glob(
        [
            "lib/Dialect/Ptr/IR/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Ptr/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":DataLayoutInterfaces",
        ":IR",
        ":InliningUtils",
        ":PtrAttrsIncGen",
        ":PtrDialectIncGen",
        ":PtrOpsIncGen",
        "//llvm:Support",
    ],
)

td_library(
    name = "SPIRVOpsTdFiles",
    srcs = glob(["include/mlir/Dialect/SPIRV/IR/*.td"]),
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "SPIRVOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/SPIRV/SPIRVOps.md",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnums.cpp.inc",
        ),
        (
            ["-gen-spirv-enum-avail-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.h.inc",
        ),
        (
            ["-gen-spirv-enum-avail-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.cpp.inc",
        ),
        (
            ["-gen-spirv-capability-implication"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVCapabilityImplication.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVAttributesIncGen",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVCanonicalizationIncGen",
    strip_include_prefix = "lib/Dialect/SPIRV/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Dialect/SPIRV/IR/SPIRVCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVAvailabilityIncGen",
    tbl_outs = [
        (
            ["-gen-avail-interface-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc",
        ),
        (
            ["-gen-avail-interface-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.cpp.inc",
        ),
        (
            ["-gen-spirv-avail-impls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOpAvailabilityImpl.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVAttrUtilsGen",
    tbl_outs = [
        (
            ["-gen-spirv-attr-utils"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAttrUtils.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVBase.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVSerializationGen",
    tbl_outs = [
        (
            ["-gen-spirv-serialization"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVSerialization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td",
    deps = [":SPIRVOpsTdFiles"],
)

cc_library(
    name = "SPIRVDialect",
    srcs = glob([
        "lib/Dialect/SPIRV/IR/*.cpp",
        "lib/Dialect/SPIRV/IR/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SPIRV/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":CommonFolders",
        ":ControlFlowInterfaces",
        ":FunctionInterfaces",
        ":GPUDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":Parser",
        ":SPIRVAttrUtilsGen",
        ":SPIRVAttributesIncGen",
        ":SPIRVAvailabilityIncGen",
        ":SPIRVCanonicalizationIncGen",
        ":SPIRVOpsIncGen",
        ":SideEffectInterfaces",
        ":Support",
        ":UBDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVTarget",
    srcs = ["lib/Target/SPIRV/Target.cpp"],
    hdrs = ["include/mlir/Target/SPIRV/Target.h"],
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":SPIRVDialect",
        ":SPIRVSerialization",
    ],
)

gentbl_cc_library(
    name = "SPIRVPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=SPIRV",
            ],
            "include/mlir/Dialect/SPIRV/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "SPIRVUtils",
    srcs = glob([
        "lib/Dialect/SPIRV/Utils/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SPIRV/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [":SPIRVDialect"],
)

cc_library(
    name = "SPIRVConversion",
    srcs = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"],
    hdrs = ["include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SPIRVDialect",
        ":Support",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorTransforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVTransforms",
    srcs = glob(
        [
            "lib/Dialect/SPIRV/Transforms/*.cpp",
        ],
        exclude = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"],
    ),
    hdrs = glob(
        ["include/mlir/Dialect/SPIRV/Transforms/*.h"],
        exclude = ["include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"],
    ),
    includes = ["include"],
    deps = [
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVPassIncGen",
        ":SPIRVUtils",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVCommonConversion",
    hdrs = ["lib/Conversion/SPIRVCommon/Pattern.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVCommonAttrToLLVMConversion",
    srcs = ["lib/Conversion/SPIRVCommon/AttrToLLVMConverter.cpp"],
    hdrs = ["include/mlir/Conversion/SPIRVCommon/AttrToLLVMConverter.h"],
    includes = ["include"],
    deps = [
        ":SPIRVDialect",
    ],
)

cc_library(
    name = "MathToSPIRV",
    srcs = glob([
        "lib/Conversion/MathToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/MathToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/MathToSPIRV",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":MathDialect",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MathToROCDL",
    srcs = glob([
        "lib/Conversion/MathToROCDL/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/MathToROCDL/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":GPUCommonTransforms",
        ":GPUToGPURuntimeTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":Pass",
        ":ROCDLDialect",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

cc_library(
    name = "FuncToEmitC",
    srcs = glob([
        "lib/Conversion/FuncToEmitC/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/FuncToEmitC/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/FuncToEmitC",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":EmitCDialect",
        ":FuncDialect",
        ":Pass",
        ":TransformUtils",
    ],
)

cc_library(
    name = "FuncToSPIRV",
    srcs = glob([
        "lib/Conversion/FuncToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/FuncToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/FuncToSPIRV",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorToLinalg",
    srcs = glob([
        "lib/Conversion/TensorToLinalg/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TensorToLinalg/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TensorToLinalg",
    ],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":Pass",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorToSPIRV",
    srcs = glob([
        "lib/Conversion/TensorToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TensorToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TensorToSPIRV",
    ],
    deps = [
        ":ArithToSPIRV",
        ":ConversionPassIncGen",
        ":FuncToSPIRV",
        ":IR",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVBinaryUtils",
    srcs = ["lib/Target/SPIRV/SPIRVBinaryUtils.cpp"],
    hdrs = ["include/mlir/Target/SPIRV/SPIRVBinaryUtils.h"],
    includes = ["include"],
    deps = [
        ":SPIRVDialect",
        ":Support",
        "//llvm:config",
    ],
)

cc_library(
    name = "SPIRVSerialization",
    srcs = [
        "lib/Target/SPIRV/Serialization/Serialization.cpp",
        "lib/Target/SPIRV/Serialization/SerializeOps.cpp",
        "lib/Target/SPIRV/Serialization/Serializer.cpp",
        "lib/Target/SPIRV/Serialization/Serializer.h",
    ],
    hdrs = ["include/mlir/Target/SPIRV/Serialization.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVBinaryUtils",
        ":SPIRVDialect",
        ":SPIRVSerializationGen",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVDeserialization",
    srcs = glob([
        "lib/Target/SPIRV/Deserialization/*.cpp",
        "lib/Target/SPIRV/Deserialization/*.h",
    ]),
    hdrs = ["include/mlir/Target/SPIRV/Deserialization.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVBinaryUtils",
        ":SPIRVDialect",
        ":SPIRVSerializationGen",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVModuleCombiner",
    srcs = glob(
        ["lib/Dialect/SPIRV/Linking/ModuleCombiner/*.cpp"],
    ),
    hdrs = ["include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVDialect",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVTranslateRegistration",
    srcs = ["lib/Target/SPIRV/TranslateRegistration.cpp"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":SPIRVDeserialization",
        ":SPIRVDialect",
        ":SPIRVSerialization",
        ":Support",
        ":TranslateLib",
        "//llvm:Support",
    ],
)

td_library(
    name = "TensorOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Tensor/IR/TensorBase.td",
        "include/mlir/Dialect/Tensor/IR/TensorOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":DestinationStyleOpInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":ParallelCombiningOpInterfaceTdFiles",
        ":ShapedOpInterfacesTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":TilingInterfaceTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "TensorOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=tensor",
            ],
            "include/mlir/Dialect/Tensor/IR/TensorOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=tensor",
            ],
            "include/mlir/Dialect/Tensor/IR/TensorOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Tensor/IR/TensorOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Tensor/IR/TensorOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tensor/IR/TensorOps.td",
    deps = [":TensorOpsTdFiles"],
)

cc_library(
    name = "TensorDialect",
    srcs = [
        "lib/Dialect/Tensor/IR/TensorDialect.cpp",
        "lib/Dialect/Tensor/IR/TensorOps.cpp",
        "lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Tensor/IR/ShardingInterfaceImpl.h",
        "include/mlir/Dialect/Tensor/IR/Tensor.h",
        "include/mlir/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":CastInterfaces",
        ":ComplexDialect",
        ":ControlFlowInterfaces",
        ":DestinationStyleOpInterface",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":LoopLikeInterface",
        ":ParallelCombiningOpInterface",
        ":ShapedOpInterfaces",
        ":SideEffectInterfaces",
        ":SubsetOpInterface",
        ":Support",
        ":TensorOpsIncGen",
        ":TilingInterface",
        ":TransformDialectInterfaces",
        ":ValueBoundsOpInterface",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorInferTypeOpInterfaceImpl",
    srcs = ["lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp"],
    hdrs = ["include/mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithUtils",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":TensorDialect",
    ],
)

cc_library(
    name = "TensorTilingInterfaceImpl",
    srcs = ["lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp"],
    hdrs = ["include/mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithUtils",
        ":DialectUtils",
        ":IR",
        ":LinalgDialect",
        ":LinalgUtils",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorUtils",
        ":TilingInterface",
        ":ValueBoundsOpInterface",
    ],
)

cc_library(
    name = "TensorExtensions",
    srcs = glob(["lib/Dialect/Tensor/Extensions/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Tensor/Extensions/*.h"]),
    includes = ["include"],
    deps = [
        ":DialectUtils",
        ":IR",
        ":MeshDialect",
        ":MeshShardingInterface",
        ":MeshShardingInterfaceIncGen",
        ":Support",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorUtils",
    srcs = ["lib/Dialect/Tensor/Utils/Utils.cpp"],
    hdrs = ["include/mlir/Dialect/Tensor/Utils/Utils.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":ArithUtils",
        ":DialectUtils",
        ":TensorDialect",
        ":ValueBoundsOpInterface",
        ":VectorDialect",
    ],
)

gentbl_cc_library(
    name = "TensorPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Tensor",
            ],
            "include/mlir/Dialect/Tensor/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tensor/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "TensorTransforms",
    srcs = glob(
        [
            "lib/Dialect/Tensor/Transforms/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/Tensor/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineTransforms",
        ":AffineUtils",
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SubsetOpInterface",
        ":TensorDialect",
        ":TensorPassIncGen",
        ":TensorUtils",
        ":TilingInterface",
        ":TransformUtils",
        ":ValueBoundsOpInterface",
        ":VectorDialect",
        ":VectorUtils",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

td_library(
    name = "TensorTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TensorTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.td",
    deps = [
        ":TensorTransformOpsTdFiles",
    ],
)

cc_library(
    name = "TensorTransformOps",
    srcs = glob(["lib/Dialect/Tensor/TransformOps/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Tensor/TransformOps/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":IR",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorTransformOpsIncGen",
        ":TensorTransforms",
        ":TensorUtils",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformUtils",
    ],
)

cc_library(
    name = "Rewrite",
    srcs = glob([
        "lib/Rewrite/*.cpp",
        "lib/Rewrite/*.h",
    ]),
    hdrs = glob(["include/mlir/Rewrite/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":IR",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":PDLToPDLInterp",
        ":Pass",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TransformUtils",
    srcs = glob(
        include = ["lib/Transforms/Utils/*.cpp"],
        exclude = ["lib/Transforms/Utils/InliningUtils.cpp"],
    ) + [
    ],
    hdrs = [
        "include/mlir/Transforms/CFGToSCF.h",
        "include/mlir/Transforms/CommutativityUtils.h",
        "include/mlir/Transforms/ControlFlowSinkUtils.h",
        "include/mlir/Transforms/DialectConversion.h",
        "include/mlir/Transforms/FoldUtils.h",
        "include/mlir/Transforms/GreedyPatternRewriteDriver.h",
        "include/mlir/Transforms/Inliner.h",
        "include/mlir/Transforms/LoopInvariantCodeMotionUtils.h",
        "include/mlir/Transforms/OneToNTypeConversion.h",
        "include/mlir/Transforms/RegionUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":FunctionInterfaces",
        ":IR",
        ":InliningUtils",
        ":LoopLikeInterface",
        ":Pass",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":SubsetOpInterface",
        ":Support",
        ":config",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "DerivedAttributeOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/DerivedAttributeOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/DerivedAttributeOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/DerivedAttributeOpInterface.td",
    deps = [":DerivedAttributeOpInterfaceTdFiles"],
)

cc_library(
    name = "DerivedAttributeOpInterface",
    srcs = ["lib/Interfaces/DerivedAttributeOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/DerivedAttributeOpInterface.h"],
    includes = ["include"],
    deps = [
        ":DerivedAttributeOpInterfaceIncGen",
        ":IR",
    ],
)

gentbl_cc_library(
    name = "DestinationStyleOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/DestinationStyleOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/DestinationStyleOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/DestinationStyleOpInterface.td",
    deps = [":DestinationStyleOpInterfaceTdFiles"],
)

cc_library(
    name = "DestinationStyleOpInterface",
    srcs = ["lib/Interfaces/DestinationStyleOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/DestinationStyleOpInterface.h"],
    includes = ["include"],
    deps = [
        ":DestinationStyleOpInterfaceIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "InferIntRangeInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/InferIntRangeInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/InferIntRangeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/InferIntRangeInterface.td",
    deps = [":InferIntRangeInterfaceTdFiles"],
)

cc_library(
    name = "InferIntRangeInterface",
    srcs = ["lib/Interfaces/InferIntRangeInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/InferIntRangeInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferIntRangeInterfaceIncGen",
    ],
)

td_library(
    name = "DataLayoutInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/DataLayoutInterfaces.td"],
    includes = ["include"],
)

gentbl_cc_library(
    name = "DataLayoutInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/Interfaces/DataLayoutAttrInterface.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/Interfaces/DataLayoutAttrInterface.cpp.inc",
        ),
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/DataLayoutOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/DataLayoutOpInterface.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Interfaces/DataLayoutTypeInterface.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Interfaces/DataLayoutTypeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/DataLayoutInterfaces.td",
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "LoopLikeInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/LoopLikeInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/LoopLikeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/LoopLikeInterface.td",
    deps = [":LoopLikeInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "MemorySlotInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/MemorySlotOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/MemorySlotOpInterfaces.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Interfaces/MemorySlotTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Interfaces/MemorySlotTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/MemorySlotInterfaces.td",
    deps = [":MemorySlotInterfacesTdFiles"],
)

gentbl_cc_library(
    name = "ShapedOpInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ShapedOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ShapedOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ShapedOpInterfaces.td",
    deps = [":ShapedOpInterfacesTdFiles"],
)

gentbl_cc_library(
    name = "ParallelCombiningOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ParallelCombiningOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ParallelCombiningOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ParallelCombiningOpInterface.td",
    deps = [":ParallelCombiningOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "RuntimeVerifiableOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/RuntimeVerifiableOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/RuntimeVerifiableOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/RuntimeVerifiableOpInterface.td",
    deps = [":RuntimeVerifiableOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "VectorInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/VectorInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/VectorInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/VectorInterfaces.td",
    deps = [":VectorInterfacesTdFiles"],
)

gentbl_cc_library(
    name = "ViewLikeInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ViewLikeInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ViewLikeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ViewLikeInterface.td",
    deps = [":ViewLikeInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "CopyOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/CopyOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/CopyOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/CopyOpInterface.td",
    deps = [":CopyOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "TransformsPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Transforms",
            ],
            "include/mlir/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Transforms",
            ],
            "include/mlir/Transforms/Transforms.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Transforms",
            ],
            "include/mlir/Transforms/Transforms.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Transforms/Passes.td",
    deps = [
        ":PassBaseTdFiles",
        ":RewritePassBaseTdFiles",
    ],
)

cc_library(
    name = "Transforms",
    srcs = glob([
        "lib/Transforms/*.cpp",
    ]),
    hdrs = [
        "include/mlir/Transforms/CSE.h",
        "include/mlir/Transforms/EndomorphismSimplification.h",
        "include/mlir/Transforms/HomomorphismSimplification.h",
        "include/mlir/Transforms/LocationSnapshot.h",
        "include/mlir/Transforms/Mem2Reg.h",
        "include/mlir/Transforms/Passes.h",
        "include/mlir/Transforms/SROA.h",
        "include/mlir/Transforms/ViewOpGraph.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":FunctionInterfaces",
        ":IR",
        ":LoopLikeInterface",
        ":MemorySlotInterfaces",
        ":Pass",
        ":RuntimeVerifiableOpInterface",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformUtils",
        ":TransformsPassIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "CommonFolders",
    srcs = [
    ],
    hdrs = ["include/mlir/Dialect/CommonFolders.h"],
    includes = ["include"],
    deps = [
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFToGPU",
    srcs = glob(["lib/Conversion/SCFToGPU/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/SCFToGPU/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineToStandard",
        ":ArithDialect",
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":FunctionInterfaces",
        ":GPUDialect",
        ":GPUTransforms",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFToEmitC",
    srcs = glob(["lib/Conversion/SCFToEmitC/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/SCFToEmitC/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":EmitCDialect",
        ":IR",
        ":SCFDialect",
        ":TransformUtils",
        ":Transforms",
    ],
)

cc_library(
    name = "SCFToSPIRV",
    srcs = glob([
        "lib/Conversion/SCFToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/SCFToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithToSPIRV",
        ":ConversionPassIncGen",
        ":FuncToSPIRV",
        ":IR",
        ":IndexToSPIRV",
        ":MemRefToSPIRV",
        ":Pass",
        ":SCFDialect",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFToOpenMP",
    srcs = [
        "lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp",
    ],
    hdrs = ["include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"],
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":Analysis",
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMDialect",
        ":MemRefDialect",
        ":OpenMPDialect",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "SCFToControlFlow",
    srcs = [
        "lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp",
    ],
    hdrs = ["include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMDialect",
        ":SCFDialect",
        ":SCFTransforms",
        ":TransformUtils",
        ":Transforms",
    ],
)

cc_library(
    name = "LLVMCommonConversion",
    srcs = glob([
        "lib/Conversion/LLVMCommon/*.cpp",
    ]) + ["lib/Conversion/LLVMCommon/MemRefDescriptor.h"],
    hdrs = glob(["include/mlir/Conversion/LLVMCommon/*.h"]),
    includes = ["include"],
    deps = [
        ":DataLayoutInterfaces",
        ":IR",
        ":LLVMDialect",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ReconcileUnrealizedCasts",
    srcs = glob(["lib/Conversion/ReconcileUnrealizedCasts/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ReconcileUnrealizedCasts/*.h"]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":TransformUtils",
    ],
)

cc_library(
    name = "ConvertToLLVMInterface",
    srcs = ["lib/Conversion/ConvertToLLVM/ToLLVMInterface.cpp"],
    hdrs = ["include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ConvertToLLVM",
    srcs = ["lib/Conversion/ConvertToLLVM/ConvertToLLVMPass.cpp"],
    hdrs = ["include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h"],
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":Rewrite",
        ":TransformUtils",
    ],
)

cc_library(
    name = "FuncToLLVM",
    srcs = [
        "lib/Conversion/FuncToLLVM/FuncToLLVM.cpp",
    ],
    hdrs = [
        "include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h",
        "include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":DataLayoutInterfaces",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":FunctionInterfaces",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":MemRefDialect",
        ":Parser",
        ":Pass",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ConvertToSPIRV",
    srcs = ["lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp"],
    hdrs = ["include/mlir/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.h"],
    includes = ["include"],
    deps = [
        ":ArithToSPIRV",
        ":ArithTransforms",
        ":ConversionPassIncGen",
        ":FuncToSPIRV",
        ":GPUDialect",
        ":GPUToSPIRV",
        ":IR",
        ":IndexToSPIRV",
        ":MemRefToSPIRV",
        ":Pass",
        ":Rewrite",
        ":SCFToSPIRV",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVTransforms",
        ":TransformUtils",
        ":Transforms",
        ":UBToSPIRV",
        ":VectorDialect",
        ":VectorToSPIRV",
        ":VectorTransforms",
    ],
)

cc_library(
    name = "VectorToXeGPU",
    srcs = ["lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp"],
    hdrs = ["include/mlir/Conversion/VectorToXeGPU/VectorToXeGPU.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
        ":XeGPUDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ControlFlowToSCF",
    srcs = [
        "lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp",
    ],
    hdrs = [
        "include/mlir/Conversion/ControlFlowToSCF/ControlFlowToSCF.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":LLVMDialect",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
        ":UBDialect",
    ],
)

cc_library(
    name = "ControlFlowToLLVM",
    srcs = [
        "lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp",
    ],
    hdrs = [
        "include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h",
    ],
    includes = ["include"],
    deps = [
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ControlFlowToSPIRV",
    srcs = glob(["lib/Conversion/ControlFlowToSPIRV/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ControlFlowToSPIRV/*.h"]),
    includes = ["include"],
    deps = [
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MemRefToEmitC",
    srcs = glob([
        "lib/Conversion/MemRefToEmitC/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/MemRefToEmitC/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/MemRefToEmitC",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":EmitCDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
    ],
)

cc_library(
    name = "MemRefToLLVM",
    srcs = glob(["lib/Conversion/MemRefToLLVM/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/MemRefToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":MemRefUtils",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MemRefToSPIRV",
    srcs = glob([
        "lib/Conversion/MemRefToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/MemRefToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/MemRefToSPIRV",
    ],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":FunctionInterfaces",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArithAttrToLLVMConversion",
    srcs = glob(["lib/Conversion/ArithCommon/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ArithCommon/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":LLVMDialect",
    ],
)

cc_library(
    name = "ArithToAMDGPU",
    srcs = glob(["lib/Conversion/ArithToAMDGPU/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ArithToAMDGPU/*.h"]),
    includes = ["include"],
    deps = [
        ":AMDGPUDialect",
        ":AMDGPUUtils",
        ":ArithDialect",
        ":ArithUtils",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMDialect",
        ":Pass",
        ":ROCDLDialect",
        ":Support",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

cc_library(
    name = "ArithToArmSME",
    srcs = glob([
        "lib/Conversion/ArithToArmSME/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ArithToArmSME/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArmSMEDialect",
        ":ConversionPassIncGen",
        ":Pass",
        ":TransformUtils",
    ],
)

cc_library(
    name = "ArithToEmitC",
    srcs = glob([
        "lib/Conversion/ArithToEmitC/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ArithToEmitC/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/ArithToEmitC",
    ],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":EmitCDialect",
        ":EmitCTransforms",
        ":IR",
        ":Pass",
        ":Support",
        ":TransformUtils",
    ],
)

cc_library(
    name = "ArithToLLVM",
    srcs = glob(["lib/Conversion/ArithToLLVM/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ArithToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithAttrToLLVMConversion",
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
    ],
)

cc_library(
    name = "ArithToSPIRV",
    srcs = glob(["lib/Conversion/ArithToSPIRV/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/ArithToSPIRV/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MathToLLVM",
    srcs = glob(["lib/Conversion/MathToLLVM/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/MathToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithAttrToLLVMConversion",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":Pass",
    ],
)

cc_library(
    name = "MathToFuncs",
    srcs = glob(["lib/Conversion/MathToFuncs/*.cpp"]),
    hdrs = glob(["include/mlir/Conversion/MathToFuncs/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":MathDialect",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "BytecodeOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Bytecode/BytecodeOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Bytecode/BytecodeOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Bytecode/BytecodeOpInterface.td",
    deps = [":BytecodeOpInterfaceTdFiles"],
)

cc_library(
    name = "BytecodeOpInterface",
    srcs = ["lib/Bytecode/BytecodeOpInterface.cpp"],
    hdrs = [
        "include/mlir/Bytecode/BytecodeImplementation.h",
        "include/mlir/Bytecode/BytecodeOpInterface.h",
        "include/mlir/Bytecode/Encoding.h",
    ],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterfaceIncGen",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "CallOpInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/CallInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/CallInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/CallInterfaces.td",
    deps = [":CallInterfacesTdFiles"],
)

cc_library(
    name = "CallOpInterfaces",
    srcs = ["lib/Interfaces/CallInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/CallInterfaces.h"],
    includes = ["include"],
    deps = [
        ":CallOpInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "CastInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/CastInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/CastInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/CastInterfaces.td",
    deps = [":CastInterfacesTdFiles"],
)

cc_library(
    name = "CastInterfaces",
    srcs = ["lib/Interfaces/CastInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/CastInterfaces.h"],
    includes = ["include"],
    deps = [
        ":CastInterfacesIncGen",
        ":IR",
    ],
)

gentbl_cc_library(
    name = "ControlFlowInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ControlFlowInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ControlFlowInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ControlFlowInterfaces.td",
    deps = [":ControlFlowInterfacesTdFiles"],
)

cc_library(
    name = "ControlFlowInterfaces",
    srcs = ["lib/Interfaces/ControlFlowInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/ControlFlowInterfaces.h"],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "InferTypeOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/InferTypeOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/InferTypeOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/InferTypeOpInterface.td",
    deps = [":InferTypeOpInterfaceTdFiles"],
)

cc_library(
    name = "InferTypeOpInterface",
    srcs = ["lib/Interfaces/InferTypeOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/InferTypeOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterfaceIncGen",
        ":Support",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "SideEffectInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/SideEffectInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/SideEffectInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/SideEffectInterfaces.td",
    deps = [":SideEffectInterfacesTdFiles"],
)

cc_library(
    name = "SideEffectInterfaces",
    srcs = ["lib/Interfaces/SideEffectInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/SideEffectInterfaces.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SideEffectInterfacesIncGen",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "TilingInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/TilingInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/TilingInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/TilingInterface.td",
    deps = [":TilingInterfaceTdFiles"],
)

cc_library(
    name = "Analysis",
    srcs = glob(
        [
            "lib/Analysis/*.cpp",
            "lib/Analysis/*/*.cpp",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Analysis/*.h",
            "include/mlir/Analysis/*/*.h",
        ],
    ),
    copts = [
        "$(STACK_FRAME_UNLIMITED)",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":DataLayoutInterfaces",
        ":FunctionInterfaces",
        ":IR",
        ":InferIntRangeInterface",
        ":LoopLikeInterface",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":ViewLikeInterface",
        "//llvm:Support",
        "//llvm:config",
    ],
)

cc_library(
    name = "ParseUtilities",
    hdrs = ["include/mlir/Tools/ParseUtilities.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
    ],
)

cc_library(
    name = "TranslateLib",
    srcs = glob([
        "lib/Tools/mlir-translate/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Tools/mlir-translate/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":ParseUtilities",
        ":Parser",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ToLLVMIRTranslation",
    srcs = [
        "lib/Target/LLVMIR/AttrKindDetail.h",
        "lib/Target/LLVMIR/DebugTranslation.cpp",
        "lib/Target/LLVMIR/DebugTranslation.h",
        "lib/Target/LLVMIR/LoopAnnotationTranslation.cpp",
        "lib/Target/LLVMIR/LoopAnnotationTranslation.h",
        "lib/Target/LLVMIR/ModuleTranslation.cpp",
        "lib/Target/LLVMIR/TypeToLLVM.cpp",
    ],
    hdrs = [
        "include/mlir/Target/LLVMIR/Export.h",
        "include/mlir/Target/LLVMIR/LLVMTranslationInterface.h",
        "include/mlir/Target/LLVMIR/ModuleTranslation.h",
        "include/mlir/Target/LLVMIR/TypeToLLVM.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":DLTIDialect",
        ":IR",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIRTransforms",
        ":LLVMIntrinsicConversionIncGen",
        ":OpenMPDialect",
        ":Support",
        ":TransformUtils",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
        "//llvm:TransformUtils",
    ],
)

cc_library(
    name = "AMXToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/AMX/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/AMX/*.h"]),
    includes = ["include"],
    deps = [
        ":AMXConversionIncGen",
        ":AMXDialect",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "X86VectorToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/X86Vector/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/X86Vector/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":ToLLVMIRTranslation",
        ":X86VectorConversionIncGen",
        ":X86VectorDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmNeonToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ArmNeon/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmNeon/*.h"]),
    includes = ["include"],
    deps = [
        ":ArmNeonConversionIncGen",
        ":ArmNeonDialect",
        ":ArmNeonIncGen",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmSMEToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ArmSME/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmSME/*.h"]),
    includes = ["include"],
    deps = [
        ":ArmSMEConversionIncGen",
        ":ArmSMEDialect",
        ":ArmSMEIntrinsicOpsIncGen",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmSVEToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ArmSVE/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmSVE/*.h"]),
    includes = ["include"],
    deps = [
        ":ArmSVEConversionIncGen",
        ":ArmSVEDialect",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "NVVMToLLVMIRTranslation",
    srcs = ["lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp"],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.h"],
    includes = ["include"],
    deps = [
        ":DialectUtils",
        ":IR",
        ":NVVMConversionIncGen",
        ":NVVMDialect",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ROCDLToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ROCDL/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ROCDL/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":ROCDLConversionIncGen",
        ":ROCDLDialect",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/SPIRV/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/SPIRV/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVDialect",
        ":ToLLVMIRTranslation",
    ],
)

cc_library(
    name = "GPUToLLVMIRTranslation",
    srcs = [
        "lib/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.cpp",
        "lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp",
    ],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.h"],
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "BuiltinToLLVMIRTranslation",
    srcs = ["lib/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.cpp"],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":ToLLVMIRTranslation",
    ],
)

cc_library(
    name = "LLVMToLLVMIRTranslation",
    srcs = ["lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp"],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIntrinsicConversionIncGen",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenMPCommon",
    srcs = ["lib/Target/LLVMIR/Dialect/OpenMPCommon.cpp"],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/OpenMPCommon.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
    ],
)

cc_library(
    name = "LLVMIRToLLVMTranslation",
    srcs = ["lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp"],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.h"],
    includes = ["include"],
    deps = [
        ":FromLLVMIRTranslation",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIntrinsicConversionIncGen",
        ":Support",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LLVMIRToNVVMTranslation",
    srcs = ["lib/Target/LLVMIR/Dialect/NVVM/LLVMIRToNVVMTranslation.cpp"],
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/NVVM/LLVMIRToNVVMTranslation.h"],
    includes = ["include"],
    deps = [
        ":FromLLVMIRTranslation",
        ":IR",
        ":NVVMConvertibleLLVMIRIntrinsicsIncGen",
        ":NVVMDialect",
        ":NVVMFromLLVMIRConversionsIncGen",
        ":Support",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenACCToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/OpenACC/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/OpenACC/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":IR",
        ":LLVMDialect",
        ":OpenACCDialect",
        ":OpenMPCommon",
        ":Support",
        ":ToLLVMIRTranslation",
        ":TransformUtils",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenMPToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/OpenMP/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/OpenMP/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":IR",
        ":LLVMDialect",
        ":OpenMPCommon",
        ":OpenMPDialect",
        ":Support",
        ":ToLLVMIRTranslation",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
        "//llvm:TargetParser",
        "//llvm:TransformUtils",
    ],
)

cc_library(
    name = "AllToLLVMIRTranslations",
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/All.h"],
    includes = ["include"],
    deps = [
        ":AMXToLLVMIRTranslation",
        ":ArmNeonToLLVMIRTranslation",
        ":ArmSMEToLLVMIRTranslation",
        ":ArmSVEToLLVMIRTranslation",
        ":BuiltinToLLVMIRTranslation",
        ":GPUToLLVMIRTranslation",
        ":LLVMIRToLLVMTranslation",
        ":LLVMIRToNVVMTranslation",
        ":LLVMToLLVMIRTranslation",
        ":NVVMTarget",
        ":NVVMToLLVMIRTranslation",
        ":OpenACCToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        ":ROCDLTarget",
        ":ROCDLToLLVMIRTranslation",
        ":SPIRVToLLVMIRTranslation",
        ":VCIXToLLVMIRTranslation",
        ":X86VectorToLLVMIRTranslation",
    ],
)

cc_library(
    name = "ToLLVMIRTranslationRegistration",
    srcs = ["lib/Target/LLVMIR/ConvertToLLVMIR.cpp"],
    includes = ["include"],
    deps = [
        ":AllToLLVMIRTranslations",
        ":DLTIDialect",
        ":FuncDialect",
        ":IR",
        ":NVVMTarget",
        ":ROCDLTarget",
        ":ToLLVMIRTranslation",
        ":TranslateLib",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "FromLLVMIRTranslation",
    srcs = [
        "lib/Target/LLVMIR/AttrKindDetail.h",
        "lib/Target/LLVMIR/DataLayoutImporter.cpp",
        "lib/Target/LLVMIR/DataLayoutImporter.h",
        "lib/Target/LLVMIR/DebugImporter.cpp",
        "lib/Target/LLVMIR/DebugImporter.h",
        "lib/Target/LLVMIR/LoopAnnotationImporter.cpp",
        "lib/Target/LLVMIR/LoopAnnotationImporter.h",
        "lib/Target/LLVMIR/ModuleImport.cpp",
        "lib/Target/LLVMIR/TypeFromLLVM.cpp",
    ],
    hdrs = [
        "include/mlir/Target/LLVMIR/Import.h",
        "include/mlir/Target/LLVMIR/LLVMImportInterface.h",
        "include/mlir/Target/LLVMIR/ModuleImport.h",
        "include/mlir/Target/LLVMIR/TypeFromLLVM.h",
    ],
    includes = ["include"],
    deps = [
        ":DLTIDialect",
        ":DataLayoutInterfaces",
        ":IR",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIntrinsicConversionIncGen",
        ":Support",
        ":TranslateLib",
        "//llvm:BinaryFormat",
        "//llvm:Core",
        "//llvm:IRPrinter",
        "//llvm:IRReader",
        "//llvm:Support",
    ],
)

cc_library(
    name = "FromLLVMIRTranslationRegistration",
    srcs = [
        "lib/Target/LLVMIR/ConvertFromLLVMIR.cpp",
    ],
    deps = [
        ":AllToLLVMIRTranslations",
        ":DLTIDialect",
        ":FromLLVMIRTranslation",
        ":IR",
        ":TranslateLib",
        "//llvm:Core",
        "//llvm:IRReader",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ExecutionEngine",
    srcs = [
        "include/mlir/ExecutionEngine/CRunnerUtils.h",
        "lib/ExecutionEngine/ExecutionEngine.cpp",
    ],
    hdrs = [
        "include/mlir/ExecutionEngine/ExecutionEngine.h",
        "include/mlir/ExecutionEngine/MemRefUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":AllToLLVMIRTranslations",
        ":IR",
        ":LLVMDialect",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:AllTargetsAsmParsers",
        "//llvm:BitWriter",
        "//llvm:Core",
        "//llvm:ExecutionEngine",
        "//llvm:MC",
        "//llvm:OrcJIT",
        "//llvm:Support",
        "//llvm:Target",  # fixdeps: keep
        "//llvm:TargetParser",
        "//llvm:TransformUtils",
        "//llvm:X86CodeGen",  # fixdeps: keep
        "//llvm:X86Disassembler",  # fixdeps: keep
    ],
)

cc_library(
    name = "ExecutionEngineUtils",
    srcs = ["lib/ExecutionEngine/OptUtils.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/OptUtils.h"],
    includes = ["include"],
    deps = [
        "//llvm:Analysis",
        "//llvm:Core",
        "//llvm:Coroutines",
        "//llvm:IPO",
        "//llvm:Passes",
        "//llvm:Support",
        "//llvm:Target",
        "//llvm:common_transforms",
    ],
)

cc_library(
    name = "PluginsLib",
    srcs = [
        "lib/Tools/Plugins/DialectPlugin.cpp",
        "lib/Tools/Plugins/PassPlugin.cpp",
    ],
    hdrs = [
        "include/mlir/Tools/Plugins/DialectPlugin.h",
        "include/mlir/Tools/Plugins/PassPlugin.h",
    ],
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirOptLib",
    srcs = ["lib/Tools/mlir-opt/MlirOptMain.cpp"],
    hdrs = ["include/mlir/Tools/mlir-opt/MlirOptMain.h"],
    includes = ["include"],
    deps = [
        ":BytecodeWriter",
        ":Debug",
        ":IR",
        ":IRDLDialect",
        ":ParseUtilities",
        ":Parser",
        ":Pass",
        ":PluginsLib",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AllTranslations",
    hdrs = ["include/mlir/InitAllTranslations.h"],
    deps = [
        ":FromLLVMIRTranslationRegistration",
        ":SPIRVTranslateRegistration",
        ":TargetCpp",
        ":ToLLVMIRTranslationRegistration",
    ],
)

cc_library(
    name = "MlirTranslateMain",
    srcs = ["tools/mlir-translate/mlir-translate.cpp"],
    local_defines = ["MLIR_INCLUDE_TESTS"],
    deps = [
        ":AllPassesAndDialects",
        ":AllTranslations",
        ":Support",
        ":TranslateLib",
        "//llvm:Support",
        "//mlir/test:TestToLLVMIRTranslation",
    ],
)

cc_binary(
    name = "mlir-translate",
    deps = [":MlirTranslateMain"],
)

cc_library(
    name = "AllPassesAndDialects",
    hdrs = [
        "include/mlir/InitAllDialects.h",
        "include/mlir/InitAllPasses.h",
    ],
    deps = [
        ":AMDGPUDialect",
        ":AMDGPUToROCDL",
        ":AMDGPUTransforms",
        ":AMXDialect",
        ":AMXTransforms",
        ":AffineDialect",
        ":AffinePassIncGen",
        ":AffineToStandard",
        ":AffineTransformOps",
        ":AffineTransforms",
        ":ArithDialect",
        ":ArithToAMDGPU",
        ":ArithToLLVM",
        ":ArithToSPIRV",
        ":ArithTransforms",
        ":ArithValueBoundsOpInterfaceImpl",
        ":ArmNeonDialect",
        ":ArmSMEDialect",
        ":ArmSMETransforms",
        ":ArmSVEDialect",
        ":ArmSVETransforms",
        ":AsyncDialect",
        ":AsyncPassIncGen",
        ":AsyncToLLVM",
        ":AsyncTransforms",
        ":BufferizationDialect",
        ":BufferizationPipelines",
        ":BufferizationTransformOps",
        ":BufferizationTransforms",
        ":CastInterfaces",
        ":ComplexDialect",
        ":ComplexToLLVM",
        ":ComplexToLibm",
        ":ComplexToSPIRV",
        ":ControlFlowDialect",
        ":ControlFlowTransforms",
        ":ConversionPasses",
        ":ConvertToLLVM",
        ":DLTIDialect",
        ":EmitCDialect",
        ":EmitCTransforms",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncToSPIRV",
        ":FuncTransformOps",
        ":FuncTransforms",
        ":FuncTransformsPassIncGen",
        ":GPUDialect",
        ":GPUPassIncGen",
        ":GPUPipelines",
        ":GPUToGPURuntimeTransforms",
        ":GPUToNVVMTransforms",
        ":GPUToROCDLTransforms",
        ":GPUToSPIRV",
        ":GPUToVulkanTransforms",
        ":GPUTransformOps",
        ":GPUTransforms",
        ":IR",
        ":IRDLDialect",
        ":IndexDialect",
        ":LLVMDialect",
        ":LLVMIRTransforms",
        ":LLVMPassIncGen",
        ":LinalgDialect",
        ":LinalgPassIncGen",
        ":LinalgToStandard",
        ":LinalgTransformOps",
        ":LinalgTransforms",
        ":MLProgramDialect",
        ":MLProgramTransforms",
        ":MPIDialect",
        ":MathDialect",
        ":MathToFuncs",
        ":MathToLLVM",
        ":MathToLibm",
        ":MathToSPIRV",
        ":MathTransforms",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":MemRefToSPIRV",
        ":MemRefTransformOps",
        ":MemRefTransforms",
        ":MeshDialect",
        ":MeshTransforms",
        ":NVGPUDialect",
        ":NVGPUPassIncGen",
        ":NVGPUToNVVM",
        ":NVGPUTransformOps",
        ":NVGPUTransforms",
        ":NVVMDialect",
        ":NVVMTarget",
        ":OpenACCDialect",
        ":OpenACCTransforms",
        ":OpenMPDialect",
        ":OpenMPToLLVM",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":PDLToPDLInterp",
        ":PolynomialDialect",
        ":PtrDialect",
        ":QuantOps",
        ":QuantTransforms",
        ":ROCDLDialect",
        ":ROCDLTarget",
        ":ReconcileUnrealizedCasts",
        ":SCFDialect",
        ":SCFPassIncGen",
        ":SCFToControlFlow",
        ":SCFToGPU",
        ":SCFTransformOps",
        ":SCFTransforms",
        ":SPIRVDialect",
        ":SPIRVPassIncGen",
        ":SPIRVTarget",
        ":SPIRVToLLVM",
        ":SPIRVTransforms",
        ":ShapeDialect",
        ":ShapeToStandard",
        ":ShapeTransforms",
        ":ShapeTransformsPassIncGen",
        ":SparseTensorDialect",
        ":SparseTensorPipelines",
        ":SparseTensorTransformOps",
        ":SparseTensorTransforms",
        ":TensorDialect",
        ":TensorInferTypeOpInterfaceImpl",
        ":TensorTilingInterfaceImpl",
        ":TensorTransformOps",
        ":TensorTransforms",
        ":TosaDialect",
        ":TosaToLinalg",
        ":TransformDebugExtension",
        ":TransformDialect",
        ":TransformDialectTransforms",
        ":TransformLoopExtension",
        ":TransformPDLExtension",
        ":Transforms",
        ":TransformsPassIncGen",
        ":UBDialect",
        ":VectorDialect",
        ":VectorToLLVM",
        ":VectorToSCF",
        ":VectorToSPIRV",
        ":VectorTransformOps",
        ":VectorTransforms",
        ":X86VectorDialect",
        ":X86VectorTransforms",
        ":XeGPUDialect",
        ":XeGPUTransforms",
    ],
)

cc_binary(
    name = "mlir-lsp-server",
    srcs = ["tools/mlir-lsp-server/mlir-lsp-server.cpp"],
    includes = ["include"],
    deps = [
        ":AllExtensions",
        ":AllPassesAndDialects",
        ":BytecodeWriter",
        ":IR",
        ":MlirLspServerLib",
        ":Parser",
    ],
)

cc_binary(
    name = "mlir-opt",
    srcs = ["tools/mlir-opt/mlir-opt.cpp"],
    local_defines = ["MLIR_INCLUDE_TESTS"],
    deps = [
        ":AllExtensions",
        ":AllPassesAndDialects",
        ":AllToLLVMIRTranslations",
        ":Analysis",
        ":IR",
        ":MlirOptLib",
        ":OpenMPDialect",
        ":Pass",
        ":QuantOps",
        ":SCFToGPU",
        ":Support",
        ":Transforms",
        ":config",
        "//llvm:AllTargetsCodeGens",
        "//llvm:Support",
        "//mlir/test:TestAffine",
        "//mlir/test:TestAnalysis",
        "//mlir/test:TestArith",
        "//mlir/test:TestArmNeon",
        "//mlir/test:TestArmSME",
        "//mlir/test:TestBufferization",
        "//mlir/test:TestControlFlow",
        "//mlir/test:TestConvertToSPIRV",
        "//mlir/test:TestDLTI",
        "//mlir/test:TestDialect",
        "//mlir/test:TestFunc",
        "//mlir/test:TestFuncToLLVM",
        "//mlir/test:TestGPU",
        "//mlir/test:TestIR",
        "//mlir/test:TestLLVM",
        "//mlir/test:TestLinalg",
        "//mlir/test:TestLoopLikeInterface",
        "//mlir/test:TestMath",
        "//mlir/test:TestMathToVCIX",
        "//mlir/test:TestMemRef",
        "//mlir/test:TestMesh",
        "//mlir/test:TestNVGPU",
        "//mlir/test:TestOneToNTypeConversion",
        "//mlir/test:TestPDLL",
        "//mlir/test:TestPass",
        "//mlir/test:TestReducer",
        "//mlir/test:TestRewrite",
        "//mlir/test:TestSCF",
        "//mlir/test:TestSPIRV",
        "//mlir/test:TestShapeDialect",
        "//mlir/test:TestTensor",
        "//mlir/test:TestTestDynDialect",
        "//mlir/test:TestTilingInterface",
        "//mlir/test:TestTosaDialect",
        "//mlir/test:TestTransformDialect",
        "//mlir/test:TestTransforms",
        "//mlir/test:TestVector",
        "//mlir/test:TestVectorToSPIRV",
    ],
)

cc_library(
    name = "MlirJitRunner",
    srcs = ["lib/ExecutionEngine/JitRunner.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/JitRunner.h"],
    includes = ["include"],
    deps = [
        ":AllPassesAndDialects",
        ":ExecutionEngine",
        ":ExecutionEngineUtils",
        ":IR",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":OpenACCToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        ":ParseUtilities",
        ":Parser",
        ":SCFToControlFlow",
        ":Support",
        "//llvm:Core",
        "//llvm:OrcJIT",
        "//llvm:Support",
    ],
)

cc_library(
    name = "mlir_async_runtime_api",
    hdrs = ["include/mlir/ExecutionEngine/AsyncRuntime.h"],
    includes = ["include"],
)

cc_library(
    name = "_mlir_async_runtime",
    srcs = ["lib/ExecutionEngine/AsyncRuntime.cpp"],
    copts = ["-Dmlir_async_runtime_EXPORTS"],
    deps = [
        ":mlir_async_runtime_api",
        "//llvm:Support",
    ],
)

# Indirection to avoid 'libmlir_async_runtime.so' filename clash.
alias(
    name = "mlir_async_runtime",
    actual = "_mlir_async_runtime",
)

cc_binary(
    name = "libmlir_async_runtime.so",
    linkshared = True,
    linkstatic = False,
    deps = [":mlir_async_runtime"],
)

cc_library(
    name = "_mlir_float16_utils",
    srcs = ["lib/ExecutionEngine/Float16bits.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/Float16bits.h"],
    copts = ["-Dmlir_float16_utils_EXPORTS"],
    includes = ["include"],
)

# Indirection to avoid 'libmlir_float16_utils.so' filename clash.
alias(
    name = "mlir_float16_utils",
    actual = "_mlir_float16_utils",
)

cc_binary(
    name = "libmlir_float16_utils.so",
    linkshared = True,
    linkstatic = False,
    deps = [":mlir_float16_utils"],
)

# Unlike mlir_float16_utils, mlir_c_runner_utils, etc, we do *not* make
# this a shared library: because on the CMake side, doing so causes issues
# when building on Windows.  In particular, various functions take/return
# `std::vector` but that class is not designed with dllimport/dllexport
# pragma, therefore it cannot be safely/correctly used across DLL boundaries.
# Consequently, we avoid using the "mlir_xxx_utils" naming scheme,
# since that is reserved/intended for shared libraries only.
cc_library(
    name = "SparseTensorRuntime",
    srcs = [
        "lib/ExecutionEngine/SparseTensor/File.cpp",
        "lib/ExecutionEngine/SparseTensor/MapRef.cpp",
        "lib/ExecutionEngine/SparseTensor/Storage.cpp",
    ],
    hdrs = [
        "include/mlir/ExecutionEngine/SparseTensor/ArithmeticUtils.h",
        "include/mlir/ExecutionEngine/SparseTensor/COO.h",
        "include/mlir/ExecutionEngine/SparseTensor/File.h",
        "include/mlir/ExecutionEngine/SparseTensor/MapRef.h",
        "include/mlir/ExecutionEngine/SparseTensor/Storage.h",
    ],
    includes = ["include"],
    deps = [
        ":SparseTensorEnums",
        ":mlir_float16_utils",
    ],
)

cc_library(
    name = "_mlir_c_runner_utils",
    srcs = [
        "lib/ExecutionEngine/CRunnerUtils.cpp",
        "lib/ExecutionEngine/SparseTensorRuntime.cpp",
    ],
    hdrs = [
        "include/mlir/ExecutionEngine/CRunnerUtils.h",
        "include/mlir/ExecutionEngine/Msan.h",
        "include/mlir/ExecutionEngine/SparseTensorRuntime.h",
    ],
    includes = ["include"],
    deps = [
        ":SparseTensorEnums",
        ":SparseTensorRuntime",
        ":mlir_float16_utils",
        "//llvm:Support",
    ],
)

# Indirection to avoid 'libmlir_c_runner_utils.so' filename clash.
alias(
    name = "mlir_c_runner_utils",
    actual = "_mlir_c_runner_utils",
)

cc_headers_only(
    name = "mlir_c_runner_utils_hdrs",
    src = ":mlir_c_runner_utils",
)

cc_binary(
    name = "libmlir_c_runner_utils.so",
    linkshared = True,
    linkstatic = False,
    deps = [":mlir_c_runner_utils"],
)

cc_library(
    name = "_mlir_runner_utils",
    srcs = ["lib/ExecutionEngine/RunnerUtils.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/RunnerUtils.h"],
    includes = ["include"],
    deps = [
        ":mlir_c_runner_utils",
        ":mlir_float16_utils",
    ],
)

# Indirection to avoid 'libmlir_runner_utils.so' filename clash.
alias(
    name = "mlir_runner_utils",
    actual = "_mlir_runner_utils",
)

cc_headers_only(
    name = "mlir_runner_utils_hdrs",
    src = ":mlir_runner_utils",
)

cc_binary(
    name = "libmlir_runner_utils.so",
    linkshared = True,
    linkstatic = False,
    deps = [":mlir_runner_utils"],
)

cc_binary(
    name = "mlir-cpu-runner",
    srcs = ["tools/mlir-cpu-runner/mlir-cpu-runner.cpp"],
    deps = [
        ":AllToLLVMIRTranslations",
        ":BuiltinToLLVMIRTranslation",
        ":ExecutionEngineUtils",
        ":IR",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":MlirJitRunner",
        ":OpenACCToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        ":ToLLVMIRTranslation",
        "//llvm:AsmParser",
        "//llvm:Support",
        "//llvm:X86AsmParser",
    ],
)

# This target provides the headers from LLVM's Support target without any of
# the symbols. In particular, it does not contain the static registration code
# which may be executed by at most one shared library loaded by ORCJit. Direct
# dependencies need to avoid requiring symbols from LLVMSupport by adding
# copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"].
#
# Bazel links the dependencies' object files instead of the archives, which
# means that symbols are linked in even if none are used. The LLVM cmake build
# on the other hand links archives (or shared libraries, depending on
# BUILD_SHARED_LIBS), skipping them if none of the symbols are used.
# See also https://reviews.llvm.org/D95613.
cc_headers_only(
    name = "LLVMSupportHeaders",
    src = "//llvm:Support",
)

cc_library(
    name = "_mlir_cuda_runtime",
    srcs = ["lib/ExecutionEngine/CudaRuntimeWrappers.cpp"],
    # Prevent needing EnableABIBreakingChecks symbol from LLVMSupport.
    copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"],
    # Here:
    #   MLIR_ENABLE_CUDA_CUSPARSE   : enables cuSPARSE
    #   MLIR_ENABLE_CUDA_CUSPARSELT : enables cuSPARSElt
    local_defines = ["MLIR_ENABLE_CUDA_CUSPARSE"],
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":LLVMSupportHeaders",
        ":mlir_c_runner_utils_hdrs",
        "@cuda//:cuda_headers",
        "@cuda//:cusparse_static",
        "@cuda//:libcuda",
    ],
)

# Indirection to avoid 'libmlir_cuda_runtime.so' filename clash.
alias(
    name = "mlir_cuda_runtime",
    actual = "_mlir_cuda_runtime",
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
)

cc_binary(
    name = "libmlir_cuda_runtime.so",
    linkshared = True,
    linkstatic = False,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [":mlir_cuda_runtime"],
)

cc_library(
    name = "VulkanRuntime",
    srcs = ["tools/mlir-vulkan-runner/VulkanRuntime.cpp"],
    hdrs = ["tools/mlir-vulkan-runner/VulkanRuntime.h"],
    tags = [
        "manual",  # External dependency
    ],
    deps = [
        ":Support",
        "@vulkan_headers",
        "@vulkan_sdk//:sdk",
    ],
)

cc_binary(
    name = "libvulkan-runtime-wrappers.so",
    srcs = ["tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp"],
    linkshared = True,
    linkstatic = False,
    tags = [
        "manual",  # External dependency
    ],
    deps = [":VulkanRuntime"],
)

cc_binary(
    name = "mlir-vulkan-runner",
    srcs = ["tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp"],
    deps = [
        ":ArithDialect",
        ":BuiltinToLLVMIRTranslation",
        ":ConvertToSPIRV",
        ":ExecutionEngineUtils",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncToSPIRV",
        ":GPUDialect",
        ":GPUToSPIRV",
        ":GPUToVulkanTransforms",
        ":GPUTransforms",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":LLVMIRTransforms",
        ":LLVMToLLVMIRTranslation",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":MemRefTransforms",
        ":MlirJitRunner",
        ":Pass",
        ":ReconcileUnrealizedCasts",
        ":SCFDialect",
        ":SPIRVDialect",
        ":SPIRVTransforms",
        ":ToLLVMIRTranslation",
        ":VectorDialect",
        ":VectorToLLVM",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-spirv-cpu-runner",
    srcs = ["tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp"],
    deps = [
        ":ArithDialect",
        ":BuiltinToLLVMIRTranslation",
        ":ExecutionEngineUtils",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUDialect",
        ":GPUToSPIRV",
        ":GPUTransforms",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":MemRefDialect",
        ":MlirJitRunner",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVToLLVM",
        ":SPIRVTransforms",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Linker",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TableGen",
    srcs = glob(["lib/TableGen/*.cpp"]),
    hdrs = glob(["include/mlir/TableGen/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:TargetParser",
    ],
)

cc_library(
    name = "MlirTableGenMain",
    srcs = glob(["lib/Tools/mlir-tblgen/*.cpp"]),
    hdrs = glob(["include/mlir/Tools/mlir-tblgen/*.h"]),
    includes = ["include"],
    deps = [
        ":TableGen",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:TargetParser",
        "//llvm:config",
    ],
)

cc_binary(
    name = "mlir-tblgen",
    srcs = glob([
        "tools/mlir-tblgen/*.h",
        "tools/mlir-tblgen/*.cpp",
    ]),
    deps = [
        ":MlirTableGenMain",
        ":Support",
        ":TableGen",
        "//llvm:CodeGenTypes",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:TargetParser",
        "//llvm:config",
    ],
)

cc_binary(
    name = "mlir-src-sharder",
    srcs = ["tools/mlir-src-sharder/mlir-src-sharder.cpp"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-linalg-ods-yaml-gen",
    srcs = [
        "tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp",
    ],
    deps = [
        ":AsmParser",
        ":IR",
        ":Support",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:config",
    ],
)

## OpenMP / OpenACC common

td_library(
    name = "AtomicInterfacesTdFiles",
    srcs = ["include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td"],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "AtomicInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td",
    deps = [
        ":AtomicInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
    ],
)

cc_library(
    name = "AtomicInterfaces",
    srcs = ["lib/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp"],
    hdrs = ["include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h"],
    includes = ["include"],
    deps = [
        ":AtomicInterfacesIncGen",
        ":ControlFlowInterfaces",
        ":IR",
    ],
)

## OpenACC dialect

# TODO(gcmn): This is sticking td files in a cc_library
gentbl_cc_library(
    name = "AccCommonGen",
    includes = ["/llvm/include"],
    tbl_outs = [
        (
            [
                "-gen-directive-decl",
                "-directives-dialect=OpenACC",
            ],
            "include/mlir/Dialect/OpenACC/AccCommon.td",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "//llvm:include/llvm/Frontend/OpenACC/ACC.td",
    deps = ["//llvm:acc_td_files"],
)

td_library(
    name = "OpenAccOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/OpenACC/AccCommon.td",
        "include/mlir/Dialect/OpenACC/OpenACCBase.td",
        "include/mlir/Dialect/OpenACC/OpenACCOps.td",
        "include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.td",
        "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.td",
        "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.td",
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td",
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.td",
    ],
    includes = ["include"],
    deps = [
        ":AtomicInterfacesTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "OpenACCOpsInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.td",
    deps = [":OpenAccOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenACCMPOpsInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.td",
    deps = [":OpenAccOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenACCOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/OpenACC/OpenACCOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/OpenACC/OpenACCOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/OpenACC/OpenACCOpsEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/OpenACC/OpenACCOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACC/OpenACCOps.td",
    deps = [
        ":BuiltinDialectTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":OpenAccOpsTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "OpenACCTypesIncGen",
    tbl_outs = [
        (
            [
                "--gen-typedef-decls",
                "-typedefs-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc",
        ),
        (
            [
                "--gen-typedef-defs",
                "-typedefs-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.td",
    deps = [":OpenAccOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenACCTypeInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.td",
    deps = [":OpenAccOpsTdFiles"],
)

cc_library(
    name = "OpenACCDialect",
    srcs = glob(["lib/Dialect/OpenACC/IR/*.cpp"]),
    hdrs = glob(
        include = ["include/mlir/Dialect/OpenACC/*.h"],
        exclude = ["include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h"],
    ) + [
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h",
    ],
    includes = ["include"],
    textual_hdrs = [
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h",
    ],
    deps = [
        ":AtomicInterfaces",
        ":AtomicInterfacesIncGen",
        ":BytecodeOpInterface",
        ":ControlFlowInterfaces",
        ":IR",
        ":LLVMDialect",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":OpenACCMPOpsInterfacesIncGen",
        ":OpenACCOpsIncGen",
        ":OpenACCOpsInterfacesIncGen",
        ":OpenACCTypeInterfacesIncGen",
        ":OpenACCTypesIncGen",
        ":SideEffectInterfaces",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "OpenACCPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=OpenACC",
            ],
            "include/mlir/Dialect/OpenACC/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACC/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "OpenACCTransforms",
    srcs = glob(
        [
            "lib/Dialect/OpenACC/Transforms/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/OpenACC/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":FuncDialect",
        ":OpenACCDialect",
        ":OpenACCPassIncGen",
        ":Pass",
        ":TransformUtils",
    ],
)

## OpenMP dialect

# TODO(gcmn): This is sticking td files in a cc_library
gentbl_cc_library(
    name = "OmpCommonTdGen",
    includes = ["/llvm/include"],
    tbl_outs = [
        (
            [
                "-gen-directive-decl",
                "-directives-dialect=OpenMP",
            ],
            "include/mlir/Dialect/OpenMP/OmpCommon.td",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "//llvm:include/llvm/Frontend/OpenMP/OMP.td",
    deps = [
        ":OpBaseTdFiles",
        "//llvm:omp_td_files",
    ],
)

td_library(
    name = "OpenMPOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td",
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.td",
        "include/mlir/Dialect/OpenMP/OmpCommon.td",
        "include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td",
        "include/mlir/Dialect/OpenMP/OpenMPClauses.td",
        "include/mlir/Dialect/OpenMP/OpenMPDialect.td",
        "include/mlir/Dialect/OpenMP/OpenMPEnums.td",
        "include/mlir/Dialect/OpenMP/OpenMPOpBase.td",
        "include/mlir/Dialect/OpenMP/OpenMPOps.td",
        "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td",
        "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td",
    ],
    deps = [
        ":AtomicInterfacesTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "OpenMPOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-typedef-decls",
                "-typedefs-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc",
        ),
        (
            [
                "-gen-typedef-defs",
                "-typedefs-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsTypes.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/OpenMP/OpenMPOps.md",
        ),
        (
            ["-gen-openmp-clause-ops"],
            "include/mlir/Dialect/OpenMP/OpenMPClauseOps.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenMP/OpenMPOps.td",
    deps = [":OpenMPOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenMPTypeInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td",
    deps = [":OpenMPOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenMPInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td",
    deps = [":OpenMPOpsTdFiles"],
)

cc_library(
    name = "OpenMPDialect",
    srcs = glob(["lib/Dialect/OpenMP/IR/*.cpp"]),
    hdrs = glob(
        include = ["include/mlir/Dialect/OpenMP/*.h"],
        exclude = ["include/mlir/Dialect/OpenMP/OpenMPInterfaces.h"],
    ) + [
        "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h",
    ],
    includes = ["include"],
    textual_hdrs = [
        "include/mlir/Dialect/OpenMP/OpenMPInterfaces.h",
    ],
    deps = [
        ":AtomicInterfaces",
        ":AtomicInterfacesIncGen",
        ":ControlFlowInterfaces",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":OpenACCMPOpsInterfacesIncGen",
        ":OpenMPInterfacesIncGen",
        ":OpenMPOpsIncGen",
        ":OpenMPTypeInterfacesIncGen",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenACCToSCF",
    srcs = glob([
        "lib/Conversion/OpenACCToSCF/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/OpenACCToSCF/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":OpenACCDialect",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "OpenMPToLLVM",
    srcs = glob([
        "lib/Conversion/OpenMPToLLVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/OpenMPToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncToLLVM",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefToLLVM",
        ":OpenMPDialect",
        ":Pass",
    ],
)

td_library(
    name = "QuantizationOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Quant/IR/QuantBase.td",
        "include/mlir/Dialect/Quant/IR/QuantOps.td",
    ],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "QuantOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Quant/IR/QuantOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Quant/IR/QuantOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Quant/IR/QuantOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Quant/IR/QuantOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/QuantOps/QuantOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Quant/IR/QuantOps.td",
    deps = [":QuantizationOpsTdFiles"],
)

gentbl_cc_library(
    name = "QuantDialectBytecodeGen",
    tbl_outs = [
        (
            [
                "-gen-bytecode",
                "-bytecode-dialect=Quant",
            ],
            "include/mlir/Dialect/Quant/IR/QuantDialectBytecode.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Quant/IR/QuantDialectBytecode.td",
    deps = [
        ":BytecodeTdFiles",
    ],
)

cc_library(
    name = "QuantOps",
    srcs = [
        "lib/Dialect/Quant/IR/QuantDialectBytecode.cpp",
        "lib/Dialect/Quant/IR/QuantDialectBytecode.h",
        "lib/Dialect/Quant/IR/QuantOps.cpp",
        "lib/Dialect/Quant/IR/QuantTypes.cpp",
        "lib/Dialect/Quant/IR/TypeDetail.h",
        "lib/Dialect/Quant/IR/TypeParser.cpp",
        "lib/Dialect/Quant/Utils/FakeQuantSupport.cpp",
        "lib/Dialect/Quant/Utils/UniformSupport.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Quant/IR/Quant.h",
        "include/mlir/Dialect/Quant/IR/QuantTypes.h",
        "include/mlir/Dialect/Quant/Utils/FakeQuantSupport.h",
        "include/mlir/Dialect/Quant/Utils/UniformSupport.h",
    ],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":IR",
        ":InferTypeOpInterface",
        ":QuantDialectBytecodeGen",
        ":QuantOpsIncGen",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
    ],
)

td_library(
    name = "IndexOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Index/IR/IndexDialect.td",
        "include/mlir/Dialect/Index/IR/IndexEnums.td",
        "include/mlir/Dialect/Index/IR/IndexOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CastInterfacesTdFiles",
        ":InferIntRangeInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "IndexOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Index/IR/IndexOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Index/IR/IndexOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=index",
            ],
            "include/mlir/Dialect/Index/IR/IndexOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=index",
            ],
            "include/mlir/Dialect/Index/IR/IndexOpsDialect.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Index/IR/IndexOps.td",
    deps = [":IndexOpsTdFiles"],
)

gentbl_cc_library(
    name = "IndexEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Index/IR/IndexEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Index/IR/IndexEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=index",
            ],
            "include/mlir/Dialect/Index/IR/IndexAttrs.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=index",
            ],
            "include/mlir/Dialect/Index/IR/IndexAttrs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Index/IR/IndexEnums.td",
    deps = [":IndexOpsTdFiles"],
)

cc_library(
    name = "IndexToLLVM",
    srcs = glob([
        "lib/Conversion/IndexToLLVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/IndexToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":IndexDialect",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
    ],
)

cc_library(
    name = "IndexToSPIRV",
    srcs = glob([
        "lib/Conversion/IndexToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/IndexToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":IndexDialect",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
    ],
)

cc_library(
    name = "IndexDialect",
    srcs = glob(["lib/Dialect/Index/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Index/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":CastInterfaces",
        ":ConvertToLLVMInterface",
        ":IR",
        ":IndexEnumsIncGen",
        ":IndexOpsIncGen",
        ":InferIntRangeCommon",
        ":InferIntRangeInterface",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

td_library(
    name = "LinalgOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Linalg/IR/LinalgBase.td",
        "include/mlir/Dialect/Linalg/IR/LinalgEnums.td",
        "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td",
        "include/mlir/Dialect/Linalg/IR/LinalgOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":DestinationStyleOpInterfaceTdFiles",
        ":DialectUtilsTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":TilingInterfaceTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

td_library(
    name = "LinalgTransformOpsTdFiles",
    srcs = glob([
        "include/mlir/Dialect/Linalg/TransformOps/*.td",
    ]),
    includes = ["include"],
    deps = [
        ":SCFTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "LinalgOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=linalg",
            ],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=linalg",
            ],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgOps.td",
    deps = [":LinalgOpsTdFiles"],
)

gentbl_cc_library(
    name = "LinalgEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgEnums.td",
    deps = [":LinalgOpsTdFiles"],
)

gentbl_cc_library(
    name = "LinalgMatchOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.td",
    deps = [
        ":LinalgTransformEnumsIncGen",
        ":LinalgTransformOpsIncGen",
        ":LinalgTransformOpsTdFiles",
        ":SCFDeviceMappingInterfacesIncGen",
    ],
)

gentbl_cc_library(
    name = "LinalgTransformEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformEnums.td",
    deps = [
        ":LinalgTransformOpsTdFiles",
        ":SCFDeviceMappingInterfacesIncGen",
    ],
)

gentbl_cc_library(
    name = "LinalgTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td",
    deps = [
        ":LinalgTransformEnumsIncGen",
        ":LinalgTransformOpsTdFiles",
        ":SCFDeviceMappingInterfacesIncGen",
    ],
)

genlinalg(
    name = "LinalgNamedStructuredOpsYamlIncGen",
    src = "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml",
    linalg_outs = [
        (
            "-o-impl=$@",
            "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc",
        ),
        (
            "-o-ods-decl=$@",
            "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td",
        ),
    ],
    linalggen = ":mlir-linalg-ods-yaml-gen",
)

td_library(
    name = "LinalgStructuredOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td",
        "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td",
        "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CopyOpInterfaceTdFiles",
        ":DestinationStyleOpInterface",
        ":LinalgOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "LinalgStructuredOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td",
    deps = [":LinalgStructuredOpsTdFiles"],
)

gentbl_cc_library(
    name = "LinalgInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td",
    deps = [":LinalgStructuredOpsTdFiles"],
)

td_library(
    name = "BufferizableOpInterfaceTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizableOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td",
    deps = [
        ":BufferizableOpInterfaceTdFiles",
    ],
)

td_library(
    name = "BufferDeallocationOpInterfaceTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferDeallocationOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.td",
    deps = [
        ":BufferDeallocationOpInterfaceTdFiles",
    ],
)

td_library(
    name = "BufferViewFlowOpInterfaceTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferViewFlowOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.td",
    deps = [
        ":BufferViewFlowOpInterfaceTdFiles",
    ],
)

td_library(
    name = "SubsetOpInterfaceTdFiles",
    srcs = [
        "include/mlir/Interfaces/SubsetOpInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "SubsetOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/SubsetOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/SubsetOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/SubsetOpInterface.td",
    deps = [
        ":SubsetOpInterfaceTdFiles",
    ],
)

cc_library(
    name = "SubsetOpInterface",
    srcs = ["lib/Interfaces/SubsetOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/SubsetOpInterface.h"],
    includes = ["include"],
    deps = [
        ":DestinationStyleOpInterface",
        ":IR",
        ":SubsetOpInterfaceIncGen",
        ":ValueBoundsOpInterface",
    ],
)

td_library(
    name = "LinalgDocTdFiles",
    srcs = ["include/mlir/Dialect/Linalg/IR/LinalgDoc.td"],
    includes = ["include"],
    deps = [
        ":LinalgOpsTdFiles",
        ":LinalgStructuredOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "LinalgDocIncGen",
    tbl_outs = [
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Linalg/LinalgOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgDoc.td",
    deps = [":LinalgDocTdFiles"],
)

cc_library(
    name = "LinalgToStandard",
    srcs = glob([
        "lib/Conversion/LinalgToStandard/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/LinalgToStandard/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":LLVMDialect",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "LinalgDialect",
    srcs = glob(["lib/Dialect/Linalg/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Linalg/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":ArithUtils",
        ":AsmParser",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":ComplexDialect",
        ":ControlFlowInterfaces",
        ":CopyOpInterface",
        ":DestinationStyleOpInterface",
        ":DialectUtils",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":LinalgEnumsIncGen",
        ":LinalgInterfacesIncGen",
        ":LinalgNamedStructuredOpsYamlIncGen",
        ":LinalgOpsIncGen",
        ":LinalgStructuredOpsIncGen",
        ":MathDialect",
        ":MemRefDialect",
        ":MeshShardingInterface",
        ":Parser",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":SparseTensorDialect",
        ":SubsetOpInterface",
        ":Support",
        ":TensorDialect",
        ":TilingInterface",
        ":ValueBoundsOpInterface",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgTransformOps",
    srcs = glob([
        "lib/Dialect/Linalg/TransformOps/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Linalg/TransformOps/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":AsmParser",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":FunctionInterfaces",
        ":GPUDialect",
        ":IR",
        ":IndexDialect",
        ":LinalgDialect",
        ":LinalgMatchOpsIncGen",
        ":LinalgTransformEnumsIncGen",
        ":LinalgTransformOpsIncGen",
        ":LinalgTransforms",
        ":LinalgUtils",
        ":SCFDialect",
        ":SCFTransforms",
        ":Support",
        ":TensorDialect",
        ":TensorUtils",
        ":TilingInterface",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformDialectUtils",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorTransforms",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LinalgPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Linalg",
            ],
            "include/mlir/Dialect/Linalg/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Linalg",
            ],
            "include/mlir/Dialect/Linalg/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Linalg",
            ],
            "include/mlir/Dialect/Linalg/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "LinalgUtils",
    srcs = glob([
        "lib/Dialect/Linalg/Utils/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Linalg/Utils/*.h",
    ]),
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffineUtils",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgTransforms",
    srcs = glob([
        "lib/Dialect/Linalg/Transforms/*.cpp",
    ]),
    hdrs = [
        "include/mlir/Dialect/Linalg/Passes.h",
    ] + glob([
        "include/mlir/Dialect/Linalg/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffineTransforms",
        ":AffineUtils",
        ":Analysis",
        ":ArithDialect",
        ":ArithUtils",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":ComplexDialect",
        ":ControlFlowDialect",
        ":DestinationStyleOpInterface",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":GPUDialect",
        ":IR",
        ":IndexDialect",
        ":LinalgDialect",
        ":LinalgPassIncGen",
        ":LinalgStructuredOpsIncGen",
        ":LinalgUtils",
        ":MaskableOpInterface",
        ":MathDialect",
        ":MemRefDialect",
        ":MemRefTransforms",
        ":MeshDialect",
        ":MeshShardingInterface",
        ":MeshTransforms",
        ":Pass",
        ":RuntimeVerifiableOpInterface",
        ":SCFDialect",
        ":SCFTransforms",
        ":SCFUtils",
        ":SparseTensorDialect",
        ":SubsetOpInterface",
        ":Support",
        ":TensorDialect",
        ":TensorTilingInterfaceImpl",
        ":TensorTransforms",
        ":TensorUtils",
        ":TilingInterface",
        ":TransformUtils",
        ":ValueBoundsOpInterface",
        ":VectorDialect",
        ":VectorToSCF",
        ":VectorTransforms",
        ":VectorUtils",
        ":X86VectorTransforms",
        "//llvm:Support",
    ],
)

td_library(
    name = "ValueBoundsOpInterfaceTdFiles",
    srcs = [
        "include/mlir/Interfaces/ValueBoundsOpInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "ValueBoundsOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ValueBoundsOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ValueBoundsOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ValueBoundsOpInterface.td",
    deps = [
        ":ValueBoundsOpInterfaceTdFiles",
    ],
)

cc_library(
    name = "ValueBoundsOpInterface",
    srcs = ["lib/Interfaces/ValueBoundsOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/ValueBoundsOpInterface.h"],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":DestinationStyleOpInterface",
        ":IR",
        ":ValueBoundsOpInterfaceIncGen",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArithValueBoundsOpInterfaceImpl",
    srcs = ["lib/Dialect/Arith/IR/ValueBoundsOpInterfaceImpl.cpp"],
    hdrs = ["include/mlir/Dialect/Arith/IR/ValueBoundsOpInterfaceImpl.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ValueBoundsOpInterface",
    ],
)

cc_library(
    name = "TilingInterface",
    srcs = ["lib/Interfaces/TilingInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/TilingInterface.h"],
    includes = ["include"],
    deps = [
        ":DialectUtils",
        ":IR",
        ":Support",
        ":TilingInterfaceIncGen",
        ":ViewLikeInterface",
    ],
)

##---------------------------------------------------------------------------##
# Vector dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "MaskingOpInterfaceTdFiles",
    srcs = ["include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "MaskableOpInterfaceTdFiles",
    srcs = ["include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "VectorOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Vector/IR/Vector.td",
        "include/mlir/Dialect/Vector/IR/VectorAttributes.td",
        "include/mlir/Dialect/Vector/IR/VectorOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":DestinationStyleOpInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":MaskableOpInterfaceTdFiles",
        ":MaskingOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

td_library(
    name = "VectorTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":PDLDialectTdFiles",
        ":SCFTdFiles",
        ":TransformDialectTdFiles",
        ":VectorTransformsTdFiles",
    ],
)

gentbl_cc_library(
    name = "MaskableOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.td",
    deps = [":MaskableOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "MaskingOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.td",
    deps = [":MaskingOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "VectorDialectIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=vector",
            ],
            "include/mlir/Dialect/Vector/IR/VectorDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=vector",
            ],
            "include/mlir/Dialect/Vector/IR/VectorDialect.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Vector/Vector.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/IR/Vector.td",
    deps = [
        ":ArithOpsTdFiles",
        ":VectorOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "VectorOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Vector/IR/VectorOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Vector/IR/VectorOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/IR/VectorOps.td",
    deps = [
        ":ArithOpsTdFiles",
        ":VectorOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "VectorAttributesIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Vector/IR/VectorEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Vector/IR/VectorEnums.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Vector/IR/VectorAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Vector/IR/VectorAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/IR/VectorAttributes.td",
    deps = [
        ":ArithOpsTdFiles",
        ":VectorOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "VectorTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td",
    deps = [
        ":VectorTransformOpsTdFiles",
    ],
)

cc_library(
    name = "MaskableOpInterface",
    srcs = ["lib/Dialect/Vector/Interfaces/MaskableOpInterface.cpp"],
    hdrs = ["include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":MaskableOpInterfaceIncGen",
        ":MaskingOpInterface",
    ],
)

cc_library(
    name = "MaskingOpInterface",
    srcs = ["lib/Dialect/Vector/Interfaces/MaskingOpInterface.cpp"],
    hdrs = ["include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":MaskingOpInterfaceIncGen",
    ],
)

cc_library(
    name = "VectorToLLVM",
    srcs = glob([
        "lib/Conversion/VectorToLLVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/VectorToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AMXDialect",
        ":AMXTransforms",
        ":ArithAttrToLLVMConversion",
        ":ArithDialect",
        ":ArithUtils",
        ":ArmNeonDialect",
        ":ArmSVEDialect",
        ":ArmSVETransforms",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MaskableOpInterface",
        ":MemRefDialect",
        ":Pass",
        ":TensorDialect",
        ":ToLLVMIRTranslation",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorTransforms",
        ":X86VectorDialect",
        ":X86VectorTransforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToArmSME",
    srcs = glob([
        "lib/Conversion/VectorToArmSME/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/VectorToArmSME/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArmSMEDialect",
        ":ArmSVEDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToGPU",
    srcs = glob([
        "lib/Conversion/VectorToGPU/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/VectorToGPU/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":GPUDialect",
        ":IR",
        ":MemRefDialect",
        ":NVGPUDialect",
        ":NVGPUUtils",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
        ":VectorTransforms",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToSCF",
    srcs = glob([
        "lib/Conversion/VectorToSCF/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/VectorToSCF/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
        ":VectorTransforms",
        ":VectorUtils",
    ],
)

td_library(
    name = "TosaDialectTdFiles",
    srcs = glob(["include/mlir/Dialect/Tosa/IR/*.td"]),
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "TosaDialectIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaOpsDialect.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaAttributes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Tosa/TosaOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/IR/TosaOps.td",
    deps = [":TosaDialectTdFiles"],
)

gentbl_cc_library(
    name = "TosaDialectBytecodeGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-bytecode",
                "-bytecode-dialect=Tosa",
            ],
            "include/mlir/Dialect/Tosa/IR/TosaDialectBytecode.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/IR/TosaDialectBytecode.td",
    deps = [
        ":BytecodeTdFiles",
    ],
)

gentbl_cc_library(
    name = "TosaInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/IR/TosaInterfaces.td",
    deps = [":TosaDialectTdFiles"],
)

gentbl_cc_library(
    name = "TosaPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=TosaOpt",
            ],
            "include/mlir/Dialect/Tosa/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-enum-decls",
                "-name=TosaOpt",
            ],
            "include/mlir/Dialect/Tosa/Transforms/PassesEnums.h.inc",
        ),
        (
            [
                "-gen-enum-defs",
                "-name=TosaOpt",
            ],
            "include/mlir/Dialect/Tosa/Transforms/PassesEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/Transforms/Passes.td",
    deps = [
        ":OpBaseTdFiles",
        ":PassBaseTdFiles",
    ],
)

cc_library(
    name = "TosaDialect",
    srcs = glob([
        "lib/Dialect/Tosa/IR/*.cpp",
        "lib/Dialect/Tosa/Utils/*.cpp",
        "lib/Dialect/Tosa/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Tosa/IR/*.h",
        "include/mlir/Dialect/Tosa/Utils/*.h",
        "include/mlir/Dialect/Tosa/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BytecodeOpInterface",
        ":Dialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":LoopLikeInterface",
        ":MeshDialect",
        ":MeshShardingInterface",
        ":Pass",
        ":QuantOps",
        ":SideEffectInterfaces",
        ":Support",
        ":TensorDialect",
        ":TosaDialectBytecodeGen",
        ":TosaDialectIncGen",
        ":TosaInterfacesIncGen",
        ":TosaPassIncGen",
        ":TransformUtils",
        ":VectorInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TosaToArith",
    srcs = glob([
        "lib/Conversion/TosaToArith/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TosaToArith/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToArith",
    ],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":TosaDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "TosaToLinalg",
    srcs = glob([
        "lib/Conversion/TosaToLinalg/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TosaToLinalg/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToLinalg",
    ],
    deps = [
        ":ArithDialect",
        ":ArithUtils",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":IndexDialect",
        ":InferTypeOpInterface",
        ":LinalgDialect",
        ":MathDialect",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorUtils",
        ":TosaDialect",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TosaToMLProgram",
    srcs = glob([
        "lib/Conversion/TosaToMLProgram/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TosaToMLProgram/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToMLProgram",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":MLProgramDialect",
        ":Pass",
        ":TosaDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "TosaToSCF",
    srcs = glob([
        "lib/Conversion/TosaToSCF/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TosaToSCF/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToSCF",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TosaDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "TosaToTensor",
    srcs = glob([
        "lib/Conversion/TosaToTensor/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/TosaToTensor/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToTensor",
    ],
    deps = [
        ":ArithDialect",
        ":ArithUtils",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":TensorDialect",
        ":TensorUtils",
        ":TosaDialect",
        ":TransformUtils",
    ],
)

td_library(
    name = "TransformInterfacesTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/Interfaces/*.td"]),
    deps = [
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

td_library(
    name = "TransformDialectTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/IR/*.td"]),
    deps = [
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":TransformInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformDialectEnumsIncGen",
    tbl_outs = [
        (
            [
                "-gen-enum-decls",
            ],
            "include/mlir/Dialect/Transform/IR/TransformDialectEnums.h.inc",
        ),
        (
            [
                "-gen-enum-defs",
            ],
            "include/mlir/Dialect/Transform/IR/TransformDialectEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformAttrs.td",
    deps = [":TransformDialectTdFiles"],
)

gentbl_cc_library(
    name = "TransformDialectMatchInterfacesIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-interface-decls",
            ],
            "include/mlir/Dialect/Transform/Interfaces/MatchInterfaces.h.inc",
        ),
        (
            [
                "-gen-op-interface-defs",
            ],
            "include/mlir/Dialect/Transform/Interfaces/MatchInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/Interfaces/MatchInterfaces.td",
    deps = [
        ":TransformDialectInterfacesIncGen",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformDialectInterfacesIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-interface-decls",
            ],
            "include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h.inc",
        ),
        (
            [
                "-gen-op-interface-defs",
            ],
            "include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.cpp.inc",
        ),
        (
            [
                "-gen-type-interface-decls",
            ],
            "include/mlir/Dialect/Transform/Interfaces/TransformTypeInterfaces.h.inc",
        ),
        (
            [
                "-gen-type-interface-defs",
            ],
            "include/mlir/Dialect/Transform/Interfaces/TransformTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td",
    deps = [":TransformDialectTdFiles"],
)

gentbl_cc_library(
    name = "TransformDialectIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
            ],
            "include/mlir/Dialect/Transform/IR/TransformDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
            ],
            "include/mlir/Dialect/Transform/IR/TransformDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformDialect.td",
    deps = [":TransformDialectTdFiles"],
)

gentbl_cc_library(
    name = "TransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Transform/IR/TransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Transform/IR/TransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformOps.td",
    deps = [
        ":CallInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformTypesIncGen",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/Transform/IR/TransformTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/Transform/IR/TransformTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformTypes.td",
    deps = [":TransformDialectTdFiles"],
)

cc_library(
    name = "TransformDialectInterfaces",
    srcs = glob(["lib/Dialect/Transform/Interfaces/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/Interfaces/*.h"]),
    deps = [
        ":CastInterfaces",
        ":IR",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialectInterfacesIncGen",
        ":TransformDialectMatchInterfacesIncGen",
        ":TransformDialectUtils",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TransformDialect",
    srcs = glob(["lib/Dialect/Transform/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/IR/*.h"]),
    deps = [
        ":Analysis",
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":CastInterfaces",
        ":ControlFlowInterfaces",
        ":ConvertToLLVMInterface",
        ":FunctionInterfaces",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":LoopLikeInterface",
        ":Pass",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialectEnumsIncGen",
        ":TransformDialectIncGen",
        ":TransformDialectInterfaces",
        ":TransformDialectUtils",
        ":TransformOpsIncGen",
        ":TransformTypesIncGen",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

td_library(
    name = "TransformPDLExtensionTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/PDLExtension/*.td"]),
    deps = [
        ":PDLDialectTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformPDLExtensionOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-decls",
            ],
            "include/mlir/Dialect/Transform/PDLExtension/PDLExtensionOps.h.inc",
        ),
        (
            [
                "-gen-op-defs",
            ],
            "include/mlir/Dialect/Transform/PDLExtension/PDLExtensionOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/PDLExtension/PDLExtensionOps.td",
    deps = [":TransformPDLExtensionTdFiles"],
)

cc_library(
    name = "TransformPDLExtension",
    srcs = glob(["lib/Dialect/Transform/PDLExtension/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/PDLExtension/*.h"]),
    deps = [
        ":IR",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformPDLExtensionOpsIncGen",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "TransformIRDLExtensionOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-decls",
            ],
            "include/mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.h.inc",
        ),
        (
            [
                "-gen-op-defs",
            ],
            "include/mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.td",
    deps = [":TransformPDLExtensionTdFiles"],
)

cc_library(
    name = "TransformIRDLExtension",
    srcs = glob(["lib/Dialect/Transform/IRDLExtension/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/IRDLExtension/*.h"]),
    deps = [
        ":IR",
        ":IRDLDialect",
        ":IRDLInterfacesIncGen",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformIRDLExtensionOpsIncGen",
        "//llvm:Support",
    ],
)

td_library(
    name = "TransformDebugExtensionTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/DebugExtension/*.td"]),
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformDebugExtensionOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-decls",
            ],
            "include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.h.inc",
        ),
        (
            [
                "-gen-op-defs",
            ],
            "include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.td",
    deps = [":TransformDebugExtensionTdFiles"],
)

cc_library(
    name = "TransformDebugExtension",
    srcs = glob(["lib/Dialect/Transform/DebugExtension/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/DebugExtension/*.h"]),
    deps = [
        ":IR",
        ":Support",
        ":TransformDebugExtensionOpsIncGen",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        "//llvm:Support",
    ],
)

td_library(
    name = "TransformLoopExtensionTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/LoopExtension/*.td"]),
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformLoopExtensionOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-decls",
            ],
            "include/mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.h.inc",
        ),
        (
            [
                "-gen-op-defs",
            ],
            "include/mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.td",
    deps = [":TransformLoopExtensionTdFiles"],
)

cc_library(
    name = "TransformLoopExtension",
    srcs = glob(["lib/Dialect/Transform/LoopExtension/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/LoopExtension/*.h"]),
    deps = [
        ":IR",
        ":LoopLikeInterface",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformLoopExtensionOpsIncGen",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

td_library(
    name = "TransformDialectTransformsTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/Transforms/*.td"]),
    deps = [
        ":PassBaseTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformDialectTransformsIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Transform",
            ],
            "include/mlir/Dialect/Transform/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/Transforms/Passes.td",
    deps = [":TransformDialectTransformsTdFiles"],
)

cc_library(
    name = "TransformDialectTransforms",
    srcs = glob(["lib/Dialect/Transform/Transforms/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/Transforms/*.h"]),
    deps = [
        ":Analysis",
        ":FunctionInterfaces",
        ":IR",
        ":Parser",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformDialectTransformsIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TransformDialectUtils",
    srcs = glob(["lib/Dialect/Transform/Utils/*cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/Utils/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

td_library(
    name = "ComplexOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Complex/IR/ComplexBase.td",
        "include/mlir/Dialect/Complex/IR/ComplexOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsInterfacesTdFiles",
        ":ArithOpsTdFiles",
        ":BuiltinDialectTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ComplexAttributesIncGen",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Complex/IR/ComplexAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Complex/IR/ComplexAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Complex/IR/ComplexAttributes.td",
    deps = [":ComplexOpsTdFiles"],
)

gentbl_cc_library(
    name = "ComplexBaseIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=complex",
            ],
            "include/mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=complex",
            ],
            "include/mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Complex/IR/ComplexBase.td",
    deps = [":ComplexOpsTdFiles"],
)

gentbl_cc_library(
    name = "ComplexOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Complex/IR/ComplexOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Complex/IR/ComplexOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Complex/IR/ComplexOps.td",
    deps = [":ComplexOpsTdFiles"],
)

cc_library(
    name = "ComplexDialect",
    srcs = glob(
        [
            "lib/Dialect/Complex/IR/*.cpp",
        ],
    ),
    hdrs = ["include/mlir/Dialect/Complex/IR/Complex.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BytecodeOpInterface",
        ":ComplexAttributesIncGen",
        ":ComplexBaseIncGen",
        ":ComplexOpsIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ComplexToLLVM",
    srcs = glob([
        "lib/Conversion/ComplexToLLVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ComplexToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithAttrToLLVMConversion",
        ":ArithDialect",
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
    ],
)

cc_library(
    name = "ComplexToLibm",
    srcs = glob([
        "lib/Conversion/ComplexToLibm/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ComplexToLibm/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":TransformUtils",
    ],
)

cc_library(
    name = "ComplexToSPIRV",
    srcs = glob([
        "lib/Conversion/ComplexToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ComplexToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ComplexToStandard",
    srcs = glob([
        "lib/Conversion/ComplexToStandard/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/ComplexToStandard/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":MathDialect",
        ":Pass",
        ":TransformUtils",
    ],
)

exports_files([
    "include/mlir/Interfaces/CallInterfaces.h",
    "include/mlir/Interfaces/CastInterfaces.h",
    "include/mlir/Interfaces/ControlFlowInterfaces.h",
    "include/mlir/Transforms/InliningUtils.h",
])

td_library(
    name = "ArithOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Arith/IR/ArithBase.td",
        "include/mlir/Dialect/Arith/IR/ArithOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsInterfacesTdFiles",
        ":BuiltinDialectTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":InferIntRangeInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

td_library(
    name = "ArithOpsInterfacesTdFiles",
    srcs = [
        "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArithBaseIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=arith",
            ],
            "include/mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arith",
            ],
            "include/mlir/Dialect/Arith/IR/ArithOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Arith/IR/ArithOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arith/IR/ArithBase.td",
    deps = [":ArithOpsTdFiles"],
)

gentbl_cc_library(
    name = "ArithOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Arith/IR/ArithOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Arith/IR/ArithOps.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=arith",
            ],
            "include/mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=arith",
            ],
            "include/mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arith/IR/ArithOps.td",
    deps = [
        ":ArithOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArithOpsInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td",
    deps = [
        ":ArithOpsInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArithCanonicalizationIncGen",
    strip_include_prefix = "include/mlir/Dialect/Arith/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "include/mlir/Dialect/Arith/IR/ArithCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/Arith/IR/ArithCanonicalization.td",
    deps = [
        ":ArithOpsTdFiles",
        ":CastInterfacesTdFiles",
        ":FuncTdFiles",
    ],
)

cc_library(
    name = "ArithDialect",
    srcs = [
        "include/mlir/Interfaces/ValueBoundsOpInterface.h",
        "lib/Dialect/Arith/IR/ArithDialect.cpp",
        "lib/Dialect/Arith/IR/ArithOps.cpp",
        "lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp",
    ] + glob([
        "include/mlir/Analysis/**/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/Arith/IR/Arith.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithBaseIncGen",
        ":ArithCanonicalizationIncGen",
        ":ArithOpsIncGen",
        ":ArithOpsInterfacesIncGen",
        ":BufferizationInterfaces",
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":CastInterfaces",
        ":CommonFolders",
        ":ControlFlowInterfaces",
        ":ConvertToLLVMInterface",
        ":DestinationStyleOpInterface",
        ":FunctionInterfaces",
        ":IR",
        ":InferIntRangeCommon",
        ":InferIntRangeInterface",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":UBDialect",
        ":ValueBoundsOpInterfaceIncGen",
        ":VectorInterfaces",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ArithPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Arith",
            ],
            "include/mlir/Dialect/Arith/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arith/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ArithTransforms",
    srcs = glob([
        "lib/Dialect/Arith/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Arith/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithDialect",
        ":ArithPassIncGen",
        ":ArithUtils",
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        ":ValueBoundsOpInterface",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArithUtils",
    srcs = glob([
        "lib/Dialect/Arith/Utils/*.cpp",
    ]),
    hdrs = ["include/mlir/Dialect/Arith/Utils/Utils.h"],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ComplexDialect",
        ":DialectUtils",
        ":IR",
        "//llvm:Support",
    ],
)

td_library(
    name = "MathOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Math/IR/MathBase.td",
        "include/mlir/Dialect/Math/IR/MathOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "MathBaseIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=math",
            ],
            "include/mlir/Dialect/Math/IR/MathOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=math",
            ],
            "include/mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Math/IR/MathBase.td",
    deps = [":MathOpsTdFiles"],
)

gentbl_cc_library(
    name = "MathOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Math/IR/MathOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Math/IR/MathOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Math/IR/MathOps.td",
    deps = [":MathOpsTdFiles"],
)

gentbl_cc_library(
    name = "MathPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Math",
            ],
            "include/mlir/Dialect/Math/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Math/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "MathDialect",
    srcs = glob(
        [
            "lib/Dialect/Math/IR/*.cpp",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/Math/IR/Math.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BytecodeOpInterface",
        ":CommonFolders",
        ":ConvertToLLVMInterface",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MathBaseIncGen",
        ":MathOpsIncGen",
        ":SideEffectInterfaces",
        ":UBDialect",
        ":VectorInterfaces",
    ],
)

cc_library(
    name = "MathTransforms",
    srcs = glob([
        "lib/Dialect/Math/Transforms/*.cpp",
    ]),
    hdrs = glob(["include/mlir/Dialect/Math/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ArithUtils",
        ":DialectUtils",
        ":IR",
        ":MathDialect",
        ":MathPassIncGen",
        ":Pass",
        ":SCFDialect",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorUtils",
        ":X86VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MathToLibm",
    srcs = glob([
        "lib/Conversion/MathToLibm/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/MathToLibm/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":MathDialect",
        ":Pass",
        ":TransformUtils",
        ":VectorDialect",
    ],
)

td_library(
    name = "MemRefOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/MemRef/IR/MemRefBase.td",
        "include/mlir/Dialect/MemRef/IR/MemRefOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithOpsTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":CopyOpInterfaceTdFiles",
        ":MemorySlotInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":ShapedOpInterfacesTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "MemRefBaseIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=memref",
            ],
            "include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=memref",
            ],
            "include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/IR/MemRefBase.td",
    deps = [":MemRefOpsTdFiles"],
)

gentbl_cc_library(
    name = "MemRefOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MemRef/IR/MemRefOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/IR/MemRefOps.td",
    deps = [
        ":MemRefOpsTdFiles",
    ],
)

cc_library(
    name = "MemRefDialect",
    srcs = glob(
        [
            "lib/Dialect/MemRef/IR/*.cpp",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/MemRef/IR/MemRef.h",
        "include/mlir/Dialect/MemRef/IR/MemRefMemorySlot.h",
        "include/mlir/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.h",
    ],
    includes = ["include"],
    deps = [
        ":AllocationOpInterface",
        ":ArithDialect",
        ":ArithUtils",
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":CastInterfaces",
        ":ControlFlowInterfaces",
        ":ConvertToLLVMInterface",
        ":CopyOpInterface",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MemRefBaseIncGen",
        ":MemRefOpsIncGen",
        ":MemorySlotInterfaces",
        ":RuntimeVerifiableOpInterface",
        ":ShapedOpInterfaces",
        ":SideEffectInterfaces",
        ":Support",
        ":ValueBoundsOpInterface",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MemRefUtils",
    srcs = glob(
        [
            "lib/Dialect/MemRef/Utils/*.cpp",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/MemRef/Utils/MemRefUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithUtils",
        ":MemRefDialect",
        ":VectorDialect",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "MemRefPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=MemRef",
            ],
            "include/mlir/Dialect/MemRef/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "MemRefTransforms",
    srcs = glob(
        [
            "lib/Dialect/MemRef/Transforms/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/MemRef/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineTransforms",
        ":AffineUtils",
        ":AllocationOpInterface",
        ":ArithDialect",
        ":ArithTransforms",
        ":ArithUtils",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":ControlFlowDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":GPUDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":MemRefPassIncGen",
        ":MemRefUtils",
        ":NVGPUDialect",
        ":Pass",
        ":RuntimeVerifiableOpInterface",
        ":SCFDialect",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        ":ValueBoundsOpInterface",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

td_library(
    name = "MemRefTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "MemRefTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td",
    deps = [
        ":MemRefTransformOpsTdFiles",
    ],
)

cc_library(
    name = "MemRefTransformOps",
    srcs = glob(["lib/Dialect/MemRef/TransformOps/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/MemRef/TransformOps/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithDialect",
        ":BytecodeOpInterface",
        ":IR",
        ":LLVMCommonConversion",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":MemRefTransformOpsIncGen",
        ":MemRefTransforms",
        ":MemRefUtils",
        ":NVGPUDialect",
        ":SCFDialect",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformUtils",
        ":VectorDialect",
        ":VectorTransforms",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# MLProgram dialect
##---------------------------------------------------------------------------##

td_library(
    name = "MLProgramOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td",
        "include/mlir/Dialect/MLProgram/IR/MLProgramBase.td",
        "include/mlir/Dialect/MLProgram/IR/MLProgramOps.td",
        "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinDialectTdFiles",
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":RegionKindInterfaceIncGen",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "MLProgramOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramOps.td",
    deps = [":MLProgramOpsTdFiles"],
)

gentbl_cc_library(
    name = "MLProgramAttributesIncGen",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td",
    deps = [":MLProgramOpsTdFiles"],
)

gentbl_cc_library(
    name = "MLProgramPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=MLProgram",
            ],
            "include/mlir/Dialect/MLProgram/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

gentbl_cc_library(
    name = "MLProgramTypesIncGen",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.td",
    deps = [":MLProgramOpsTdFiles"],
)

cc_library(
    name = "MLProgramDialect",
    srcs = glob(["lib/Dialect/MLProgram/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/MLProgram/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":FunctionInterfaces",
        ":IR",
        ":InliningUtils",
        ":MLProgramAttributesIncGen",
        ":MLProgramOpsIncGen",
        ":MLProgramTypesIncGen",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MLProgramTransforms",
    srcs = glob([
        "lib/Dialect/MLProgram/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/MLProgram/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BufferizationInterfaces",
        ":FuncDialect",
        ":IR",
        ":MLProgramDialect",
        ":MLProgramPassIncGen",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
    ],
)

##---------------------------------------------------------------------------##
# MPI dialect
##---------------------------------------------------------------------------##

td_library(
    name = "MPITdFiles",
    srcs = [
        "include/mlir/Dialect/MPI/IR/MPI.td",
        "include/mlir/Dialect/MPI/IR/MPIOps.td",
        "include/mlir/Dialect/MPI/IR/MPITypes.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "MPIIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MPI/IR/MPI.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MPI/IR/MPI.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/MPI/IR/MPIDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/MPI/IR/MPIDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MPI/IR/MPI.td",
    deps = [":MPITdFiles"],
)

gentbl_cc_library(
    name = "MPIOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MPI/IR/MPIOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MPI/IR/MPIOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MPI/IR/MPIOps.td",
    deps = [":MPITdFiles"],
)

gentbl_cc_library(
    name = "MPITypesIncGen",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/MPI/IR/MPITypesGen.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/MPI/IR/MPITypesGen.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MPI/IR/MPITypes.td",
    deps = [":MPITdFiles"],
)

gentbl_cc_library(
    name = "MPIAttrsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/MPI/IR/MPIEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/MPI/IR/MPIEnums.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/MPI/IR/MPIAttrDefs.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/MPI/IR/MPIAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MPI/IR/MPI.td",
    deps = [":MPITdFiles"],
)

cc_library(
    name = "MPIDialect",
    srcs = glob(["lib/Dialect/MPI/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/MPI/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":IR",
        ":MPIAttrsIncGen",
        ":MPIIncGen",
        ":MPIOpsIncGen",
        ":MPITypesIncGen",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# Allocation interfaces
##---------------------------------------------------------------------------##

td_library(
    name = "AllocationOpInterfaceTdFiles",
    srcs = ["include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "AllocationOpInterfaceIncGen",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td",
    deps = [":AllocationOpInterfaceTdFiles"],
)

cc_library(
    name = "AllocationOpInterface",
    srcs = ["lib/Dialect/Bufferization/IR/AllocationOpInterface.cpp"],
    hdrs = ["include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"],
    includes = ["include"],
    deps = [
        ":AllocationOpInterfaceIncGen",
        ":IR",
    ],
)

td_library(
    name = "BufferizationOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferizationBase.td",
        "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td",
        "include/mlir/Dialect/Bufferization/IR/BufferizationOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AllocationOpInterfaceTdFiles",
        ":BufferViewFlowOpInterfaceTdFiles",
        ":BufferizableOpInterfaceTdFiles",
        ":CopyOpInterfaceTdFiles",
        ":DestinationStyleOpInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":SubsetOpInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizationBaseIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=bufferization",
            ],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=bufferization",
            ],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationBase.td",
    deps = [":BufferizationOpsTdFiles"],
)

td_library(
    name = "BufferizationEnumsTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizationEnumsIncGen",
    tbl_outs = [
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td",
    deps = [":BufferizationEnumsTdFiles"],
)

td_library(
    name = "BufferizationTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":BufferizationOpsTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizationTransformOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td",
    deps = [
        ":BufferizationTransformOpsTdFiles",
    ],
)

cc_library(
    name = "BufferizationTransformOps",
    srcs = [
        "lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h",
    ],
    includes = ["include"],
    deps = [
        ":BufferizationDialect",
        ":BufferizationEnumsIncGen",
        ":BufferizationInterfaces",
        ":BufferizationTransformOpsIncGen",
        ":BufferizationTransforms",
        ":BytecodeOpInterface",
        ":FunctionInterfaces",
        ":IR",
        ":LinalgDialect",
        ":MemRefDialect",
        ":TensorDialect",
        ":TransformDialect",
        ":TransformDialectInterfaces",
    ],
)

gentbl_cc_library(
    name = "BufferizationOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationOps.td",
    deps = [
        ":BufferizationOpsTdFiles",
    ],
)

cc_library(
    name = "BufferizationInterfaces",
    srcs = [
        "include/mlir/Analysis/Liveness.h",
    ],
    hdrs = [
        "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h",
        "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.h",
        "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h",
    ],
    includes = ["include"],
    deps = [
        ":BufferDeallocationOpInterfaceIncGen",
        ":BufferViewFlowOpInterfaceIncGen",
        ":BufferizableOpInterfaceIncGen",
        ":BufferizationEnumsIncGen",
        ":FunctionInterfaces",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "BufferizationDialect",
    srcs = [
        "lib/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp",
        "lib/Dialect/Bufferization/IR/BufferViewFlowOpInterface.cpp",
        "lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp",
        "lib/Dialect/Bufferization/IR/BufferizationDialect.cpp",
        "lib/Dialect/Bufferization/IR/BufferizationOps.cpp",
        "lib/Dialect/Bufferization/IR/UnstructuredControlFlow.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Bufferization/IR/Bufferization.h",
        "include/mlir/Dialect/Bufferization/IR/DstBufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AllocationOpInterface",
        ":ArithDialect",
        ":BufferDeallocationOpInterfaceIncGen",
        ":BufferViewFlowOpInterfaceIncGen",
        ":BufferizableOpInterfaceIncGen",
        ":BufferizationBaseIncGen",
        ":BufferizationInterfaces",
        ":BufferizationOpsIncGen",
        ":BytecodeOpInterface",
        ":ControlFlowInterfaces",
        ":CopyOpInterface",
        ":DestinationStyleOpInterface",
        ":FuncDialect",
        ":FunctionInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":InliningUtils",
        ":MemRefDialect",
        ":SparseTensorDialect",
        ":SubsetOpInterface",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "BufferizationPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Bufferization",
            ],
            "include/mlir/Dialect/Bufferization/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "BufferizationTransforms",
    srcs = glob(
        [
            "lib/Dialect/Bufferization/Transforms/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/Bufferization/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AllocationOpInterface",
        ":Analysis",
        ":ArithDialect",
        ":BufferizationDialect",
        ":BufferizationInterfaces",
        ":BufferizationPassIncGen",
        ":CallOpInterfaces",
        ":ControlFlowDialect",
        ":ControlFlowInterfaces",
        ":FuncDialect",
        ":FunctionInterfaces",
        ":IR",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":MemRefUtils",
        ":Pass",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":SubsetOpInterface",
        ":Support",
        ":TensorDialect",
        ":TransformUtils",
        ":Transforms",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "BufferizationToMemRef",
    srcs = [
        "lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp",
    ],
    hdrs = [
        "include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
    ],
)

cc_library(
    name = "BufferizationPipelines",
    srcs = glob(["lib/Dialect/Bufferization/Pipelines/*.cpp"]),
    hdrs = ["include/mlir/Dialect/Bufferization/Pipelines/Passes.h"],
    includes = ["include"],
    deps = [
        ":BufferizationInterfaces",
        ":BufferizationTransforms",
        ":FuncDialect",
        ":MemRefTransforms",
        ":Pass",
        ":Transforms",
    ],
)

td_library(
    name = "DLTIDialectTdFiles",
    srcs = [
        "include/mlir/Dialect/DLTI/DLTI.td",
        "include/mlir/Dialect/DLTI/DLTIBase.td",
    ],
    includes = ["include"],
    deps = [
        ":DataLayoutInterfacesTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "DLTIBaseIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/DLTIDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/DLTIDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/DLTI/DLTIBase.td",
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "DLTIAttrsIncGen",
    tbl_outs = [
        (
            [
                "-gen-attrdef-decls",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/DLTIAttrs.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/DLTIAttrs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/DLTI/DLTIAttrs.td",
    deps = [
        ":AttrTdFiles",
        ":DLTIDialectTdFiles",
    ],
)

cc_library(
    name = "DLTIDialect",
    srcs = glob(["lib/Dialect/DLTI/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/DLTI/*.h"]),
    includes = ["include"],
    deps = [
        ":DLTIAttrsIncGen",
        ":DLTIBaseIncGen",
        ":DataLayoutInterfaces",
        ":IR",
        "//llvm:Support",
    ],
)

td_library(
    name = "DLTITransformTdFiles",
    srcs = [
        "include/mlir/Dialect/DLTI/TransformOps/DLTITransformOps.td",
    ],
    includes = ["include"],
    deps = [":TransformDialectTdFiles"],
)

gentbl_cc_library(
    name = "DLTITransformOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-op-decls",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/TransformOps/DLTITransformOps.h.inc",
        ),
        (
            [
                "-gen-op-defs",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/TransformOps/DLTITransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/DLTI/TransformOps/DLTITransformOps.td",
    deps = [
        ":DLTITransformTdFiles",
    ],
)

cc_library(
    name = "DLTITransformOps",
    srcs = glob(["lib/Dialect/DLTI/TransformOps/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/DLTI/TransformOps/*.h"]),
    includes = ["include"],
    deps = [
        ":DLTIDialect",
        ":DLTITransformOpsIncGen",
        ":DataLayoutInterfaces",
        ":TransformDialect",
        ":TransformDialectInterfaces",
        ":TransformDialectUtils",
    ],
)

gentbl_cc_library(
    name = "ReducerIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Reducer",
            ],
            "include/mlir/Reducer/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Reducer/Passes.td",
    deps = [
        ":PassBaseTdFiles",
        ":ReducerTdFiles",
    ],
)

cc_library(
    name = "Reducer",
    srcs = glob(["lib/Reducer/*.cpp"]),
    hdrs = glob(["include/mlir/Reducer/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Pass",
        ":ReducerIncGen",
        ":Rewrite",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirReduceLib",
    srcs = ["lib/Tools/mlir-reduce/MlirReduceMain.cpp"],
    hdrs = ["include/mlir/Tools/mlir-reduce/MlirReduceMain.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":ParseUtilities",
        ":Parser",
        ":Pass",
        ":Reducer",
        ":Rewrite",
        ":Support",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-reduce",
    srcs = ["tools/mlir-reduce/mlir-reduce.cpp"],
    includes = ["include"],
    local_defines = ["MLIR_INCLUDE_TESTS"],
    stamp = 0,
    deps = [
        ":AllPassesAndDialects",
        ":IR",
        ":MlirReduceLib",
        "//llvm:Support",
        "//mlir/test:TestDialect",
    ],
)

cc_library(
    name = "PDLLODS",
    srcs = glob(
        [
            "lib/Tools/PDLL/ODS/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/ODS/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLLAST",
    srcs = glob(
        [
            "lib/Tools/PDLL/AST/*.cpp",
            "lib/Tools/PDLL/AST/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/AST/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLLCodeGen",
    srcs = glob(
        [
            "lib/Tools/PDLL/CodeGen/*.cpp",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/CodeGen/*.h"]),
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":IR",
        ":PDLDialect",
        ":PDLLAST",
        ":PDLLODS",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLLParser",
    srcs = glob(
        [
            "lib/Tools/PDLL/Parser/*.cpp",
            "lib/Tools/PDLL/Parser/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/Parser/*.h"]),
    includes = ["include"],
    deps = [
        ":PDLLAST",
        ":PDLLODS",
        ":Support",
        ":TableGen",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:TargetParser",
    ],
)

cc_binary(
    name = "mlir-pdll",
    srcs = [
        "tools/mlir-pdll/mlir-pdll.cpp",
    ],
    deps = [
        ":IR",
        ":PDLLAST",
        ":PDLLCodeGen",
        ":PDLLODS",
        ":PDLLParser",
        ":Support",
        "//llvm:Support",
        "//llvm:config",
    ],
)

cc_binary(
    name = "mlir-pdll-lsp-server",
    srcs = ["tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp"],
    includes = ["include"],
    deps = [
        ":MlirPdllLspServerLib",
        ":Support",
    ],
)

td_library(
    name = "DialectConversionPdllFiles",
    srcs = ["include/mlir/Transforms/DialectConversion.pdll"],
    includes = ["include"],
)

td_library(
    name = "UBDialectTdFiles",
    srcs = [
        "include/mlir/Dialect/UB/IR/UBOps.td",
        "include/mlir/Dialect/UB/IR/UBOpsInterfaces.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "UBOpsInterfacesIncGen",
    tbl_outs = [
        (
            ["--gen-attr-interface-decls"],
            "include/mlir/Dialect/UB/IR/UBOpsInterfaces.h.inc",
        ),
        (
            ["--gen-attr-interface-defs"],
            "include/mlir/Dialect/UB/IR/UBOpsInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/UB/IR/UBOpsInterfaces.td",
    deps = [":UBDialectTdFiles"],
)

gentbl_cc_library(
    name = "UBOpsIncGen",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=ub",
            ],
            "include/mlir/Dialect/UB/IR/UBOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=ub",
            ],
            "include/mlir/Dialect/UB/IR/UBOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/UB/IR/UBOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/UB/IR/UBOps.cpp.inc",
        ),
        (
            ["--gen-attrdef-decls"],
            "include/mlir/Dialect/UB/IR/UBOpsAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/Dialect/UB/IR/UBOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/UB/IR/UBOps.td",
    deps = [":UBDialectTdFiles"],
)

cc_library(
    name = "UBDialect",
    srcs = [
        "lib/Dialect/UB/IR/UBOps.cpp",
    ],
    hdrs = ["include/mlir/Dialect/UB/IR/UBOps.h"],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":ConvertToLLVMInterface",
        ":IR",
        ":InliningUtils",
        ":SideEffectInterfaces",
        ":UBOpsIncGen",
        ":UBOpsInterfacesIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "UBToLLVM",
    srcs = glob([
        "lib/Conversion/UBToLLVM/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/UBToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":ConvertToLLVMInterface",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":UBDialect",
    ],
)

cc_library(
    name = "UBToSPIRV",
    srcs = glob([
        "lib/Conversion/UBToSPIRV/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Conversion/UBToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":UBDialect",
    ],
)

cc_library(
    name = "VCIXDialect",
    srcs = ["lib/Dialect/LLVMIR/IR/VCIXDialect.cpp"],
    hdrs = ["include/mlir/Dialect/LLVMIR/VCIXDialect.h"],
    includes = ["include"],
    deps = [
        ":BytecodeOpInterface",
        ":GPUDialect",
        ":IR",
        ":LLVMDialect",
        ":SideEffectInterfaces",
        ":VCIXOpsIncGen",
        "//llvm:AsmParser",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "VCIXTdFiles",
    srcs = ["include/mlir/Dialect/LLVMIR/VCIXOps.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "VCIXOpsIncGen",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/VCIXOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/VCIXOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=vcix",
            ],
            "include/mlir/Dialect/LLVMIR/VCIXOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=vcix",
            ],
            "include/mlir/Dialect/LLVMIR/VCIXOpsDialect.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=vcix",
            ],
            "include/mlir/Dialect/LLVMIR/VCIXOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=vcix",
            ],
            "include/mlir/Dialect/LLVMIR/VCIXOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/VCIXOps.td",
    deps = [":VCIXTdFiles"],
)

cc_library(
    name = "VCIXToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/VCIX/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/VCIX/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":ToLLVMIRTranslation",
        ":VCIXConversionIncGen",
        ":VCIXDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "VCIXConversionIncGen",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/VCIXConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/VCIXOps.td",
    deps = [":VCIXTdFiles"],
)

gentbl_cc_library(
    name = "QuantPassIncGen",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Quant",
            ],
            "include/mlir/Dialect/Quant/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Quant/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "QuantTransforms",
    srcs = glob([
        "lib/Dialect/Quant/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Quant/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithDialect",
        ":FuncDialect",
        ":FuncTransforms",
        ":IR",
        ":LinalgDialect",
        ":Pass",
        ":QuantOps",
        ":QuantPassIncGen",
        ":ShapeDialect",
        ":TensorDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)