brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 6427c2a Raw
117 lines · plain
1# Description:2#   MLIR Tutorial3 4load("@rules_cc//cc:defs.bzl", "cc_binary")5load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")6 7licenses(["notice"])8 9package(default_visibility = ["//visibility:public"])10 11td_library(12    name = "ToyOpsTdFiles",13    srcs = [14        "include/toy/Ops.td",15        "include/toy/ShapeInferenceInterface.td",16    ],17    includes = ["include"],18    deps = [19        "//mlir:CallInterfacesTdFiles",20        "//mlir:CastInterfacesTdFiles",21        "//mlir:FunctionInterfacesTdFiles",22        "//mlir:OpBaseTdFiles",23        "//mlir:SideEffectInterfacesTdFiles",24    ],25)26 27gentbl_cc_library(28    name = "ToyInterfacesIncGen",29    tbl_outs = {30        "include/toy/ShapeInferenceOpInterfaces.h.inc": ["-gen-op-interface-decls"],31        "include/toy/ShapeInferenceOpInterfaces.cpp.inc": ["-gen-op-interface-defs"],32    },33    tblgen = "//mlir:mlir-tblgen",34    td_file = "include/toy/ShapeInferenceInterface.td",35    deps = [":ToyOpsTdFiles"],36)37 38gentbl_cc_library(39    name = "ToyOpsIncGen",40    tbl_outs = {41        "include/toy/Ops.h.inc": ["-gen-op-decls"],42        "include/toy/Ops.cpp.inc": ["-gen-op-defs"],43        "include/toy/Dialect.h.inc": ["-gen-dialect-decls"],44        "include/toy/Dialect.cpp.inc": ["-gen-dialect-defs"],45    },46    tblgen = "//mlir:mlir-tblgen",47    td_file = "include/toy/Ops.td",48    deps = [":ToyOpsTdFiles"],49)50 51gentbl_cc_library(52    name = "ToyCombineIncGen",53    strip_include_prefix = "mlir",54    tbl_outs = {"mlir/ToyCombine.inc": ["-gen-rewriters"]},55    tblgen = "//mlir:mlir-tblgen",56    td_file = "mlir/ToyCombine.td",57    deps = [":ToyOpsTdFiles"],58)59 60cc_binary(61    name = "toyc-ch6",62    srcs = [63        "mlir/Dialect.cpp",64        "mlir/LowerToAffineLoops.cpp",65        "mlir/LowerToLLVM.cpp",66        "mlir/MLIRGen.cpp",67        "mlir/ShapeInferencePass.cpp",68        "mlir/ToyCombine.cpp",69        "parser/AST.cpp",70        "toyc.cpp",71    ] + glob(["include/toy/*.h"]),72    includes = ["include/"],73    deps = [74        ":ToyCombineIncGen",75        ":ToyInterfacesIncGen",76        ":ToyOpsIncGen",77        "//llvm:Core",78        "//llvm:OrcJIT",79        "//llvm:Support",80        "//mlir:AffineDialect",81        "//mlir:AffineToStandard",82        "//mlir:AffineTransforms",83        "//mlir:AllPassesAndDialects",84        "//mlir:Analysis",85        "//mlir:ArithDialect",86        "//mlir:ArithToLLVM",87        "//mlir:BuiltinToLLVMIRTranslation",88        "//mlir:BytecodeReader",89        "//mlir:CallOpInterfaces",90        "//mlir:CastInterfaces",91        "//mlir:ControlFlowToLLVM",92        "//mlir:ExecutionEngine",93        "//mlir:ExecutionEngineUtils",94        "//mlir:FuncDialect",95        "//mlir:FuncExtensions",96        "//mlir:FuncToLLVM",97        "//mlir:FunctionInterfaces",98        "//mlir:IR",99        "//mlir:InliningUtils",100        "//mlir:LLVMCommonConversion",101        "//mlir:LLVMDialect",102        "//mlir:LLVMIRTransforms",103        "//mlir:LLVMToLLVMIRTranslation",104        "//mlir:MemRefDialect",105        "//mlir:MemRefToLLVM",106        "//mlir:Parser",107        "//mlir:Pass",108        "//mlir:SCFDialect",109        "//mlir:SCFToControlFlow",110        "//mlir:SideEffectInterfaces",111        "//mlir:Support",112        "//mlir:ToLLVMIRTranslation",113        "//mlir:TransformUtils",114        "//mlir:Transforms",115    ],116)117