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

tablegen("AMDGPUGenSearchableTables") {
  visibility = [ ":Utils" ]
  args = [ "-gen-searchable-tables" ]
  td_file = "../AMDGPU.td"
}

static_library("Utils") {
  output_name = "LLVMAMDGPUUtils"
  public_deps = [
    ":AMDGPUGenSearchableTables",
  ]
  deps = [
    "//llvm/lib/BinaryFormat",
    "//llvm/lib/IR",
    "//llvm/lib/MC",
    "//llvm/lib/Support",

    # MCTargetDesc depends on Utils, so we can't depend on the full
    # MCTargetDesc target here: it would form a cycle.
    "//llvm/lib/Target/AMDGPU/MCTargetDesc:tablegen",
  ]

  # AMDGPUBaseInfo.h includes a header from MCTargetDesc :-/
  include_dirs = [ ".." ]
  sources = [
    "AMDGPUAsmUtils.cpp",
    "AMDGPUBaseInfo.cpp",
    "AMDGPUPALMetadata.cpp",
    "AMDKernelCodeTUtils.cpp",
  ]
}
