Compiler projects using llvm
import("//clang/resource_dir.gni")
import("//clang/utils/TableGen/clang_tablegen.gni")

# Generate arm_neon.h
clang_tablegen("arm_neon") {
  args = [ "-gen-arm-neon" ]
  td_file = "//clang/include/clang/Basic/arm_neon.td"
  output_name = "arm_neon.h"
}

# Generate arm_fp16.h
clang_tablegen("arm_fp16") {
  args = [ "-gen-arm-fp16" ]
  td_file = "//clang/include/clang/Basic/arm_fp16.td"
  output_name = "arm_fp16.h"
}

# Generate arm_sve.h
clang_tablegen("arm_sve") {
  args = [ "-gen-arm-sve-header" ]
  td_file = "//clang/include/clang/Basic/arm_sve.td"
  output_name = "arm_sve.h"
}

# Generate arm_bf16.h
clang_tablegen("arm_bf16") {
  args = [ "-gen-arm-bf16" ]
  td_file = "//clang/include/clang/Basic/arm_bf16.td"
  output_name = "arm_bf16.h"
}

# Generate arm_mve.h
clang_tablegen("arm_mve") {
  args = [ "-gen-arm-mve-header" ]
  td_file = "//clang/include/clang/Basic/arm_mve.td"
  output_name = "arm_mve.h"
}

# Generate arm_cde.h
clang_tablegen("arm_cde") {
  args = [ "-gen-arm-cde-header" ]
  td_file = "//clang/include/clang/Basic/arm_cde.td"
  output_name = "arm_cde.h"
}

# Generate riscv_vector.h
clang_tablegen("riscv_vector") {
  args = [ "-gen-riscv-vector-header" ]
  td_file = "//clang/include/clang/Basic/riscv_vector.td"
  output_name = "riscv_vector.h"
}

copy("tablegen_headers") {
  visibility = [ ":Headers" ]
  deps = [
    ":arm_bf16",
    ":arm_cde",
    ":arm_fp16",
    ":arm_mve",
    ":arm_neon",
    ":arm_sve",
    ":riscv_vector",
  ]
  sources = []
  foreach(dep, deps) {
    sources += get_target_outputs(dep)
  }
  outputs = [ "$clang_resource_dir/include/{{source_file_part}}" ]
}

copy("Headers") {
  deps = [ ":tablegen_headers" ]

  sources = [
    "__clang_cuda_builtin_vars.h",
    "__clang_cuda_cmath.h",
    "__clang_cuda_complex_builtins.h",
    "__clang_cuda_device_functions.h",
    "__clang_cuda_intrinsics.h",
    "__clang_cuda_libdevice_declares.h",
    "__clang_cuda_math.h",
    "__clang_cuda_math_forward_declares.h",
    "__clang_cuda_runtime_wrapper.h",
    "__clang_cuda_texture_intrinsics.h",
    "__clang_hip_cmath.h",
    "__clang_hip_libdevice_declares.h",
    "__clang_hip_math.h",
    "__clang_hip_runtime_wrapper.h",
    "__stddef_max_align_t.h",
    "__wmmintrin_aes.h",
    "__wmmintrin_pclmul.h",
    "adxintrin.h",
    "altivec.h",
    "ammintrin.h",
    "amxintrin.h",
    "arm64intr.h",
    "arm_acle.h",
    "arm_cmse.h",
    "arm_neon_sve_bridge.h",
    "armintr.h",
    "avx2intrin.h",
    "avx512bf16intrin.h",
    "avx512bitalgintrin.h",
    "avx512bwintrin.h",
    "avx512cdintrin.h",
    "avx512dqintrin.h",
    "avx512erintrin.h",
    "avx512fintrin.h",
    "avx512fp16intrin.h",
    "avx512ifmaintrin.h",
    "avx512ifmavlintrin.h",
    "avx512pfintrin.h",
    "avx512vbmi2intrin.h",
    "avx512vbmiintrin.h",
    "avx512vbmivlintrin.h",
    "avx512vlbf16intrin.h",
    "avx512vlbitalgintrin.h",
    "avx512vlbwintrin.h",
    "avx512vlcdintrin.h",
    "avx512vldqintrin.h",
    "avx512vlfp16intrin.h",
    "avx512vlintrin.h",
    "avx512vlvbmi2intrin.h",
    "avx512vlvnniintrin.h",
    "avx512vlvp2intersectintrin.h",
    "avx512vnniintrin.h",
    "avx512vp2intersectintrin.h",
    "avx512vpopcntdqintrin.h",
    "avx512vpopcntdqvlintrin.h",
    "avxintrin.h",
    "avxvnniintrin.h",
    "bmi2intrin.h",
    "bmiintrin.h",
    "builtins.h",
    "cet.h",
    "cetintrin.h",
    "cldemoteintrin.h",
    "clflushoptintrin.h",
    "clwbintrin.h",
    "clzerointrin.h",
    "cpuid.h",
    "crc32intrin.h",
    "cuda_wrappers/algorithm",
    "cuda_wrappers/complex",
    "cuda_wrappers/new",
    "emmintrin.h",
    "enqcmdintrin.h",
    "f16cintrin.h",
    "float.h",
    "fma4intrin.h",
    "fmaintrin.h",
    "fxsrintrin.h",
    "gfniintrin.h",
    "hexagon_circ_brev_intrinsics.h",
    "hexagon_protos.h",
    "hexagon_types.h",
    "hlsl.h",
    "hlsl/hlsl_basic_types.h",
    "hlsl/hlsl_intrinsics.h",
    "hresetintrin.h",
    "htmintrin.h",
    "htmxlintrin.h",
    "hvx_hexagon_protos.h",
    "ia32intrin.h",
    "immintrin.h",
    "intrin.h",
    "inttypes.h",
    "invpcidintrin.h",
    "iso646.h",
    "keylockerintrin.h",
    "limits.h",
    "lwpintrin.h",
    "lzcntintrin.h",
    "mm3dnow.h",
    "mm_malloc.h",
    "mmintrin.h",
    "module.modulemap",
    "movdirintrin.h",
    "msa.h",
    "mwaitxintrin.h",
    "nmmintrin.h",
    "opencl-c-base.h",
    "opencl-c.h",
    "openmp_wrappers/__clang_openmp_device_functions.h",
    "openmp_wrappers/cmath",
    "openmp_wrappers/complex.h",
    "openmp_wrappers/complex_cmath.h",
    "openmp_wrappers/math.h",
    "pconfigintrin.h",
    "pkuintrin.h",
    "pmmintrin.h",
    "popcntintrin.h",
    "ppc_wrappers/bmi2intrin.h",
    "ppc_wrappers/bmiintrin.h",
    "ppc_wrappers/emmintrin.h",
    "ppc_wrappers/immintrin.h",
    "ppc_wrappers/mm_malloc.h",
    "ppc_wrappers/mmintrin.h",
    "ppc_wrappers/pmmintrin.h",
    "ppc_wrappers/smmintrin.h",
    "ppc_wrappers/tmmintrin.h",
    "ppc_wrappers/x86gprintrin.h",
    "ppc_wrappers/x86intrin.h",
    "ppc_wrappers/xmmintrin.h",
    "prfchwintrin.h",
    "ptwriteintrin.h",
    "rdpruintrin.h",
    "rdseedintrin.h",
    "rtmintrin.h",
    "s390intrin.h",
    "serializeintrin.h",
    "sgxintrin.h",
    "shaintrin.h",
    "smmintrin.h",
    "stdalign.h",
    "stdarg.h",
    "stdatomic.h",
    "stdbool.h",
    "stddef.h",
    "stdint.h",
    "stdnoreturn.h",
    "tbmintrin.h",
    "tgmath.h",
    "tmmintrin.h",
    "tsxldtrkintrin.h",
    "uintrintrin.h",
    "unwind.h",
    "vadefs.h",
    "vaesintrin.h",
    "varargs.h",
    "vecintrin.h",
    "velintrin.h",
    "velintrin_approx.h",
    "velintrin_gen.h",
    "vpclmulqdqintrin.h",
    "waitpkgintrin.h",
    "wasm_simd128.h",
    "wbnoinvdintrin.h",
    "wmmintrin.h",
    "x86gprintrin.h",
    "x86intrin.h",
    "xmmintrin.h",
    "xopintrin.h",
    "xsavecintrin.h",
    "xsaveintrin.h",
    "xsaveoptintrin.h",
    "xsavesintrin.h",
    "xtestintrin.h",
  ]
  outputs = [ "$clang_resource_dir/include/{{source_target_relative}}" ]
}