llvm/llvm/utils/gn/secondary/llvm/lib/Target/LoongArch/BUILD.gn

import("//llvm/utils/TableGen/tablegen.gni")

tablegen("LoongArchGenDAGISel") {
  visibility = [ ":LLVMLoongArchCodeGen" ]
  args = [ "-gen-dag-isel" ]
  td_file = "LoongArch.td"
}

tablegen("LoongArchGenMCPseudoLowering") {
  visibility = [ ":LLVMLoongArchCodeGen" ]
  args = [ "-gen-pseudo-lowering" ]
  td_file = "LoongArch.td"
}

static_library("LLVMLoongArchCodeGen") {
  deps = [
    ":LoongArchGenDAGISel",
    ":LoongArchGenMCPseudoLowering",

    # See https://reviews.llvm.org/D137532
    "AsmParser:LoongArchGenAsmMatcher",
    "MCTargetDesc",
    "TargetInfo",
    "//llvm/include/llvm/Config:llvm-config",
    "//llvm/lib/Analysis",
    "//llvm/lib/CodeGen",
    "//llvm/lib/CodeGen/AsmPrinter",
    "//llvm/lib/CodeGen/SelectionDAG",
    "//llvm/lib/IR",
    "//llvm/lib/MC",
    "//llvm/lib/Support",
    "//llvm/lib/Target",
  ]
  include_dirs = [ "." ]
  sources = [
    "LoongArchAsmPrinter.cpp",
    "LoongArchDeadRegisterDefinitions.cpp",
    "LoongArchExpandAtomicPseudoInsts.cpp",
    "LoongArchExpandPseudoInsts.cpp",
    "LoongArchFrameLowering.cpp",
    "LoongArchISelDAGToDAG.cpp",
    "LoongArchISelLowering.cpp",
    "LoongArchInstrInfo.cpp",
    "LoongArchMCInstLower.cpp",
    "LoongArchMergeBaseOffset.cpp",
    "LoongArchOptWInstrs.cpp",
    "LoongArchRegisterInfo.cpp",
    "LoongArchSubtarget.cpp",
    "LoongArchTargetMachine.cpp",
    "LoongArchTargetTransformInfo.cpp",
  ]
}

# This is a bit different from most build files: Due to this group
# having the directory's name, "//llvm/lib/Target/LoongArch" will refer to this
# target, which pulls in the code in this directory *and all subdirectories*.
# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
# different behavior.
group("LoongArch") {
  deps = [
    ":LLVMLoongArchCodeGen",
    "AsmParser",
    "Disassembler",
    "MCTargetDesc",
    "TargetInfo",
  ]
}