[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / utils / bazel / llvm-project-overlay / llvm / BUILD.bazel
blob5898da1b770cf3e7c86f8327fd6778a40f8c69c8
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
6 load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
7 load(":tblgen.bzl", "gentbl")
8 load(":config.bzl", "llvm_config_defines")
9 load(":targets.bzl", "llvm_targets")
10 load(":enum_targets_gen.bzl", "enum_targets_gen")
11 load(":binary_alias.bzl", "binary_alias")
13 package(
14     default_visibility = ["//visibility:public"],
15     features = ["layering_check"],
18 licenses(["notice"])
20 exports_files([
21     "LICENSE.TXT",
22     "cmake/modules/llvm-driver-template.cpp.in",
23     "include/llvm/CodeGen/SDNodeProperties.td",
24     "include/llvm/CodeGen/ValueTypes.td",
25     "include/llvm/Frontend/Directive/DirectiveBase.td",
26     "include/llvm/Frontend/OpenACC/ACC.td",
27     "include/llvm/Frontend/OpenMP/OMP.td",
28     "include/llvm/IR/Intrinsics.td",
29     "include/llvm/Option/OptParser.td",
30     "utils/lit/lit.py",
33 # It may be tempting to add compiler flags here, but that should be avoided.
34 # The necessary warnings and other compile flags should be provided by the
35 # toolchain or the `.bazelrc` file. This is just a workaround until we have a
36 # widely available feature to enable unlimited stack frame instead of using
37 # this `Make` variable.
38 llvm_copts = [
39     "$(STACK_FRAME_UNLIMITED)",
42 enum_targets_gen(
43     name = "targets_def_gen",
44     src = "include/llvm/Config/Targets.def.in",
45     out = "include/llvm/Config/Targets.def",
46     macro_name = "TARGET",
47     targets = llvm_targets,
50 # Enabled targets with ASM printers.
51 llvm_target_asm_printers = [
52     t
53     for t in llvm_targets
54     if glob(["lib/Target/{}/*AsmPrinter.cpp".format(t)])
57 enum_targets_gen(
58     name = "asm_printers_def_gen",
59     src = "include/llvm/Config/AsmPrinters.def.in",
60     out = "include/llvm/Config/AsmPrinters.def",
61     macro_name = "ASM_PRINTER",
62     targets = llvm_target_asm_printers,
65 # Enabled targets with ASM parsers.
66 llvm_target_asm_parsers = [
67     t
68     for t in llvm_targets
69     if glob(["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)])
72 enum_targets_gen(
73     name = "asm_parsers_def_gen",
74     src = "include/llvm/Config/AsmParsers.def.in",
75     out = "include/llvm/Config/AsmParsers.def",
76     macro_name = "ASM_PARSER",
77     targets = llvm_target_asm_parsers,
80 # Enabled targets with disassemblers.
81 llvm_target_disassemblers = [
82     t
83     for t in llvm_targets
84     if glob(["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)])
87 enum_targets_gen(
88     name = "disassemblers_def_gen",
89     src = "include/llvm/Config/Disassemblers.def.in",
90     out = "include/llvm/Config/Disassemblers.def",
91     macro_name = "DISASSEMBLER",
92     targets = llvm_target_disassemblers,
95 # Enabled targets with MCA.
96 llvm_target_mcas = [
97     t
98     for t in llvm_targets
99     if glob(["lib/Target/{}/MCA/CMakeLists.txt".format(t)])
102 enum_targets_gen(
103     name = "target_mca_def_gen",
104     src = "include/llvm/Config/TargetMCAs.def.in",
105     out = "include/llvm/Config/TargetMCAs.def",
106     macro_name = "TARGETMCA",
107     targets = llvm_target_mcas,
110 # Enabled targets with exegesis.
111 llvm_target_exegesis = [
112     t
113     for t in llvm_targets
114     if glob(["tools/llvm-exegesis/lib/{}/CMakeLists.txt".format(t)])
117 enum_targets_gen(
118     name = "target_exegesis_def_gen",
119     src = "include/llvm/Config/TargetExegesis.def.in",
120     out = "include/llvm/Config/TargetExegesis.def",
121     macro_name = "EXEGESIS",
122     placeholder_name = "@LLVM_ENUM_EXEGESIS@",
123     targets = llvm_target_exegesis,
126 expand_template(
127     name = "abi_breaking_h_gen",
128     out = "include/llvm/Config/abi-breaking.h",
129     substitutions = {
130         # Define to enable checks that alter the LLVM C++ ABI
131         "#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS": "#define LLVM_ENABLE_ABI_BREAKING_CHECKS 0",
133         # Define to enable reverse iteration of unordered llvm containers
134         "#cmakedefine01 LLVM_ENABLE_REVERSE_ITERATION": "#define LLVM_ENABLE_REVERSE_ITERATION 0",
135     },
136     template = "include/llvm/Config/abi-breaking.h.cmake",
139 # To enable diff testing out of tree
140 exports_files([
141     "include/llvm/Config/config.h.cmake",
142     "include/llvm/Config/llvm-config.h.cmake",
143     "include/llvm/Config/abi-breaking.h.cmake",
146 cc_library(
147     name = "config",
148     hdrs = [
149         "include/llvm/Config/abi-breaking.h",
150         "include/llvm/Config/llvm-config.h",
151     ],
152     copts = llvm_copts,
153     defines = llvm_config_defines,
154     includes = ["include"],
155     textual_hdrs = [
156         "include/llvm/Config/AsmParsers.def",
157         "include/llvm/Config/AsmPrinters.def",
158         "include/llvm/Config/Disassemblers.def",
159         "include/llvm/Config/Targets.def",
160         "include/llvm/Config/TargetExegesis.def",
161         "include/llvm/Config/TargetMCAs.def",
162         # Needed for include scanner to find execinfo.h
163         "include/llvm/Config/config.h",
164     ],
167 cc_library(
168     name = "Demangle",
169     srcs = glob([
170         "lib/Demangle/*.cpp",
171         "lib/Demangle/*.h",
172     ]),
173     hdrs = glob([
174         "include/llvm/Demangle/*.h",
175         "include/llvm/Demangle/*.def",
176     ]),
177     copts = llvm_copts,
178     deps = [":config"],
181 genrule(
182     name = "generate_vcs_revision",
183     outs = ["include/llvm/Support/VCSRevision.h"],
184     cmd = "echo '#undef LLVM_REVISION' >> $@\n" +
185           "echo '#undef LLVM_REPOSITORY' >> $@\n",
188 genrule(
189     name = "generate_static_extension_registry",
190     outs = ["include/llvm/Support/Extension.def"],
191     cmd = "echo -e '// extension handlers' >> $@\n" +
192           "echo -e '#undef HANDLE_EXTENSION' >> $@\n",
195 cc_library(
196     name = "Support",
197     srcs = glob([
198         "lib/Support/*.c",
199         "lib/Support/*.cpp",
200         "lib/Support/*.h",
201         "lib/Support/*.inc",
202         # To avoid a dependency cycle.
203         "include/llvm/Option/*.h",
204     ]) + select({
205         "@platforms//os:windows": glob([
206             "lib/Support/Windows/*.h",
207             "lib/Support/Windows/*.inc",
208         ]),
209         "//conditions:default": glob([
210             "lib/Support/Unix/*.h",
211             "lib/Support/Unix/*.inc",
212         ]),
213     }) + [
214         "lib/Support/BLAKE3/blake3.c",
215         "lib/Support/BLAKE3/blake3_dispatch.c",
216         "lib/Support/BLAKE3/blake3_impl.h",
217         "lib/Support/BLAKE3/blake3_portable.c",
218         "lib/Support/BLAKE3/llvm_blake3_prefix.h",
219     ] + select({
220         "@platforms//cpu:aarch64": [
221             "lib/Support/BLAKE3/blake3_neon.c",
222         ],
223         "@platforms//cpu:x86_64": [
224             "lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S",
225             "lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S",
226             "lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S",
227             "lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S",
228         ],
229         "//conditions:default": [
230         ],
231     }),
232     hdrs = glob([
233         "include/llvm/Support/**/*.h",
234         "include/llvm/ADT/*.h",
235     ]) + [
236         "include/llvm-c/Core.h",
237         "include/llvm-c/DataTypes.h",
238         "include/llvm-c/Deprecated.h",
239         "include/llvm-c/DisassemblerTypes.h",
240         "include/llvm-c/Error.h",
241         "include/llvm-c/ErrorHandling.h",
242         "include/llvm-c/ExternC.h",
243         "include/llvm-c/Support.h",
244         "include/llvm-c/Types.h",
245         "include/llvm-c/blake3.h",
246         "include/llvm/ExecutionEngine/JITSymbol.h",
247         "include/llvm/Support/Extension.def",
248         "include/llvm/Support/VCSRevision.h",
249     ],
250     copts = llvm_copts,
251     defines = select({
252         "@platforms//cpu:aarch64": [
253         ],
254         "//conditions:default": [
255             "BLAKE3_USE_NEON=0",
256         ],
257     }) + select({
258         "@platforms//cpu:x86_64": [
259         ],
260         "//conditions:default": [
261             "BLAKE3_NO_AVX2",
262             "BLAKE3_NO_AVX512",
263             "BLAKE3_NO_SSE2",
264             "BLAKE3_NO_SSE41",
265         ],
266     }),
267     includes = ["include"],
268     linkopts = select({
269         "@platforms//os:windows": [],
270         "@platforms//os:freebsd": [
271             "-pthread",
272             "-lexecinfo",
273             "-ldl",
274             "-lm",
275         ],
276         "//conditions:default": [
277             "-pthread",
278             "-ldl",
279             "-lm",
280         ],
281     }),
282     textual_hdrs = glob([
283         "include/llvm/Support/*.def",
284     ]),
285     deps = [
286         ":config",
287         ":Demangle",
288         # We unconditionally depend on the custom LLVM zlib wrapper. This will
289         # be an empty library unless zlib is enabled, in which case it will
290         # both provide the necessary dependencies and configuration defines.
291         "@llvm_zlib//:zlib",
292         # We unconditionally depend on the custom LLVM zstd wrapper. This will
293         # be an empty library unless zstd is enabled, in which case it will
294         # both provide the necessary dependencies and configuration defines.
295         "@llvm_zstd//:zstd",
296     ],
299 # Note: although FileCheck (the binary) is a test utility, some non-test
300 # targets depend on the FileCheck library target.
301 cc_library(
302     name = "FileCheckLib",
303     srcs = glob([
304         "lib/FileCheck/*.cpp",
305         "lib/FileCheck/*.h",
306     ]),
307     hdrs = glob(["include/llvm/FileCheck/*.h"]),
308     copts = llvm_copts,
309     deps = [":Support"],
312 cc_library(
313     name = "LineEditor",
314     srcs = glob([
315         "lib/LineEditor/*.cpp",
316         "lib/LineEditor/*.h",
317     ]),
318     hdrs = glob(["include/llvm/LineEditor/*.h"]),
319     copts = llvm_copts,
320     deps = [
321         ":Support",
322         ":config",
323     ],
326 cc_library(
327     name = "Option",
328     srcs = glob([
329         "lib/Option/*.cpp",
330         "lib/Option/*.h",
331     ]),
332     hdrs = glob(["include/llvm/Option/*.h"]),
333     copts = llvm_copts,
334     deps = [
335         ":Support",
336         ":config",
337     ],
340 cc_library(
341     name = "TableGen",
342     srcs = glob([
343         "lib/TableGen/*.cpp",
344         "lib/TableGen/*.h",
345     ]),
346     hdrs = glob(["include/llvm/TableGen/*.h"]),
347     copts = llvm_copts,
348     deps = [
349         ":Support",
350         ":config",
351     ],
354 # This exists to avoid circular dependencies.
355 cc_library(
356     name = "ir_headers",
357     hdrs = glob(
358         [
359             "include/llvm/*.h",
360             "include/llvm/IR/*.h",
361         ],
362         exclude = [
363             "include/llvm/LinkAllPasses.h",
364         ],
365     ) + [
366         "include/llvm-c/Comdat.h",
367         "include/llvm-c/DebugInfo.h",
368         "include/llvm/IR/Value.def",
369     ],
370     copts = llvm_copts,
373 cc_library(
374     name = "BinaryFormat",
375     srcs = glob([
376         "lib/BinaryFormat/*.cpp",
377         "lib/BinaryFormat/*.def",
378         "lib/BinaryFormat/*.h",
379     ]),
380     hdrs = glob([
381         "include/llvm/BinaryFormat/*.h",
382     ]),
383     copts = llvm_copts,
384     includes = ["include"],
385     textual_hdrs = glob([
386         "include/llvm/BinaryFormat/*.def",
387         "include/llvm/BinaryFormat/ELFRelocs/*.def",
388     ]),
389     deps = [
390         ":Support",
391         ":TargetParser",
392     ],
395 cc_library(
396     name = "DebugInfo",
397     hdrs = glob(["include/llvm/DebugInfo/**/*.h"]),
398     copts = llvm_copts,
399     textual_hdrs = glob(["include/llvm/DebugInfo/**/*.def"]),
400     deps = [
401         ":Object",
402         ":Support",
403     ],
406 cc_library(
407     name = "DebugInfoMSF",
408     srcs = glob([
409         "lib/DebugInfo/MSF/*.cpp",
410         "lib/DebugInfo/MSF/*.h",
411     ]),
412     hdrs = glob(["include/llvm/DebugInfo/MSF/*.h"]),
413     copts = llvm_copts,
414     deps = [":Support"],
417 cc_library(
418     name = "DebugInfoBTF",
419     srcs = glob([
420         "lib/DebugInfo/BTF/*.cpp",
421         "lib/DebugInfo/BTF/*.h",
422     ]),
423     hdrs = glob(["include/llvm/DebugInfo/BTF/*.h"]) + [
424         "include/llvm/DebugInfo/BTF/BTF.def",
425     ],
426     copts = llvm_copts,
427     deps = [
428         ":DebugInfo",
429         ":Object",
430         ":Support",
431     ],
434 cc_library(
435     name = "DebugInfoCodeView",
436     srcs = glob([
437         "lib/DebugInfo/CodeView/*.cpp",
438         "lib/DebugInfo/CodeView/*.h",
439     ]),
440     hdrs = glob([
441         "include/llvm/DebugInfo/CodeView/*.h",
442     ]),
443     copts = llvm_copts,
444     textual_hdrs = glob([
445         "include/llvm/DebugInfo/CodeView/*.def",
446     ]),
447     deps = [
448         ":BinaryFormat",
449         ":DebugInfoMSF",
450         ":Support",
451     ],
454 cc_library(
455     name = "DebugInfoLogicalView",
456     srcs = glob([
457         "lib/DebugInfo/LogicalView/**/*.cpp",
458     ]),
459     hdrs = glob([
460         "include/llvm/DebugInfo/LogicalView/**/*.h",
461     ]),
462     copts = llvm_copts,
463     deps = [
464         ":BinaryFormat",
465         ":DebugInfo",
466         ":DebugInfoCodeView",
467         ":DebugInfoDWARF",
468         ":DebugInfoPDB",
469         ":Demangle",
470         ":MC",
471         ":MCDisassembler",
472         ":Object",
473         ":Support",
474     ],
477 cc_library(
478     name = "DebugInfoPDB",
479     srcs = glob([
480         "lib/DebugInfo/PDB/*.cpp",
481         "lib/DebugInfo/PDB/*.h",
482         "lib/DebugInfo/PDB/Native/*.cpp",
483         "lib/DebugInfo/PDB/Native/*.h",
484     ]),
485     hdrs = glob([
486         "include/llvm/DebugInfo/PDB/*.h",
487         "include/llvm/DebugInfo/PDB/Native/*.h",
488     ]),
489     copts = llvm_copts,
490     deps = [
491         ":BinaryFormat",
492         ":DebugInfo",
493         ":DebugInfoBTF",
494         ":DebugInfoCodeView",
495         ":DebugInfoMSF",
496         ":Object",
497         ":Support",
498         ":config",
499     ],
502 cc_library(
503     name = "Debuginfod",
504     srcs = glob([
505         "lib/Debuginfod/*.cpp",
506     ]),
507     hdrs = glob([
508         "include/llvm/Debuginfod/*.h",
509     ]),
510     copts = llvm_copts,
511     deps = [
512         ":BinaryFormat",
513         ":DebugInfoDWARF",
514         ":Object",
515         ":Support",
516         ":Symbolize",
517     ],
520 cc_library(
521     name = "MC",
522     srcs = glob([
523         "lib/MC/*.cpp",
524         "lib/MC/*.h",
525     ]),
526     hdrs = glob([
527         "include/llvm/MC/*.h",
528         "include/llvm/MC/*.def",
529         "include/llvm/MC/*.inc",
530     ]),
531     copts = llvm_copts,
532     deps = [
533         ":BinaryFormat",
534         ":DebugInfoCodeView",
535         ":Support",
536         ":TargetParser",
537         ":config",
538         ":ir_headers",
539     ],
542 cc_library(
543     name = "DebugInfoDWARF",
544     srcs = glob([
545         "lib/DebugInfo/DWARF/*.cpp",
546         "lib/DebugInfo/DWARF/*.h",
547     ]),
548     hdrs = glob(["include/llvm/DebugInfo/DWARF/*.h"]),
549     copts = llvm_copts,
550     deps = [
551         ":BinaryFormat",
552         ":DebugInfo",
553         ":MC",
554         ":Object",
555         ":Support",
556         ":TargetParser",
557     ],
560 cc_library(
561     name = "DebugInfoGSYM",
562     srcs = glob([
563         "lib/DebugInfo/GSYM/*.cpp",
564         "lib/DebugInfo/GSYM/*.h",
565     ]),
566     hdrs = glob(["include/llvm/DebugInfo/GSYM/*.h"]),
567     copts = llvm_copts,
568     deps = [
569         ":DebugInfo",
570         ":DebugInfoDWARF",
571         ":MC",
572         ":Object",
573         ":Support",
574     ],
577 cc_library(
578     name = "Symbolize",
579     srcs = glob([
580         "lib/DebugInfo/Symbolize/*.cpp",
581         "lib/DebugInfo/Symbolize/*.h",
582     ]),
583     hdrs = glob([
584         "include/llvm/DebugInfo/Symbolize/*.h",
585         "include/llvm/Debuginfod/*.h",
586     ]),
587     copts = llvm_copts,
588     deps = [
589         ":BinaryFormat",
590         ":DebugInfo",
591         ":DebugInfoDWARF",
592         ":DebugInfoPDB",
593         ":Demangle",
594         ":Object",
595         ":Support",
596         ":TargetParser",
597     ],
600 cc_binary(
601     name = "llvm-min-tblgen",
602     srcs = [
603         "utils/TableGen/Attributes.cpp",
604         "utils/TableGen/CodeGenIntrinsics.cpp",
605         "utils/TableGen/CodeGenIntrinsics.h",
606         "utils/TableGen/DirectiveEmitter.cpp",
607         "utils/TableGen/IntrinsicEmitter.cpp",
608         "utils/TableGen/RISCVTargetDefEmitter.cpp",
609         "utils/TableGen/SDNodeProperties.cpp",
610         "utils/TableGen/SDNodeProperties.h",
611         "utils/TableGen/SequenceToOffsetTable.h",
612         "utils/TableGen/TableGen.cpp",
613         "utils/TableGen/VTEmitter.cpp",
614     ],
615     copts = llvm_copts,
616     stamp = 0,
617     deps = [
618         ":Support",
619         ":TableGen",
620         ":config",
621     ],
624 cc_library(
625     name = "TableGenGlobalISel",
626     srcs = glob([
627         "utils/TableGen/GlobalISel/*.cpp",
628     ]) + [
629         "utils/TableGen/CodeGenInstruction.h",
630     ],
631     hdrs = glob([
632         # We have to include these headers here as well as in the `hdrs` below
633         # to allow the `.cpp` files to use file-relative-inclusion to find
634         # them, even though consumers of this library use inclusion relative to
635         # `utils/TableGen` with the `strip_includes_prefix` of this library.
636         # This mixture appears to be incompatible with header modules.
637         "utils/TableGen/GlobalISel/*.h",
638     ]),
639     copts = llvm_copts,
640     features = ["-header_modules"],
641     strip_include_prefix = "utils/TableGen",
642     deps = [
643         ":CodeGenTypes",
644         ":Support",
645         ":TableGen",
646         ":config",
647     ],
650 cc_library(
651     name = "llvm-tblgen-headers",
652     textual_hdrs = glob(["utils/TableGen/*.def"]),
655 cc_binary(
656     name = "llvm-tblgen",
657     srcs = glob([
658         "utils/TableGen/*.cpp",
659         "utils/TableGen/*.inc",
660         "utils/TableGen/*.h",
662         # Some tablegen sources include headers from MC, so these have to be
663         # listed here. MC uses headers produced by tablegen, so it cannot be a
664         # regular dependency.
665         "include/llvm/MC/*.h",
666         "include/llvm/TargetParser/SubtargetFeature.h",
667     ]),
668     copts = llvm_copts,
669     stamp = 0,
670     deps = [
671         ":CodeGenTypes",
672         ":Support",
673         ":TableGen",
674         ":TableGenGlobalISel",
675         ":TargetParser",
676         ":config",
677         ":llvm-tblgen-headers",
678     ],
681 gentbl(
682     name = "intrinsic_enums_gen",
683     tbl_outs = [("-gen-intrinsic-enums", "include/llvm/IR/IntrinsicEnums.inc")],
684     tblgen = ":llvm-min-tblgen",
685     td_file = "include/llvm/IR/Intrinsics.td",
686     td_srcs = glob([
687         "include/llvm/CodeGen/*.td",
688         "include/llvm/IR/Intrinsics*.td",
689     ]),
692 gentbl(
693     name = "intrinsics_impl_gen",
694     tbl_outs = [("-gen-intrinsic-impl", "include/llvm/IR/IntrinsicImpl.inc")],
695     tblgen = ":llvm-min-tblgen",
696     td_file = "include/llvm/IR/Intrinsics.td",
697     td_srcs = glob([
698         "include/llvm/CodeGen/*.td",
699         "include/llvm/IR/Intrinsics*.td",
700     ]),
703 gentbl(
704     name = "vt_gen",
705     tbl_outs = [("-gen-vt", "include/llvm/CodeGen/GenVT.inc")],
706     tblgen = ":llvm-min-tblgen",
707     td_file = "include/llvm/CodeGen/ValueTypes.td",
708     td_srcs = [
709         "include/llvm/CodeGen/ValueTypes.td",
710     ],
713 # Note that the intrinsics are not currently set up so they can be pruned for
714 # disabled targets.
715 llvm_target_intrinsics_list = [
716     {
717         "name": "AArch64",
718         "intrinsic_prefix": "aarch64",
719     },
720     {
721         "name": "AMDGPU",
722         "intrinsic_prefix": "amdgcn",
723     },
724     {
725         "name": "ARM",
726         "intrinsic_prefix": "arm",
727     },
728     {
729         "name": "BPF",
730         "intrinsic_prefix": "bpf",
731     },
732     {
733         "name": "DirectX",
734         "intrinsic_prefix": "dx",
735     },
736     {
737         "name": "Hexagon",
738         "intrinsic_prefix": "hexagon",
739     },
740     {
741         "name": "LoongArch",
742         "intrinsic_prefix": "loongarch",
743     },
744     {
745         "name": "Mips",
746         "intrinsic_prefix": "mips",
747     },
748     {
749         "name": "NVPTX",
750         "intrinsic_prefix": "nvvm",
751     },
752     {
753         "name": "PowerPC",
754         "intrinsic_prefix": "ppc",
755     },
756     {
757         "name": "R600",
758         "intrinsic_prefix": "r600",
759     },
760     {
761         "name": "RISCV",
762         "intrinsic_prefix": "riscv",
763     },
764     {
765         "name": "S390",
766         "intrinsic_prefix": "s390",
767     },
768     {
769         "name": "VE",
770         "intrinsic_prefix": "ve",
771     },
772     {
773         "name": "WebAssembly",
774         "intrinsic_prefix": "wasm",
775     },
776     {
777         "name": "X86",
778         "intrinsic_prefix": "x86",
779     },
780     {
781         "name": "XCore",
782         "intrinsic_prefix": "xcore",
783     },
787     gentbl(
788         name = "intrinsic_" + target["name"] + "_gen",
789         tbl_outs = [(
790             "-gen-intrinsic-enums -intrinsic-prefix=" + target["intrinsic_prefix"],
791             "include/llvm/IR/Intrinsics" + target["name"] + ".h",
792         )],
793         tblgen = ":llvm-min-tblgen",
794         td_file = "include/llvm/IR/Intrinsics.td",
795         td_srcs = glob([
796             "include/llvm/CodeGen/*.td",
797             "include/llvm/IR/*.td",
798         ]),
799     ),
800 ] for target in llvm_target_intrinsics_list]
802 gentbl(
803     name = "attributes_gen",
804     tbl_outs = [("-gen-attrs", "include/llvm/IR/Attributes.inc")],
805     tblgen = ":llvm-min-tblgen",
806     td_file = "include/llvm/IR/Attributes.td",
807     td_srcs = ["include/llvm/IR/Attributes.td"],
810 cc_library(
811     name = "BitstreamReader",
812     srcs = glob([
813         "lib/Bitstream/Reader/*.cpp",
814         "lib/Bitstream/Reader/*.h",
815     ]),
816     hdrs = [
817         "include/llvm/Bitstream/BitCodeEnums.h",
818         "include/llvm/Bitstream/BitCodes.h",
819         "include/llvm/Bitstream/BitstreamReader.h",
820     ],
821     copts = llvm_copts,
822     deps = [
823         ":Support",
824     ],
827 cc_library(
828     name = "BitstreamWriter",
829     srcs = glob([
830         "lib/Bitstream/Writer/*.h",
831     ]),
832     hdrs = [
833         "include/llvm/Bitstream/BitCodeEnums.h",
834         "include/llvm/Bitstream/BitCodes.h",
835         "include/llvm/Bitstream/BitstreamWriter.h",
836     ],
837     copts = llvm_copts,
838     deps = [
839         ":Support",
840     ],
843 cc_library(
844     name = "Remarks",
845     srcs = glob(
846         [
847             "lib/Remarks/*.cpp",
848             "lib/Remarks/*.h",
849         ],
850         exclude = ["lib/Remarks/RemarkLinker.cpp"],
851     ),
852     hdrs = glob(
853         [
854             "include/llvm/Remarks/*.h",
855         ],
856         exclude = ["include/llvm/Remarks/RemarkLinker.h"],
857     ) + [
858         "include/llvm-c/Remarks.h",
859     ],
860     copts = llvm_copts,
861     deps = [
862         ":BitstreamReader",
863         ":BitstreamWriter",
864         ":Support",
865     ],
868 cc_library(
869     name = "remark_linker",
870     srcs = ["lib/Remarks/RemarkLinker.cpp"],
871     hdrs = ["include/llvm/Remarks/RemarkLinker.h"],
872     copts = llvm_copts,
873     deps = [
874         ":Object",
875         ":Remarks",
876         ":Support",
877     ],
880 filegroup(
881     name = "llvm_intrinsics_headers",
882     srcs = [
883         "include/llvm/IR/Intrinsics" + target["name"] + ".h"
884         for target in llvm_target_intrinsics_list
885     ],
888 cc_library(
889     name = "Core",
890     srcs = glob([
891         "lib/IR/*.cpp",
892         "lib/IR/*.h",
893     ]),
894     hdrs = glob(
895         [
896             "include/llvm/*.h",
897             "include/llvm/IR/*.h",
898         ],
899         exclude = [
900             "include/llvm/LinkAllPasses.h",
901         ],
902     ) + [
903         "include/llvm-c/Comdat.h",
904         "include/llvm-c/DebugInfo.h",
905     ] + [":llvm_intrinsics_headers"],
906     copts = llvm_copts,
907     textual_hdrs = glob(["include/llvm/IR/*.def"]),
908     deps = [
909         ":BinaryFormat",
910         ":Demangle",
911         ":Remarks",
912         ":Support",
913         ":TargetParser",
914         ":attributes_gen",
915         ":config",
916         ":intrinsic_enums_gen",
917         ":intrinsics_impl_gen",
918     ],
921 cc_library(
922     name = "BitReader",
923     srcs = glob([
924         "lib/Bitcode/Reader/*.cpp",
925         "lib/Bitcode/Reader/*.h",
926     ]),
927     hdrs = [
928         "include/llvm-c/BitReader.h",
929         "include/llvm/Bitcode/BitcodeAnalyzer.h",
930         "include/llvm/Bitcode/BitcodeCommon.h",
931         "include/llvm/Bitcode/BitcodeReader.h",
932         "include/llvm/Bitcode/LLVMBitCodes.h",
933     ],
934     copts = llvm_copts,
935     deps = [
936         ":BinaryFormat",
937         ":BitstreamReader",
938         ":Core",
939         ":Support",
940         ":TargetParser",
941         ":config",
942     ],
945 cc_library(
946     name = "MCParser",
947     srcs = glob([
948         "lib/MC/MCParser/*.cpp",
949         "lib/MC/MCParser/*.h",
950     ]),
951     hdrs = glob(["include/llvm/MC/MCParser/*.h"]),
952     copts = llvm_copts,
953     deps = [
954         ":BinaryFormat",
955         ":DebugInfoCodeView",
956         ":MC",
957         ":Support",
958         ":TargetParser",
959         ":config",
960     ],
963 cc_library(
964     name = "TextAPI",
965     srcs = glob([
966         "lib/TextAPI/**/*.cpp",
967     ]),
968     hdrs = glob([
969         "include/llvm/TextAPI/**/*.h",
970         "include/llvm/TextAPI/**/*.def",
971         "lib/TextAPI/**/*.h",
972     ]),
973     copts = llvm_copts,
974     deps = [
975         ":BinaryFormat",
976         ":Support",
977         ":TargetParser",
978     ],
981 cc_library(
982     name = "ObjCopy",
983     srcs = glob([
984         "lib/ObjCopy/**/*.cpp",
985         "lib/ObjCopy/**/*.h",
986     ]),
987     hdrs = glob([
988         "include/llvm/ObjCopy/**/*.h",
989     ]),
990     copts = llvm_copts,
991     includes = ["lib/ObjCopy"],
992     deps = [
993         ":BinaryFormat",
994         ":MC",
995         ":Object",
996         ":ObjectYAML",
997         ":Option",
998         ":Support",
999         ":Target",
1000         ":intrinsics_impl_gen",
1001     ],
1004 cc_library(
1005     name = "Object",
1006     srcs = glob([
1007         "lib/Object/*.cpp",
1008         "lib/Object/*.h",
1009     ]),
1010     hdrs = glob([
1011         "include/llvm/Object/*.h",
1012     ]) + [
1013         "include/llvm-c/Object.h",
1014     ],
1015     copts = llvm_copts,
1016     deps = [
1017         ":BinaryFormat",
1018         ":BitReader",
1019         ":Core",
1020         ":IRReader",
1021         ":MC",
1022         ":MCParser",
1023         ":Support",
1024         ":TargetParser",
1025         ":TextAPI",
1026         ":config",
1027     ],
1030 cc_library(
1031     name = "ObjectYAML",
1032     srcs = glob([
1033         "lib/ObjectYAML/*.cpp",
1034         "lib/ObjectYAML/*.h",
1035     ]),
1036     hdrs = glob(["include/llvm/ObjectYAML/*.h"]),
1037     copts = llvm_copts,
1038     deps = [
1039         ":BinaryFormat",
1040         ":DebugInfoCodeView",
1041         ":MC",
1042         ":Object",
1043         ":Support",
1044         ":TargetParser",
1045     ],
1048 cc_library(
1049     name = "ProfileData",
1050     srcs = glob([
1051         "lib/ProfileData/*.cpp",
1052         "lib/ProfileData/*.h",
1053     ]),
1054     hdrs = glob([
1055         "include/llvm/ProfileData/*.h",
1056         "include/llvm/ProfileData/*.inc",
1057     ]),
1058     copts = llvm_copts,
1059     deps = [
1060         ":Core",
1061         ":DebugInfo",
1062         ":DebugInfoDWARF",
1063         ":Demangle",
1064         ":Object",
1065         ":Support",
1066         ":Symbolize",
1067         ":TargetParser",
1068         ":config",
1069     ],
1072 cc_library(
1073     name = "Coverage",
1074     srcs = glob([
1075         "lib/ProfileData/Coverage/*.cpp",
1076         "lib/ProfileData/Coverage/*.h",
1077     ]),
1078     hdrs = glob(["include/llvm/ProfileData/Coverage/*.h"]),
1079     copts = llvm_copts,
1080     deps = [
1081         ":Object",
1082         ":ProfileData",
1083         ":Support",
1084         ":TargetParser",
1085     ],
1088 cc_library(
1089     name = "Analysis",
1090     srcs = glob(
1091         [
1092             "lib/Analysis/*.cpp",
1093             "lib/Analysis/*.h",
1094             "lib/Analysis/*.def",
1095         ],
1096     ),
1097     hdrs = glob(
1098         [
1099             "include/llvm/Analysis/*.h",
1100             "include/llvm/Analysis/Utils/*.h",
1101         ],
1102     ) + [
1103         "include/llvm-c/Analysis.h",
1104     ],
1105     copts = llvm_copts,
1106     textual_hdrs = glob([
1107         "include/llvm/Analysis/*.def",
1108     ]),
1109     deps = [
1110         ":BinaryFormat",
1111         ":Core",
1112         ":Object",
1113         ":ProfileData",
1114         ":Support",
1115         ":TargetParser",
1116         ":config",
1117     ],
1120 cc_library(
1121     name = "BitWriter",
1122     srcs = glob([
1123         "lib/Bitcode/Writer/*.cpp",
1124         "lib/Bitcode/Writer/*.h",
1125     ]),
1126     hdrs = [
1127         "include/llvm-c/BitWriter.h",
1128         "include/llvm/Bitcode/BitcodeCommon.h",
1129         "include/llvm/Bitcode/BitcodeConvenience.h",
1130         "include/llvm/Bitcode/BitcodeWriter.h",
1131         "include/llvm/Bitcode/BitcodeWriterPass.h",
1132         "include/llvm/Bitcode/LLVMBitCodes.h",
1133     ],
1134     copts = llvm_copts,
1135     deps = [
1136         ":Analysis",
1137         ":BitReader",
1138         ":BitstreamWriter",
1139         ":Core",
1140         ":MC",
1141         ":Object",
1142         ":Support",
1143         ":TargetParser",
1144         ":config",
1145     ],
1148 cc_library(
1149     name = "Target",
1150     srcs = glob([
1151         "lib/Target/*.cpp",
1152         "lib/Target/*.h",
1153     ]),
1154     hdrs = glob([
1155         "include/llvm/Target/*.h",
1156     ]) + [
1157         "include/llvm-c/Target.h",
1158         "include/llvm-c/TargetMachine.h",
1159     ],
1160     copts = llvm_copts,
1161     deps = [
1162         ":Analysis",
1163         ":BinaryFormat",
1164         ":Core",
1165         ":MC",
1166         ":Support",
1167         ":TargetParser",
1168         ":config",
1169     ],
1172 gentbl(
1173     name = "RISCVTargetParserDefGen",
1174     tbl_outs = [("-gen-riscv-target-def", "include/llvm/TargetParser/RISCVTargetParserDef.inc")],
1175     tblgen = ":llvm-min-tblgen",
1176     td_file = "lib/Target/RISCV/RISCV.td",
1177     td_srcs = [
1178         ":common_target_td_sources",
1179     ] + glob([
1180         "lib/Target/RISCV/**/*.td",
1181     ]),
1184 cc_library(
1185     name = "TargetParser",
1186     srcs = glob([
1187         "lib/TargetParser/*.cpp",
1188         "lib/TargetParser/*.h",
1189     ]) + select({
1190         "@platforms//os:windows": glob([
1191             "lib/TargetParser/Windows/*.h",
1192             "lib/TargetParser/Windows/*.inc",
1193         ]),
1194         "//conditions:default": glob([
1195             "lib/TargetParser/Unix/*.h",
1196             "lib/TargetParser/Unix/*.inc",
1197         ]),
1198     }),
1199     hdrs = glob([
1200         "include/llvm/TargetParser/*.h",
1201     ]),
1202     copts = llvm_copts,
1203     includes = ["include"],
1204     textual_hdrs = [
1205         "include/llvm/TargetParser/RISCVTargetParserDef.inc",
1206     ] + glob([
1207         "include/llvm/TargetParser/*.def",
1208     ]),
1209     deps = [
1210         ":Support",
1211         ":config",
1212     ],
1215 cc_library(
1216     name = "DWP",
1217     srcs = glob([
1218         "lib/DWP/*.cpp",
1219         "lib/DWP/*.h",
1220     ]),
1221     hdrs = glob(["include/llvm/DWP/*.h"]),
1222     copts = llvm_copts,
1223     deps = [
1224         ":DebugInfoDWARF",
1225         ":MC",
1226         ":Object",
1227         ":Support",
1228         ":Target",
1229     ],
1232 cc_library(
1233     name = "TransformUtils",
1234     srcs = glob([
1235         "lib/Transforms/Utils/*.cpp",
1236         "lib/Transforms/Utils/*.h",
1237     ]),
1238     hdrs = glob(["include/llvm/Transforms/Utils/*.h"]) + [
1239         "include/llvm/Transforms/Utils.h",
1240     ],
1241     copts = llvm_copts,
1242     deps = [
1243         ":Analysis",
1244         ":BinaryFormat",
1245         ":BitWriter",
1246         ":Core",
1247         ":ProfileData",
1248         ":Support",
1249         ":Target",
1250         ":TargetParser",
1251         ":config",
1252     ],
1255 gentbl(
1256     name = "InstCombineTableGen",
1257     strip_include_prefix = "lib/Target/AMDGPU",
1258     tbl_outs = [(
1259         "-gen-searchable-tables",
1260         "lib/Target/AMDGPU/InstCombineTables.inc",
1261     )],
1262     tblgen = ":llvm-tblgen",
1263     td_file = "lib/Target/AMDGPU/InstCombineTables.td",
1264     td_srcs = glob([
1265         "include/llvm/CodeGen/*.td",
1266         "include/llvm/IR/Intrinsics*.td",
1267     ]) + [
1268         "lib/Target/AMDGPU/InstCombineTables.td",
1269         "include/llvm/TableGen/SearchableTable.td",
1270     ],
1273 cc_library(
1274     name = "InstCombine",
1275     srcs = glob([
1276         "lib/Transforms/InstCombine/*.cpp",
1277         "lib/Transforms/InstCombine/*.h",
1278     ]),
1279     hdrs = glob(["include/llvm/Transforms/InstCombine/*.h"]),
1280     copts = llvm_copts,
1281     deps = [
1282         ":Analysis",
1283         ":Core",
1284         ":Support",
1285         ":Target",
1286         ":TransformUtils",
1287         ":config",
1288     ],
1291 cc_library(
1292     name = "AggressiveInstCombine",
1293     srcs = glob([
1294         "lib/Transforms/AggressiveInstCombine/*.cpp",
1295         "lib/Transforms/AggressiveInstCombine/*.h",
1296     ]),
1297     hdrs = [
1298         "include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h",
1299     ],
1300     copts = llvm_copts,
1301     deps = [
1302         ":Analysis",
1303         ":Core",
1304         ":Support",
1305         ":TransformUtils",
1306     ],
1309 cc_library(
1310     name = "Instrumentation",
1311     srcs = glob([
1312         "lib/Transforms/Instrumentation/*.cpp",
1313         "lib/Transforms/Instrumentation/*.h",
1314         "lib/Transforms/Instrumentation/*.inc",
1315     ]),
1316     hdrs = glob(["include/llvm/Transforms/Instrumentation/*.h"]) + [
1317         "include/llvm/Transforms/Instrumentation.h",
1318     ],
1319     copts = llvm_copts,
1320     deps = [
1321         ":Analysis",
1322         ":BinaryFormat",
1323         ":Core",
1324         ":Demangle",
1325         ":MC",
1326         ":ProfileData",
1327         ":Support",
1328         ":Target",
1329         ":TargetParser",
1330         ":TransformUtils",
1331         ":config",
1332     ],
1335 cc_library(
1336     name = "ObjCARC",
1337     srcs = glob([
1338         "lib/Transforms/ObjCARC/*.cpp",
1339         "lib/Transforms/ObjCARC/*.h",
1340     ]),
1341     hdrs = ["include/llvm/Transforms/ObjCARC.h"],
1342     copts = llvm_copts,
1343     deps = [
1344         ":Analysis",
1345         ":Core",
1346         ":Support",
1347         ":Target",
1348         ":TransformUtils",
1349         ":config",
1350     ],
1353 cc_library(
1354     name = "Scalar",
1355     srcs = glob([
1356         "lib/Transforms/Scalar/*.cpp",
1357         "lib/Transforms/Scalar/*.h",
1358     ]),
1359     hdrs = glob(["include/llvm/Transforms/Scalar/*.h"]) + [
1360         "include/llvm/Transforms/Scalar.h",
1361     ],
1362     copts = llvm_copts,
1363     deps = [
1364         ":AggressiveInstCombine",
1365         ":Analysis",
1366         ":BinaryFormat",
1367         ":Core",
1368         ":InstCombine",
1369         ":ProfileData",
1370         ":Support",
1371         ":Target",
1372         ":TransformUtils",
1373         ":config",
1374     ],
1377 cc_library(
1378     name = "Vectorize",
1379     srcs = glob([
1380         "lib/Transforms/Vectorize/*.cpp",
1381         "lib/Transforms/Vectorize/*.h",
1382     ]),
1383     hdrs = glob([
1384         "include/llvm/Transforms/Vectorize/*.h",
1385     ]) + [
1386         "include/llvm/Transforms/Vectorize.h",
1387     ],
1388     copts = llvm_copts,
1389     deps = [
1390         ":Analysis",
1391         ":Core",
1392         ":Support",
1393         ":Target",
1394         ":TransformUtils",
1395         ":config",
1396     ],
1399 cc_library(
1400     name = "FrontendDebug",
1401     srcs = glob([
1402         "lib/Frontend/Debug/*.cpp",
1403     ]),
1404     hdrs = glob([
1405         "include/llvm/Frontend/Debug/*.h",
1406     ]),
1407     copts = llvm_copts,
1408     deps = [
1409         ":Support",
1410     ],
1413 cc_library(
1414     name = "FrontendHLSL",
1415     srcs = glob([
1416         "lib/Frontend/HLSL/*.cpp",
1417     ]),
1418     hdrs = glob([
1419         "include/llvm/Frontend/HLSL/*.h",
1420     ]),
1421     copts = llvm_copts,
1422     deps = [
1423         ":Core",
1424         ":Support",
1425     ],
1428 cc_library(
1429     name = "FrontendOffloading",
1430     srcs = glob([
1431         "lib/Frontend/Offloading/*.cpp",
1432     ]),
1433     hdrs = glob([
1434         "include/llvm/Frontend/Offloading/*.h",
1435     ]),
1436     copts = llvm_copts,
1437     deps = [
1438         ":Core",
1439         ":Object",
1440         ":Support",
1441         ":TransformUtils",
1442     ],
1445 filegroup(
1446     name = "omp_td_files",
1447     srcs = glob([
1448         "include/llvm/Frontend/OpenMP/*.td",
1449         "include/llvm/Frontend/Directive/*.td",
1450     ]),
1453 gentbl(
1454     name = "omp_gen",
1455     library = False,
1456     tbl_outs = [
1457         ("--gen-directive-decl", "include/llvm/Frontend/OpenMP/OMP.h.inc"),
1458     ],
1459     tblgen = ":llvm-min-tblgen",
1460     td_file = "include/llvm/Frontend/OpenMP/OMP.td",
1461     td_srcs = [":omp_td_files"],
1464 gentbl(
1465     name = "omp_gen_impl",
1466     library = False,
1467     tbl_outs = [
1468         ("--gen-directive-impl", "include/llvm/Frontend/OpenMP/OMP.inc"),
1469     ],
1470     tblgen = ":llvm-min-tblgen",
1471     td_file = "include/llvm/Frontend/OpenMP/OMP.td",
1472     td_srcs = [":omp_td_files"],
1475 cc_library(
1476     name = "FrontendOpenMP",
1477     srcs = glob([
1478         "lib/Frontend/OpenMP/*.cpp",
1479     ]),
1480     hdrs = glob([
1481         "include/llvm/Frontend/OpenMP/*.h",
1482         "include/llvm/Frontend/OpenMP/OMP/*.h",
1483         "include/llvm/Frontend/*.h",
1484     ]) + [
1485         "include/llvm/Frontend/OpenMP/OMP.h.inc",
1486         "include/llvm/Frontend/OpenMP/OMP.inc",
1487     ],
1488     copts = llvm_copts,
1489     textual_hdrs = glob([
1490         "include/llvm/Frontend/OpenMP/*.def",
1491     ]),
1492     deps = [
1493         ":Analysis",
1494         ":BitReader",
1495         ":Core",
1496         ":FrontendOffloading",
1497         ":MC",
1498         ":Scalar",
1499         ":Support",
1500         ":Target",
1501         ":TargetParser",
1502         ":TransformUtils",
1503     ],
1506 filegroup(
1507     name = "acc_td_files",
1508     srcs = glob([
1509         "include/llvm/Frontend/OpenACC/*.td",
1510         "include/llvm/Frontend/Directive/*.td",
1511     ]),
1514 gentbl(
1515     name = "acc_gen",
1516     library = False,
1517     tbl_outs = [
1518         ("--gen-directive-decl", "include/llvm/Frontend/OpenACC/ACC.h.inc"),
1519     ],
1520     tblgen = ":llvm-min-tblgen",
1521     td_file = "include/llvm/Frontend/OpenACC/ACC.td",
1522     td_srcs = [":acc_td_files"],
1525 gentbl(
1526     name = "acc_gen_impl",
1527     library = False,
1528     tbl_outs = [
1529         ("--gen-directive-impl", "include/llvm/Frontend/OpenACC/ACC.inc"),
1530     ],
1531     tblgen = ":llvm-min-tblgen",
1532     td_file = "include/llvm/Frontend/OpenACC/ACC.td",
1533     td_srcs = [":acc_td_files"],
1536 cc_library(
1537     name = "FrontendOpenACC",
1538     srcs = glob([
1539         "lib/Frontend/OpenACC/*.cpp",
1540     ]) + [
1541         "include/llvm/Frontend/OpenACC/ACC.inc",
1542     ],
1543     hdrs = glob([
1544         "include/llvm/Frontend/OpenACC/*.h",
1545     ]) + ["include/llvm/Frontend/OpenACC/ACC.h.inc"],
1546     copts = llvm_copts,
1547     deps = [
1548         ":Analysis",
1549         ":Core",
1550         ":Support",
1551         ":TransformUtils",
1552     ],
1555 cc_library(
1556     name = "AsmParser",
1557     srcs = glob([
1558         "lib/AsmParser/*.cpp",
1559         "lib/AsmParser/*.h",
1560     ]),
1561     hdrs = glob(["include/llvm/AsmParser/*.h"]),
1562     copts = llvm_copts,
1563     deps = [
1564         ":BinaryFormat",
1565         ":Core",
1566         ":Support",
1567         ":attributes_gen",
1568     ],
1571 cc_library(
1572     name = "IRPrinter",
1573     srcs = glob([
1574         "lib/IRPrinter/*.cpp",
1575         "lib/IRPrinter/*.h",
1576     ]),
1577     hdrs = glob([
1578         "include/llvm/IRPrinter/*.h",
1579     ]),
1580     copts = llvm_copts,
1581     deps = [
1582         ":Analysis",
1583         ":Core",
1584         ":Support",
1585     ],
1588 cc_library(
1589     name = "IRReader",
1590     srcs = glob([
1591         "lib/IRReader/*.cpp",
1592         "lib/IRReader/*.h",
1593     ]),
1594     hdrs = glob([
1595         "include/llvm/IRReader/*.h",
1596     ]) + [
1597         "include/llvm-c/IRReader.h",
1598     ],
1599     copts = llvm_copts,
1600     deps = [
1601         ":AsmParser",
1602         ":BitReader",
1603         ":Core",
1604         ":Support",
1605         ":config",
1606     ],
1609 cc_library(
1610     name = "Linker",
1611     srcs = glob([
1612         "lib/Linker/*.cpp",
1613         "lib/Linker/*.h",
1614     ]),
1615     hdrs = glob([
1616         "include/llvm/Linker/*.h",
1617     ]) + [
1618         "include/llvm-c/Linker.h",
1619     ],
1620     copts = llvm_copts,
1621     deps = [
1622         ":Core",
1623         ":Object",
1624         ":Support",
1625         ":TargetParser",
1626         ":TransformUtils",
1627         ":config",
1628     ],
1631 cc_library(
1632     name = "IPO",
1633     srcs = glob([
1634         "lib/Transforms/IPO/*.cpp",
1635         "lib/Transforms/IPO/*.h",
1636     ]),
1637     hdrs = glob([
1638         "include/llvm/Transforms/IPO/*.h",
1639     ]) + [
1640         "include/llvm/Transforms/IPO.h",
1641     ],
1642     copts = llvm_copts,
1643     deps = [
1644         ":AggressiveInstCombine",
1645         ":Analysis",
1646         ":BinaryFormat",
1647         ":BitReader",
1648         ":BitWriter",
1649         ":Core",
1650         ":FrontendOpenMP",
1651         ":IRPrinter",
1652         ":IRReader",
1653         ":InstCombine",
1654         ":Instrumentation",
1655         ":Linker",
1656         ":ObjCARC",
1657         ":Object",
1658         ":ProfileData",
1659         ":Scalar",
1660         ":Support",
1661         ":Target",
1662         ":TargetParser",
1663         ":TransformUtils",
1664         ":Vectorize",
1665         ":config",
1666     ],
1669 cc_library(
1670     name = "CFGuard",
1671     srcs = glob([
1672         "lib/Transforms/CFGuard/*.cpp",
1673         "lib/Transforms/CFGuard/*.h",
1674     ]),
1675     hdrs = ["include/llvm/Transforms/CFGuard.h"],
1676     copts = llvm_copts,
1677     deps = [
1678         ":Core",
1679         ":Support",
1680         ":TargetParser",
1681     ],
1684 cc_library(
1685     name = "HipStdPar",
1686     srcs = glob([
1687         "lib/Transforms/HipStdPar/*.cpp",
1688         "lib/Transforms/HipStdPar/*.h",
1689     ]),
1690     hdrs = ["include/llvm/Transforms/HipStdPar/HipStdPar.h"],
1691     copts = llvm_copts,
1692     deps = [
1693         ":Analysis",
1694         ":Core",
1695         ":Support",
1696         ":TargetParser",
1697         ":TransformUtils",
1698     ],
1701 cc_library(
1702     name = "Coroutines",
1703     srcs = glob([
1704         "lib/Transforms/Coroutines/*.cpp",
1705         "lib/Transforms/Coroutines/*.h",
1706     ]),
1707     hdrs = glob(["include/llvm/Transforms/Coroutines/*.h"]),
1708     copts = llvm_copts,
1709     deps = [
1710         ":Analysis",
1711         ":BinaryFormat",
1712         ":Core",
1713         ":IPO",
1714         ":Scalar",
1715         ":Support",
1716         ":TransformUtils",
1717         ":config",
1718     ],
1721 # Meta-target for clients which depend on all of the transforms libraries.
1722 cc_library(
1723     name = "common_transforms",
1724     deps = [
1725         ":AggressiveInstCombine",
1726         ":CFGuard",
1727         ":Coroutines",
1728         ":IPO",
1729         ":InstCombine",
1730         ":Instrumentation",
1731         ":ObjCARC",
1732         ":Scalar",
1733         ":Vectorize",
1734     ],
1737 cc_library(
1738     name = "asm_printer_defs",
1739     copts = llvm_copts,
1740     textual_hdrs = glob(["lib/CodeGen/AsmPrinter/*.def"]),
1743 cc_library(
1744     name = "CodeGenTypes",
1745     srcs = [
1746         "lib/CodeGen/LowLevelType.cpp",
1747     ],
1748     hdrs = [
1749         "include/llvm/CodeGen/LowLevelType.h",
1750         "include/llvm/CodeGen/MachineValueType.h",
1751     ],
1752     copts = llvm_copts,
1753     deps = [
1754         ":Support",
1755         ":vt_gen",
1756     ],
1759 cc_library(
1760     name = "CodeGen",
1761     srcs = glob(
1762         [
1763             "lib/CodeGen/**/*.cpp",
1764             "lib/CodeGen/**/*.h",
1765             "lib/CodeGen/SelectionDAG/*.cpp",
1766             "lib/CodeGen/SelectionDAG/*.h",
1767         ],
1768         exclude = [
1769             "lib/CodeGen/LowLevelType.cpp",
1770         ],
1771     ),
1772     hdrs = [
1773         "include/llvm/LinkAllPasses.h",
1774     ] + glob(
1775         [
1776             "include/llvm/CodeGen/**/*.h",
1777         ],
1778     ),
1779     copts = llvm_copts,
1780     textual_hdrs = glob([
1781         "include/llvm/CodeGen/**/*.def",
1782         "include/llvm/CodeGen/**/*.inc",
1783     ]),
1784     deps = [
1785         ":AggressiveInstCombine",
1786         ":Analysis",
1787         ":AsmParser",
1788         ":BinaryFormat",
1789         ":BitReader",
1790         ":BitWriter",
1791         ":CodeGenTypes",
1792         ":Core",
1793         ":DebugInfoCodeView",
1794         ":DebugInfoDWARF",
1795         ":IPO",
1796         ":IRPrinter",
1797         ":Instrumentation",
1798         ":MC",
1799         ":MCParser",
1800         ":Object",
1801         ":ProfileData",
1802         ":Remarks",
1803         ":Scalar",
1804         ":Support",
1805         ":Target",
1806         ":TargetParser",
1807         ":TransformUtils",
1808         ":asm_printer_defs",
1809         ":config",
1810         ":vt_gen",
1811     ],
1814 cc_library(
1815     name = "MCDisassembler",
1816     srcs = glob([
1817         "lib/MC/MCDisassembler/*.cpp",
1818         "lib/MC/MCDisassembler/*.h",
1819     ]),
1820     hdrs = glob([
1821         "include/llvm/MC/MCDisassembler/*.h",
1822     ]) + [
1823         "include/llvm-c/Disassembler.h",
1824     ],
1825     copts = llvm_copts,
1826     deps = [
1827         ":BinaryFormat",
1828         ":MC",
1829         ":Support",
1830         ":TargetParser",
1831         ":config",
1832     ],
1835 llvm_target_lib_list = [lib for lib in [
1836     {
1837         "name": "AArch64",
1838         "short_name": "AArch64",
1839         "tbl_outs": [
1840             ("-gen-register-bank", "lib/Target/AArch64/AArch64GenRegisterBank.inc"),
1841             ("-gen-register-info", "lib/Target/AArch64/AArch64GenRegisterInfo.inc"),
1842             ("-gen-instr-info", "lib/Target/AArch64/AArch64GenInstrInfo.inc"),
1843             ("-gen-emitter", "lib/Target/AArch64/AArch64GenMCCodeEmitter.inc"),
1844             ("-gen-pseudo-lowering", "lib/Target/AArch64/AArch64GenMCPseudoLowering.inc"),
1845             ("-gen-asm-writer", "lib/Target/AArch64/AArch64GenAsmWriter.inc"),
1846             ("-gen-asm-writer -asmwriternum=1", "lib/Target/AArch64/AArch64GenAsmWriter1.inc"),
1847             ("-gen-asm-matcher", "lib/Target/AArch64/AArch64GenAsmMatcher.inc"),
1848             ("-gen-dag-isel", "lib/Target/AArch64/AArch64GenDAGISel.inc"),
1849             ("-gen-fast-isel", "lib/Target/AArch64/AArch64GenFastISel.inc"),
1850             ("-gen-global-isel", "lib/Target/AArch64/AArch64GenGlobalISel.inc"),
1851             ("-gen-global-isel-combiner -combiners=AArch64O0PreLegalizerCombiner", "lib/Target/AArch64/AArch64GenO0PreLegalizeGICombiner.inc"),
1852             ("-gen-global-isel-combiner -combiners=AArch64PreLegalizerCombiner", "lib/Target/AArch64/AArch64GenPreLegalizeGICombiner.inc"),
1853             ("-gen-global-isel-combiner -combiners=AArch64PostLegalizerCombiner", "lib/Target/AArch64/AArch64GenPostLegalizeGICombiner.inc"),
1854             ("-gen-global-isel-combiner -combiners=AArch64PostLegalizerLowering", "lib/Target/AArch64/AArch64GenPostLegalizeGILowering.inc"),
1855             ("-gen-callingconv", "lib/Target/AArch64/AArch64GenCallingConv.inc"),
1856             ("-gen-subtarget", "lib/Target/AArch64/AArch64GenSubtargetInfo.inc"),
1857             ("-gen-disassembler", "lib/Target/AArch64/AArch64GenDisassemblerTables.inc"),
1858             ("-gen-searchable-tables", "lib/Target/AArch64/AArch64GenSystemOperands.inc"),
1859             ("-gen-exegesis", "lib/Target/AArch64/AArch64GenExegesis.inc"),
1860         ],
1861     },
1862     {
1863         "name": "ARM",
1864         "short_name": "ARM",
1865         "tbl_outs": [
1866             ("-gen-register-bank", "lib/Target/ARM/ARMGenRegisterBank.inc"),
1867             ("-gen-register-info", "lib/Target/ARM/ARMGenRegisterInfo.inc"),
1868             ("-gen-searchable-tables", "lib/Target/ARM/ARMGenSystemRegister.inc"),
1869             ("-gen-instr-info", "lib/Target/ARM/ARMGenInstrInfo.inc"),
1870             ("-gen-emitter", "lib/Target/ARM/ARMGenMCCodeEmitter.inc"),
1871             ("-gen-pseudo-lowering", "lib/Target/ARM/ARMGenMCPseudoLowering.inc"),
1872             ("-gen-asm-writer", "lib/Target/ARM/ARMGenAsmWriter.inc"),
1873             ("-gen-asm-matcher", "lib/Target/ARM/ARMGenAsmMatcher.inc"),
1874             ("-gen-dag-isel", "lib/Target/ARM/ARMGenDAGISel.inc"),
1875             ("-gen-fast-isel", "lib/Target/ARM/ARMGenFastISel.inc"),
1876             ("-gen-global-isel", "lib/Target/ARM/ARMGenGlobalISel.inc"),
1877             ("-gen-callingconv", "lib/Target/ARM/ARMGenCallingConv.inc"),
1878             ("-gen-subtarget", "lib/Target/ARM/ARMGenSubtargetInfo.inc"),
1879             ("-gen-disassembler", "lib/Target/ARM/ARMGenDisassemblerTables.inc"),
1880         ],
1881     },
1882     {
1883         "name": "AMDGPU",
1884         "short_name": "AMDGPU",
1885         "tbl_outs": [
1886             ("-gen-register-bank", "lib/Target/AMDGPU/AMDGPUGenRegisterBank.inc"),
1887             ("-gen-register-info", "lib/Target/AMDGPU/AMDGPUGenRegisterInfo.inc"),
1888             ("-gen-instr-info", "lib/Target/AMDGPU/AMDGPUGenInstrInfo.inc"),
1889             ("-gen-emitter", "lib/Target/AMDGPU/AMDGPUGenMCCodeEmitter.inc"),
1890             ("-gen-pseudo-lowering", "lib/Target/AMDGPU/AMDGPUGenMCPseudoLowering.inc"),
1891             ("-gen-asm-writer", "lib/Target/AMDGPU/AMDGPUGenAsmWriter.inc"),
1892             ("-gen-asm-matcher", "lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc"),
1893             ("-gen-dag-isel", "lib/Target/AMDGPU/AMDGPUGenDAGISel.inc"),
1894             ("-gen-callingconv", "lib/Target/AMDGPU/AMDGPUGenCallingConv.inc"),
1895             ("-gen-subtarget", "lib/Target/AMDGPU/AMDGPUGenSubtargetInfo.inc"),
1896             ("-gen-disassembler", "lib/Target/AMDGPU/AMDGPUGenDisassemblerTables.inc"),
1897             ("-gen-searchable-tables", "lib/Target/AMDGPU/AMDGPUGenSearchableTables.inc"),
1898         ],
1899         "tbl_deps": [
1900             ":InstCombineTableGen",
1901             ":amdgpu_isel_target_gen",
1902             ":r600_target_gen",
1903         ],
1904     },
1905     {
1906         "name": "AVR",
1907         "short_name": "AVR",
1908         "tbl_outs": [
1909             ("-gen-asm-matcher", "lib/Target/AVR/AVRGenAsmMatcher.inc"),
1910             ("-gen-asm-writer", "lib/Target/AVR/AVRGenAsmWriter.inc"),
1911             ("-gen-callingconv", "lib/Target/AVR/AVRGenCallingConv.inc"),
1912             ("-gen-dag-isel", "lib/Target/AVR/AVRGenDAGISel.inc"),
1913             ("-gen-disassembler", "lib/Target/AVR/AVRGenDisassemblerTables.inc"),
1914             ("-gen-emitter", "lib/Target/AVR/AVRGenMCCodeEmitter.inc"),
1915             ("-gen-instr-info", "lib/Target/AVR/AVRGenInstrInfo.inc"),
1916             ("-gen-register-info", "lib/Target/AVR/AVRGenRegisterInfo.inc"),
1917             ("-gen-subtarget", "lib/Target/AVR/AVRGenSubtargetInfo.inc"),
1918         ],
1919     },
1920     {
1921         "name": "BPF",
1922         "short_name": "BPF",
1923         "tbl_outs": [
1924             ("-gen-asm-writer", "lib/Target/BPF/BPFGenAsmWriter.inc"),
1925             ("-gen-asm-matcher", "lib/Target/BPF/BPFGenAsmMatcher.inc"),
1926             ("-gen-callingconv", "lib/Target/BPF/BPFGenCallingConv.inc"),
1927             ("-gen-dag-isel", "lib/Target/BPF/BPFGenDAGISel.inc"),
1928             ("-gen-disassembler", "lib/Target/BPF/BPFGenDisassemblerTables.inc"),
1929             ("-gen-emitter", "lib/Target/BPF/BPFGenMCCodeEmitter.inc"),
1930             ("-gen-instr-info", "lib/Target/BPF/BPFGenInstrInfo.inc"),
1931             ("-gen-register-info", "lib/Target/BPF/BPFGenRegisterInfo.inc"),
1932             ("-gen-subtarget", "lib/Target/BPF/BPFGenSubtargetInfo.inc"),
1933         ],
1934     },
1935     {
1936         "name": "Hexagon",
1937         "short_name": "Hexagon",
1938         "tbl_outs": [
1939             ("-gen-asm-matcher", "lib/Target/Hexagon/HexagonGenAsmMatcher.inc"),
1940             ("-gen-asm-writer", "lib/Target/Hexagon/HexagonGenAsmWriter.inc"),
1941             ("-gen-callingconv", "lib/Target/Hexagon/HexagonGenCallingConv.inc"),
1942             ("-gen-dag-isel", "lib/Target/Hexagon/HexagonGenDAGISel.inc"),
1943             ("-gen-dfa-packetizer", "lib/Target/Hexagon/HexagonGenDFAPacketizer.inc"),
1944             ("-gen-disassembler", "lib/Target/Hexagon/HexagonGenDisassemblerTables.inc"),
1945             ("-gen-instr-info", "lib/Target/Hexagon/HexagonGenInstrInfo.inc"),
1946             ("-gen-emitter", "lib/Target/Hexagon/HexagonGenMCCodeEmitter.inc"),
1947             ("-gen-register-info", "lib/Target/Hexagon/HexagonGenRegisterInfo.inc"),
1948             ("-gen-subtarget", "lib/Target/Hexagon/HexagonGenSubtargetInfo.inc"),
1949         ],
1950     },
1951     {
1952         "name": "Lanai",
1953         "short_name": "Lanai",
1954         "tbl_outs": [
1955             ("-gen-asm-matcher", "lib/Target/Lanai/LanaiGenAsmMatcher.inc"),
1956             ("-gen-asm-writer", "lib/Target/Lanai/LanaiGenAsmWriter.inc"),
1957             ("-gen-callingconv", "lib/Target/Lanai/LanaiGenCallingConv.inc"),
1958             ("-gen-dag-isel", "lib/Target/Lanai/LanaiGenDAGISel.inc"),
1959             ("-gen-disassembler", "lib/Target/Lanai/LanaiGenDisassemblerTables.inc"),
1960             ("-gen-emitter", "lib/Target/Lanai/LanaiGenMCCodeEmitter.inc"),
1961             ("-gen-instr-info", "lib/Target/Lanai/LanaiGenInstrInfo.inc"),
1962             ("-gen-register-info", "lib/Target/Lanai/LanaiGenRegisterInfo.inc"),
1963             ("-gen-subtarget", "lib/Target/Lanai/LanaiGenSubtargetInfo.inc"),
1964         ],
1965     },
1966     {
1967         "name": "LoongArch",
1968         "short_name": "LoongArch",
1969         "tbl_outs": [
1970             ("-gen-asm-matcher", "lib/Target/LoongArch/LoongArchGenAsmMatcher.inc"),
1971             ("-gen-asm-writer", "lib/Target/LoongArch/LoongArchGenAsmWriter.inc"),
1972             ("-gen-dag-isel", "lib/Target/LoongArch/LoongArchGenDAGISel.inc"),
1973             ("-gen-disassembler", "lib/Target/LoongArch/LoongArchGenDisassemblerTables.inc"),
1974             ("-gen-emitter", "lib/Target/LoongArch/LoongArchGenMCCodeEmitter.inc"),
1975             ("-gen-instr-info", "lib/Target/LoongArch/LoongArchGenInstrInfo.inc"),
1976             ("-gen-pseudo-lowering", "lib/Target/LoongArch/LoongArchGenMCPseudoLowering.inc"),
1977             ("-gen-register-info", "lib/Target/LoongArch/LoongArchGenRegisterInfo.inc"),
1978             ("-gen-subtarget", "lib/Target/LoongArch/LoongArchGenSubtargetInfo.inc"),
1979         ],
1980     },
1981     {
1982         "name": "Mips",
1983         "short_name": "Mips",
1984         "tbl_outs": [
1985             ("-gen-asm-matcher", "lib/Target/Mips/MipsGenAsmMatcher.inc"),
1986             ("-gen-asm-writer", "lib/Target/Mips/MipsGenAsmWriter.inc"),
1987             ("-gen-callingconv", "lib/Target/Mips/MipsGenCallingConv.inc"),
1988             ("-gen-dag-isel", "lib/Target/Mips/MipsGenDAGISel.inc"),
1989             ("-gen-disassembler", "lib/Target/Mips/MipsGenDisassemblerTables.inc"),
1990             ("-gen-emitter", "lib/Target/Mips/MipsGenMCCodeEmitter.inc"),
1991             ("-gen-exegesis", "lib/Target/Mips/MipsGenExegesis.inc"),
1992             ("-gen-fast-isel", "lib/Target/Mips/MipsGenFastISel.inc"),
1993             ("-gen-global-isel", "lib/Target/Mips/MipsGenGlobalISel.inc"),
1994             ("-gen-global-isel-combiner -combiners=MipsPostLegalizerCombiner", "lib/Target/Mips/MipsGenPostLegalizeGICombiner.inc"),
1995             ("-gen-instr-info", "lib/Target/Mips/MipsGenInstrInfo.inc"),
1996             ("-gen-pseudo-lowering", "lib/Target/Mips/MipsGenMCPseudoLowering.inc"),
1997             ("-gen-register-bank", "lib/Target/Mips/MipsGenRegisterBank.inc"),
1998             ("-gen-register-info", "lib/Target/Mips/MipsGenRegisterInfo.inc"),
1999             ("-gen-subtarget", "lib/Target/Mips/MipsGenSubtargetInfo.inc"),
2000         ],
2001     },
2002     {
2003         "name": "MSP430",
2004         "short_name": "MSP430",
2005         "tbl_outs": [
2006             ("-gen-asm-matcher", "lib/Target/MSP430/MSP430GenAsmMatcher.inc"),
2007             ("-gen-asm-writer", "lib/Target/MSP430/MSP430GenAsmWriter.inc"),
2008             ("-gen-callingconv", "lib/Target/MSP430/MSP430GenCallingConv.inc"),
2009             ("-gen-dag-isel", "lib/Target/MSP430/MSP430GenDAGISel.inc"),
2010             ("-gen-disassembler", "lib/Target/MSP430/MSP430GenDisassemblerTables.inc"),
2011             ("-gen-emitter", "lib/Target/MSP430/MSP430GenMCCodeEmitter.inc"),
2012             ("-gen-instr-info", "lib/Target/MSP430/MSP430GenInstrInfo.inc"),
2013             ("-gen-register-info", "lib/Target/MSP430/MSP430GenRegisterInfo.inc"),
2014             ("-gen-subtarget", "lib/Target/MSP430/MSP430GenSubtargetInfo.inc"),
2015         ],
2016     },
2017     {
2018         "name": "NVPTX",
2019         "short_name": "NVPTX",
2020         "tbl_outs": [
2021             ("-gen-register-info", "lib/Target/NVPTX/NVPTXGenRegisterInfo.inc"),
2022             ("-gen-instr-info", "lib/Target/NVPTX/NVPTXGenInstrInfo.inc"),
2023             ("-gen-asm-writer", "lib/Target/NVPTX/NVPTXGenAsmWriter.inc"),
2024             ("-gen-dag-isel", "lib/Target/NVPTX/NVPTXGenDAGISel.inc"),
2025             ("-gen-subtarget", "lib/Target/NVPTX/NVPTXGenSubtargetInfo.inc"),
2026         ],
2027     },
2028     {
2029         "name": "PowerPC",
2030         "short_name": "PPC",
2031         "tbl_outs": [
2032             ("-gen-asm-writer", "lib/Target/PowerPC/PPCGenAsmWriter.inc"),
2033             ("-gen-asm-matcher", "lib/Target/PowerPC/PPCGenAsmMatcher.inc"),
2034             ("-gen-emitter", "lib/Target/PowerPC/PPCGenMCCodeEmitter.inc"),
2035             ("-gen-register-info", "lib/Target/PowerPC/PPCGenRegisterInfo.inc"),
2036             ("-gen-instr-info", "lib/Target/PowerPC/PPCGenInstrInfo.inc"),
2037             ("-gen-dag-isel", "lib/Target/PowerPC/PPCGenDAGISel.inc"),
2038             ("-gen-fast-isel", "lib/Target/PowerPC/PPCGenFastISel.inc"),
2039             ("-gen-callingconv", "lib/Target/PowerPC/PPCGenCallingConv.inc"),
2040             ("-gen-subtarget", "lib/Target/PowerPC/PPCGenSubtargetInfo.inc"),
2041             ("-gen-disassembler", "lib/Target/PowerPC/PPCGenDisassemblerTables.inc"),
2042             ("-gen-register-bank", "lib/Target/PowerPC/PPCGenRegisterBank.inc"),
2043             ("-gen-global-isel", "lib/Target/PowerPC/PPCGenGlobalISel.inc"),
2044             ("-gen-exegesis", "lib/Target/PowerPC/PPCGenExegesis.inc"),
2045         ],
2046     },
2047     {
2048         "name": "Sparc",
2049         "short_name": "Sparc",
2050         "tbl_outs": [
2051             ("-gen-asm-writer", "lib/Target/Sparc/SparcGenAsmWriter.inc"),
2052             ("-gen-asm-matcher", "lib/Target/Sparc/SparcGenAsmMatcher.inc"),
2053             ("-gen-emitter", "lib/Target/Sparc/SparcGenMCCodeEmitter.inc"),
2054             ("-gen-register-info", "lib/Target/Sparc/SparcGenRegisterInfo.inc"),
2055             ("-gen-instr-info", "lib/Target/Sparc/SparcGenInstrInfo.inc"),
2056             ("-gen-dag-isel", "lib/Target/Sparc/SparcGenDAGISel.inc"),
2057             ("-gen-callingconv", "lib/Target/Sparc/SparcGenCallingConv.inc"),
2058             ("-gen-subtarget", "lib/Target/Sparc/SparcGenSubtargetInfo.inc"),
2059             ("-gen-disassembler", "lib/Target/Sparc/SparcGenDisassemblerTables.inc"),
2060             ("-gen-searchable-tables", "lib/Target/Sparc/SparcGenSearchableTables.inc"),
2061         ],
2062     },
2063     {
2064         "name": "SystemZ",
2065         "short_name": "SystemZ",
2066         "tbl_outs": [
2067             ("-gen-asm-matcher", "lib/Target/SystemZ/SystemZGenAsmMatcher.inc"),
2068             ("-gen-asm-writer", "lib/Target/SystemZ/SystemZGenAsmWriter.inc"),
2069             ("-gen-callingconv", "lib/Target/SystemZ/SystemZGenCallingConv.inc"),
2070             ("-gen-dag-isel", "lib/Target/SystemZ/SystemZGenDAGISel.inc"),
2071             ("-gen-disassembler", "lib/Target/SystemZ/SystemZGenDisassemblerTables.inc"),
2072             ("-gen-emitter", "lib/Target/SystemZ/SystemZGenMCCodeEmitter.inc"),
2073             ("-gen-instr-info", "lib/Target/SystemZ/SystemZGenInstrInfo.inc"),
2074             ("-gen-register-info", "lib/Target/SystemZ/SystemZGenRegisterInfo.inc"),
2075             ("-gen-subtarget", "lib/Target/SystemZ/SystemZGenSubtargetInfo.inc"),
2076         ],
2077     },
2078     {
2079         "name": "RISCV",
2080         "short_name": "RISCV",
2081         "tbl_outs": [
2082             ("-gen-asm-matcher", "lib/Target/RISCV/RISCVGenAsmMatcher.inc"),
2083             ("-gen-asm-writer", "lib/Target/RISCV/RISCVGenAsmWriter.inc"),
2084             ("-gen-compress-inst-emitter", "lib/Target/RISCV/RISCVGenCompressInstEmitter.inc"),
2085             ("-gen-dag-isel", "lib/Target/RISCV/RISCVGenDAGISel.inc"),
2086             ("-gen-disassembler", "lib/Target/RISCV/RISCVGenDisassemblerTables.inc"),
2087             ("-gen-instr-info", "lib/Target/RISCV/RISCVGenInstrInfo.inc"),
2088             ("-gen-emitter", "lib/Target/RISCV/RISCVGenMCCodeEmitter.inc"),
2089             ("-gen-pseudo-lowering", "lib/Target/RISCV/RISCVGenMCPseudoLowering.inc"),
2090             ("-gen-register-bank", "lib/Target/RISCV/RISCVGenRegisterBank.inc"),
2091             ("-gen-register-info", "lib/Target/RISCV/RISCVGenRegisterInfo.inc"),
2092             ("-gen-subtarget", "lib/Target/RISCV/RISCVGenSubtargetInfo.inc"),
2093             ("-gen-searchable-tables", "lib/Target/RISCV/RISCVGenSearchableTables.inc"),
2094         ],
2095         "tbl_deps": [
2096             ":riscv_isel_target_gen",
2097         ],
2098     },
2099     {
2100         "name": "VE",
2101         "short_name": "VE",
2102         "tbl_outs": [
2103             ("-gen-asm-matcher", "lib/Target/VE/VEGenAsmMatcher.inc"),
2104             ("-gen-asm-writer", "lib/Target/VE/VEGenAsmWriter.inc"),
2105             ("-gen-callingconv", "lib/Target/VE/VEGenCallingConv.inc"),
2106             ("-gen-dag-isel", "lib/Target/VE/VEGenDAGISel.inc"),
2107             ("-gen-disassembler", "lib/Target/VE/VEGenDisassemblerTables.inc"),
2108             ("-gen-emitter", "lib/Target/VE/VEGenMCCodeEmitter.inc"),
2109             ("-gen-instr-info", "lib/Target/VE/VEGenInstrInfo.inc"),
2110             ("-gen-register-info", "lib/Target/VE/VEGenRegisterInfo.inc"),
2111             ("-gen-subtarget", "lib/Target/VE/VEGenSubtargetInfo.inc"),
2112         ],
2113     },
2114     {
2115         "name": "WebAssembly",
2116         "short_name": "WebAssembly",
2117         "tbl_outs": [
2118             ("-gen-disassembler", "lib/Target/WebAssembly/WebAssemblyGenDisassemblerTables.inc"),
2119             ("-gen-asm-writer", "lib/Target/WebAssembly/WebAssemblyGenAsmWriter.inc"),
2120             ("-gen-instr-info", "lib/Target/WebAssembly/WebAssemblyGenInstrInfo.inc"),
2121             ("-gen-dag-isel", "lib/Target/WebAssembly/WebAssemblyGenDAGISel.inc"),
2122             ("-gen-fast-isel", "lib/Target/WebAssembly/WebAssemblyGenFastISel.inc"),
2123             ("-gen-emitter", "lib/Target/WebAssembly/WebAssemblyGenMCCodeEmitter.inc"),
2124             ("-gen-register-info", "lib/Target/WebAssembly/WebAssemblyGenRegisterInfo.inc"),
2125             ("-gen-subtarget", "lib/Target/WebAssembly/WebAssemblyGenSubtargetInfo.inc"),
2126             ("-gen-asm-matcher", "lib/Target/WebAssembly/WebAssemblyGenAsmMatcher.inc"),
2127         ],
2128     },
2129     {
2130         "name": "X86",
2131         "short_name": "X86",
2132         "tbl_outs": [
2133             ("-gen-register-bank", "lib/Target/X86/X86GenRegisterBank.inc"),
2134             ("-gen-register-info", "lib/Target/X86/X86GenRegisterInfo.inc"),
2135             ("-gen-disassembler", "lib/Target/X86/X86GenDisassemblerTables.inc"),
2136             ("-gen-instr-info", "lib/Target/X86/X86GenInstrInfo.inc"),
2137             ("-gen-asm-writer", "lib/Target/X86/X86GenAsmWriter.inc"),
2138             ("-gen-asm-writer -asmwriternum=1", "lib/Target/X86/X86GenAsmWriter1.inc"),
2139             ("-gen-asm-matcher", "lib/Target/X86/X86GenAsmMatcher.inc"),
2140             ("-gen-dag-isel", "lib/Target/X86/X86GenDAGISel.inc"),
2141             ("-gen-fast-isel", "lib/Target/X86/X86GenFastISel.inc"),
2142             ("-gen-global-isel", "lib/Target/X86/X86GenGlobalISel.inc"),
2143             ("-gen-callingconv", "lib/Target/X86/X86GenCallingConv.inc"),
2144             ("-gen-subtarget", "lib/Target/X86/X86GenSubtargetInfo.inc"),
2145             ("-gen-x86-fold-tables -asmwriternum=1", "lib/Target/X86/X86GenFoldTables.inc"),
2146             ("-gen-x86-EVEX2VEX-tables", "lib/Target/X86/X86GenEVEX2VEXTables.inc"),
2147             ("-gen-exegesis", "lib/Target/X86/X86GenExegesis.inc"),
2148             ("-gen-x86-mnemonic-tables -asmwriternum=1", "lib/Target/X86/X86GenMnemonicTables.inc"),
2149         ],
2150     },
2151     {
2152         "name": "XCore",
2153         "short_name": "XCore",
2154         "tbl_outs": [
2155             ("-gen-asm-writer", "lib/Target/XCore/XCoreGenAsmWriter.inc"),
2156             ("-gen-callingconv", "lib/Target/XCore/XCoreGenCallingConv.inc"),
2157             ("-gen-dag-isel", "lib/Target/XCore/XCoreGenDAGISel.inc"),
2158             ("-gen-disassembler", "lib/Target/XCore/XCoreGenDisassemblerTables.inc"),
2159             ("-gen-instr-info", "lib/Target/XCore/XCoreGenInstrInfo.inc"),
2160             ("-gen-register-info", "lib/Target/XCore/XCoreGenRegisterInfo.inc"),
2161             ("-gen-subtarget", "lib/Target/XCore/XCoreGenSubtargetInfo.inc"),
2162         ],
2163     },
2164 ] if lib["name"] in llvm_targets]
2166 cc_library(
2167     name = "x86_target_layering_problem_hdrs",
2168     textual_hdrs = ["lib/Target/X86/X86InstrInfo.h"],
2171 filegroup(
2172     name = "common_target_td_sources",
2173     srcs = glob([
2174         "include/llvm/CodeGen/*.td",
2175         "include/llvm/Frontend/Directive/*.td",
2176         "include/llvm/IR/Intrinsics*.td",
2177         "include/llvm/TableGen/*.td",
2178         "include/llvm/Target/*.td",
2179         "include/llvm/Target/GlobalISel/*.td",
2180     ]),
2183 gentbl(
2184     name = "amdgpu_isel_target_gen",
2185     strip_include_prefix = "lib/Target/AMDGPU",
2186     tbl_outs = [
2187         ("-gen-global-isel", "lib/Target/AMDGPU/AMDGPUGenGlobalISel.inc"),
2188         ("-gen-global-isel-combiner -combiners=AMDGPUPreLegalizerCombiner", "lib/Target/AMDGPU/AMDGPUGenPreLegalizeGICombiner.inc"),
2189         ("-gen-global-isel-combiner -combiners=AMDGPUPostLegalizerCombiner", "lib/Target/AMDGPU/AMDGPUGenPostLegalizeGICombiner.inc"),
2190         ("-gen-global-isel-combiner -combiners=AMDGPURegBankCombiner", "lib/Target/AMDGPU/AMDGPUGenRegBankGICombiner.inc"),
2191     ],
2192     tblgen = ":llvm-tblgen",
2193     td_file = "lib/Target/AMDGPU/AMDGPUGISel.td",
2194     td_srcs = [
2195         ":common_target_td_sources",
2196     ] + glob([
2197         "lib/Target/AMDGPU/*.td",
2198     ]),
2201 gentbl(
2202     name = "r600_target_gen",
2203     strip_include_prefix = "lib/Target/AMDGPU",
2204     tbl_outs = [
2205         ("-gen-asm-writer", "lib/Target/AMDGPU/R600GenAsmWriter.inc"),
2206         ("-gen-callingconv", "lib/Target/AMDGPU/R600GenCallingConv.inc"),
2207         ("-gen-dag-isel", "lib/Target/AMDGPU/R600GenDAGISel.inc"),
2208         ("-gen-dfa-packetizer", "lib/Target/AMDGPU/R600GenDFAPacketizer.inc"),
2209         ("-gen-instr-info", "lib/Target/AMDGPU/R600GenInstrInfo.inc"),
2210         ("-gen-emitter", "lib/Target/AMDGPU/R600GenMCCodeEmitter.inc"),
2211         ("-gen-register-info", "lib/Target/AMDGPU/R600GenRegisterInfo.inc"),
2212         ("-gen-subtarget", "lib/Target/AMDGPU/R600GenSubtargetInfo.inc"),
2213     ],
2214     tblgen = ":llvm-tblgen",
2215     td_file = "lib/Target/AMDGPU/R600.td",
2216     td_srcs = [
2217         ":common_target_td_sources",
2218     ] + glob([
2219         "lib/Target/AMDGPU/*.td",
2220     ]),
2223 gentbl(
2224     name = "riscv_isel_target_gen",
2225     strip_include_prefix = "lib/Target/RISCV",
2226     tbl_outs = [
2227       ("-gen-global-isel", "lib/Target/RISCV/RISCVGenGlobalISel.inc"),
2228       ("-gen-global-isel-combiner -combiners=RISCVO0PreLegalizerCombiner", "lib/Target/RISCV/RISCVGenO0PreLegalizeGICombiner.inc"),
2229       ("-gen-global-isel-combiner -combiners=RISCVPostLegalizerCombiner", "lib/Target/RISCV/RISCVGenPostLegalizeGICombiner.inc"),
2230       ("-gen-global-isel-combiner -combiners=RISCVPreLegalizerCombiner", "lib/Target/RISCV/RISCVGenPreLegalizeGICombiner.inc"),
2231     ],
2232     tblgen = ":llvm-tblgen",
2233     td_file = "lib/Target/RISCV/RISCVGISel.td",
2234     td_srcs = [
2235         ":common_target_td_sources",
2236     ] + glob([
2237         "lib/Target/RISCV/**/*.td",
2238     ]),
2242     [gentbl(
2243         name = target["name"] + "CommonTableGen",
2244         strip_include_prefix = "lib/Target/" + target["name"],
2245         tbl_outs = target["tbl_outs"],
2246         tblgen = ":llvm-tblgen",
2247         # MSVC isn't happy with long string literals, while other compilers
2248         # which support them get significant compile time improvements with
2249         # them enabled. Ideally this flag would only be enabled on Windows via
2250         # a select() on `@platforms//os:windows,`, but that would
2251         # require refactoring gentbl from a macro into a rule.
2252         # TODO(#92): Refactor gentbl to support this use
2253         tblgen_args = "--long-string-literals=0",
2254         td_file = "lib/Target/" + target["name"] + "/" + target["short_name"] + ".td",
2255         td_srcs = [
2256             ":common_target_td_sources",
2257         ] + glob([
2258             "lib/Target/" + target["name"] + "/*.td",
2259             "lib/Target/" + target["name"] + "/GISel/*.td",
2260         ]),
2261         deps = target.get("tbl_deps", []),
2262     )],
2263     [cc_library(
2264         name = target["name"] + "Info",
2265         srcs = ["lib/Target/" + target["name"] + "/TargetInfo/" + target["name"] + "TargetInfo.cpp"],
2266         hdrs = glob(["lib/Target/" + target["name"] + "/TargetInfo/*.h"]),
2267         copts = llvm_copts,
2268         # Workaround for https://github.com/bazelbuild/bazel/issues/3828
2269         # TODO(gcmn): Remove this when upgrading to a Bazel version containing
2270         # https://github.com/bazelbuild/bazel/commit/e3b7e17b05f1
2271         includes = ["lib/Target/" + target["name"]],
2272         strip_include_prefix = "lib/Target/" + target["name"],
2273         deps = [
2274             ":" + target["name"] + "CommonTableGen",
2275             ":MC",
2276             ":Support",
2277             ":Target",
2278         ],
2279     )],
2280     # We cannot separate the `Utils` and `MCTargetDesc` sublibraries of
2281     # a number of targets due to crisscrossing inclusion of headers.
2282     [cc_library(
2283         name = target["name"] + "UtilsAndDesc",
2284         srcs = glob([
2285             "lib/Target/" + target["name"] + "/MCTargetDesc/*.cpp",
2286             "lib/Target/" + target["name"] + "/Utils/*.cpp",
2288             # We have to include these headers here as well as in the `hdrs`
2289             # below to allow the `.cpp` files to use file-relative-inclusion to
2290             # find them, even though consumers of this library use inclusion
2291             # relative to the target with the `strip_includes_prefix` of this
2292             # library. This mixture is likely incompatible with header modules.
2293             "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
2294             "lib/Target/" + target["name"] + "/Utils/*.h",
2295         ]),
2296         hdrs = glob([
2297             "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
2298             "lib/Target/" + target["name"] + "/Utils/*.h",
2300             # This a bit of a hack to allow us to expose common, internal
2301             # target header files to other libraries within the target via
2302             # target-relative includes. This usage of headers is inherently
2303             # non-modular as there is a mixture of target-relative inclusion
2304             # using this rule and file-relative inclusion using the repeated
2305             # listing of these headers in the `srcs` of subsequent rules.
2306             "lib/Target/" + target["name"] + "/*.h",
2308             # FIXME: The entries below should be `textual_hdrs` instead of
2309             # `hdrs`, but unfortunately that doesn't work with
2310             # `strip_include_prefix`:
2311             # https://github.com/bazelbuild/bazel/issues/12424
2312             #
2313             # Once that issue is fixed and released, we can switch this to
2314             # `textual_hdrs` and remove the feature disabling the various Bazel
2315             # features (both current and under-development) that motivated the
2316             # distinction between these two.
2317             "lib/Target/" + target["name"] + "/*.def",
2318             "lib/Target/" + target["name"] + "/*.inc",
2319             "lib/Target/" + target["name"] + "/MCTargetDesc/*.def",
2320         ]),
2321         copts = llvm_copts,
2322         features = [
2323             "-parse_headers",
2324             "-header_modules",
2325             "-layering_check",
2326         ],
2327         strip_include_prefix = "lib/Target/" + target["name"],
2328         deps = [
2329             ":BinaryFormat",
2330             ":CodeGenTypes",
2331             ":DebugInfoCodeView",
2332             ":MC",
2333             ":MCDisassembler",
2334             ":Core",
2335             ":Support",
2336             ":Target",
2337             ":config",
2338             ":" + target["name"] + "CommonTableGen",
2339             ":" + target["name"] + "Info",
2340         ],
2341     )],
2342     [cc_library(
2343         name = target["name"] + "CodeGen",
2344         srcs = glob([
2345             "lib/Target/" + target["name"] + "/GISel/*.cpp",
2346             "lib/Target/" + target["name"] + "/GISel/*.h",
2347             "lib/Target/" + target["name"] + "/*.cpp",
2348             "lib/Target/" + target["name"] + "/*.h",
2349         ]),
2350         hdrs = ["lib/Target/" + target["name"] + "/" + target["short_name"] + ".h"],
2351         copts = llvm_copts,
2352         features = ["-layering_check"],
2353         strip_include_prefix = "lib/Target/" + target["name"],
2354         textual_hdrs = glob([
2355             "lib/Target/" + target["name"] + "/*.def",
2356             "lib/Target/" + target["name"] + "/*.inc",
2357         ]),
2358         deps = [
2359             ":Analysis",
2360             ":BinaryFormat",
2361             ":CFGuard",
2362             ":CodeGen",
2363             ":CodeGenTypes",
2364             ":Core",
2365             ":IPO",
2366             ":MC",
2367             ":Passes",  # TODO(chandlerc): Likely a layering violation.
2368             ":ProfileData",
2369             ":Scalar",
2370             ":Support",
2371             ":Target",
2372             ":TransformUtils",
2373             ":Vectorize",
2374             ":config",
2375             ":" + target["name"] + "CommonTableGen",
2376             ":" + target["name"] + "Info",
2377             ":" + target["name"] + "UtilsAndDesc",
2378         ],
2379     )],
2380     [cc_library(
2381         name = target["name"] + "AsmParser",
2382         srcs = glob([
2383             "lib/Target/" + target["name"] + "/AsmParser/*.cpp",
2384             "lib/Target/" + target["name"] + "/AsmParser/*.h",
2385         ]),
2386         copts = llvm_copts,
2387         deps = [
2388             ":BinaryFormat",
2389             ":CodeGenTypes",
2390             ":MC",
2391             ":MCParser",
2392             ":Support",
2393             ":Target",
2394             ":TargetParser",
2395             ":" + target["name"] + "CodeGen",
2396             ":" + target["name"] + "CommonTableGen",
2397             ":" + target["name"] + "Info",
2398             ":" + target["name"] + "UtilsAndDesc",
2399         ],
2400     )],
2401     # This target is a bit of a hack to allow us to expose internal
2402     # disassembler header files via internal target-relative include paths.
2403     # This usage of headers is inherently non-modular as there is a mixture of
2404     # target-relative inclusion using this rule and same-directory inclusion
2405     # using the repeated listing of these headers in the `srcs` below.
2406     [cc_library(
2407         name = target["name"] + "DisassemblerInternalHeaders",
2408         # FIXME: This should be `textual_hdrs` instead of `hdrs`, but
2409         # unfortunately that doesn't work with `strip_include_prefix`:
2410         # https://github.com/bazelbuild/bazel/issues/12424
2411         #
2412         # Once that issue is fixed and released, we can switch this to
2413         # `textual_hdrs` and remove the feature disabling the various Bazel
2414         # features (both current and under-development) that motivated the
2415         # distinction between these two.
2416         hdrs = glob([
2417             "lib/Target/" + target["name"] + "/Disassembler/*.h",
2418         ]),
2419         features = [
2420             "-parse_headers",
2421             "-header_modules",
2422         ],
2423         strip_include_prefix = "lib/Target/" + target["name"],
2424     )],
2425     [cc_library(
2426         name = target["name"] + "Disassembler",
2427         srcs = glob([
2428             "lib/Target/" + target["name"] + "/Disassembler/*.cpp",
2429             "lib/Target/" + target["name"] + "/Disassembler/*.c",
2430             "lib/Target/" + target["name"] + "/Disassembler/*.h",
2431         ]),
2432         copts = llvm_copts,
2433         features = ["-layering_check"],
2434         deps = [
2435             ":CodeGenTypes",
2436             ":Core",
2437             ":MC",
2438             ":MCDisassembler",
2439             ":Support",
2440             ":Target",
2441             ":" + target["name"] + "CodeGen",
2442             ":" + target["name"] + "DisassemblerInternalHeaders",
2443             ":" + target["name"] + "CommonTableGen",
2444             ":" + target["name"] + "UtilsAndDesc",
2445         ],
2446     )],
2447     [cc_library(
2448         name = target["name"] + "TargetMCA",
2449         srcs = glob([
2450             "lib/Target/" + target["name"] + "/MCA/*.cpp",
2451             "lib/Target/" + target["name"] + "/MCA/*.c",
2452             "lib/Target/" + target["name"] + "/MCA/*.h",
2453         ]),
2454         copts = llvm_copts,
2455         features = ["-layering_check"],
2456         deps = [
2457             ":CodeGenTypes",
2458             ":MC",
2459             ":MCA",
2460             ":MCParser",
2461             ":Support",
2462             ":" + target["name"] + "DisassemblerInternalHeaders",
2463             ":" + target["name"] + "Info",
2464             ":" + target["name"] + "UtilsAndDesc",
2465         ],
2466     )],
2467 ] for target in llvm_target_lib_list]
2469 cc_library(
2470     name = "AllTargetsCodeGens",
2471     copts = llvm_copts,
2472     deps = [
2473         target["name"] + "CodeGen"
2474         for target in llvm_target_lib_list
2475     ],
2478 cc_library(
2479     name = "AllTargetsAsmParsers",
2480     copts = llvm_copts,
2481     deps = [
2482         target["name"] + "AsmParser"
2483         for target in llvm_target_lib_list
2484     ],
2487 cc_library(
2488     name = "AllTargetsDisassemblers",
2489     copts = llvm_copts,
2490     deps = [
2491         target["name"] + "Disassembler"
2492         for target in llvm_target_lib_list
2493     ],
2496 cc_library(
2497     name = "AllTargetsMCAs",
2498     copts = llvm_copts,
2499     deps = [
2500         target["name"] + "TargetMCA"
2501         for target in llvm_target_lib_list
2502     ],
2505 cc_library(
2506     name = "pass_registry_def",
2507     copts = llvm_copts,
2508     textual_hdrs = ["lib/Passes/PassRegistry.def"],
2511 cc_library(
2512     name = "MLPolicies",
2513     srcs = glob([
2514         "lib/Analysis/ML/*.cpp",
2515         "lib/Analysis/ML/*.h",
2516     ]),
2517     hdrs = glob([
2518         "include/llvm/Analysis/ML/*.h",
2519     ]),
2520     copts = llvm_copts,
2521     deps = [
2522         ":Analysis",
2523         ":Core",
2524         ":Support",
2525     ],
2528 cc_library(
2529     name = "Passes",
2530     srcs = glob([
2531         "lib/Passes/*.cpp",
2532         "lib/Passes/*.h",
2533     ]),
2534     hdrs = glob(["include/llvm/Passes/*.h"]) + ["include/llvm-c/Transforms/PassBuilder.h"],
2535     copts = llvm_copts,
2536     deps = [
2537         ":AggressiveInstCombine",
2538         ":Analysis",
2539         ":CodeGen",
2540         ":common_transforms",
2541         ":config",
2542         ":Core",
2543         ":Coroutines",
2544         ":HipStdPar",
2545         ":InstCombine",
2546         ":Instrumentation",
2547         ":IPO",
2548         ":IRPrinter",
2549         ":MLPolicies",
2550         ":ObjCARC",
2551         ":pass_registry_def",
2552         ":Scalar",
2553         ":Support",
2554         ":Target",
2555         ":TransformUtils",
2556         ":Vectorize",
2557     ],
2560 cc_library(
2561     name = "LTO",
2562     srcs = glob([
2563         "lib/LTO/*.cpp",
2564         "lib/LTO/*.h",
2565     ]),
2566     hdrs = glob([
2567         "include/llvm/LTO/*.h",
2568         "include/llvm/LTO/legacy/*.h",
2569     ]) + [
2570         "include/llvm-c/lto.h",
2571     ],
2572     copts = llvm_copts,
2573     deps = [
2574         ":Analysis",
2575         ":BitReader",
2576         ":BitWriter",
2577         ":CodeGen",
2578         ":CodeGenTypes",
2579         ":Core",
2580         ":IPO",
2581         ":IRPrinter",
2582         ":IRReader",
2583         ":Linker",
2584         ":MC",
2585         ":MCParser",
2586         ":ObjCARC",
2587         ":Object",
2588         ":Passes",
2589         ":Remarks",
2590         ":Scalar",
2591         ":Support",
2592         ":Target",
2593         ":TargetParser",
2594         ":TransformUtils",
2595         ":common_transforms",
2596         ":config",
2597     ],
2600 cc_library(
2601     name = "ExecutionEngine",
2602     srcs = glob([
2603         "lib/ExecutionEngine/*.cpp",
2604         "lib/ExecutionEngine/*.h",
2605         "lib/ExecutionEngine/RuntimeDyld/*.cpp",
2606         "lib/ExecutionEngine/RuntimeDyld/*.h",
2607         "lib/ExecutionEngine/RuntimeDyld/Targets/*.cpp",
2608         "lib/ExecutionEngine/RuntimeDyld/Targets/*.h",
2609     ]),
2610     hdrs = glob(
2611         [
2612             "include/llvm/ExecutionEngine/*.h",
2613         ],
2614         exclude = [
2615             "include/llvm/ExecutionEngine/MCJIT*.h",
2616             "include/llvm/ExecutionEngine/OProfileWrapper.h",
2617         ],
2618     ) + [
2619         "include/llvm-c/ExecutionEngine.h",
2620     ],
2621     copts = llvm_copts,
2622     deps = [
2623         ":BinaryFormat",
2624         ":CodeGen",
2625         ":Core",
2626         ":DebugInfo",
2627         ":MC",
2628         ":MCDisassembler",
2629         ":Object",
2630         ":OrcTargetProcess",
2631         ":Passes",
2632         ":Support",
2633         ":Target",
2634         ":TargetParser",
2635         ":config",
2636     ],
2639 cc_library(
2640     name = "Interpreter",
2641     srcs = glob([
2642         "lib/ExecutionEngine/Interpreter/*.cpp",
2643         "lib/ExecutionEngine/Interpreter/*.h",
2644     ]),
2645     hdrs = ["include/llvm/ExecutionEngine/Interpreter.h"],
2646     copts = llvm_copts,
2647     deps = [
2648         ":CodeGen",
2649         ":Core",
2650         ":ExecutionEngine",
2651         ":Support",
2652         ":Target",
2653         ":config",
2654     ],
2657 gentbl(
2658     name = "JITLinkTableGen",
2659     strip_include_prefix = "lib/ExecutionEngine/JITLink",
2660     tbl_outs = [(
2661         "-gen-opt-parser-defs",
2662         "lib/ExecutionEngine/JITLink/COFFOptions.inc",
2663     )],
2664     tblgen = ":llvm-tblgen",
2665     td_file = "lib/ExecutionEngine/JITLink/COFFOptions.td",
2666     td_srcs = ["include/llvm/Option/OptParser.td"],
2669 cc_library(
2670     name = "JITLink",
2671     srcs = glob([
2672         "lib/ExecutionEngine/JITLink/*.cpp",
2673         "lib/ExecutionEngine/JITLink/*.h",
2674     ]),
2675     hdrs = glob([
2676         "include/llvm/ExecutionEngine/JITLink/*.h",
2677     ]),
2678     copts = llvm_copts,
2679     deps = [
2680         ":BinaryFormat",
2681         ":ExecutionEngine",
2682         ":JITLinkTableGen",
2683         ":Object",
2684         ":Option",
2685         ":OrcShared",
2686         ":OrcTargetProcess",
2687         ":Support",
2688         ":TargetParser",
2689         ":config",
2690     ],
2693 cc_library(
2694     name = "MCJIT",
2695     srcs = glob([
2696         "lib/ExecutionEngine/MCJIT/*.cpp",
2697         "lib/ExecutionEngine/MCJIT/*.h",
2698     ]),
2699     hdrs = glob(["include/llvm/ExecutionEngine/MCJIT*.h"]),
2700     copts = llvm_copts,
2701     deps = [
2702         ":CodeGen",
2703         ":Core",
2704         ":ExecutionEngine",
2705         ":MC",
2706         ":Object",
2707         ":Support",
2708         ":Target",
2709         ":config",
2710     ],
2713 cc_library(
2714     name = "OrcJIT",
2715     srcs = glob([
2716         "lib/ExecutionEngine/Orc/*.cpp",
2717         "lib/ExecutionEngine/Orc/*.h",
2718     ]),
2719     hdrs = glob([
2720         "include/llvm/ExecutionEngine/Orc/*.h",
2721         "include/llvm/ExecutionEngine/Orc/RPC/*.h",
2722     ]) + [
2723         "include/llvm-c/LLJIT.h",
2724         "include/llvm-c/Orc.h",
2725         "include/llvm-c/OrcEE.h",
2726     ],
2727     copts = llvm_copts,
2728     linkopts = select({
2729         "@platforms//os:android": [],
2730         "@platforms//os:windows": [],
2731         "@platforms//os:freebsd": [],
2732         "@platforms//os:macos": [],
2733         "//conditions:default": [
2734             "-lrt",
2735         ],
2736     }),
2737     deps = [
2738         ":Analysis",
2739         ":BinaryFormat",
2740         ":BitReader",
2741         ":BitWriter",
2742         ":Core",
2743         ":DebugInfoDWARF",
2744         ":ExecutionEngine",
2745         ":JITLink",
2746         ":MC",
2747         ":MCDisassembler",
2748         ":Object",
2749         ":OrcShared",
2750         ":OrcTargetProcess",
2751         ":Passes",
2752         ":Support",
2753         ":Target",
2754         ":TargetParser",
2755         ":TransformUtils",
2756         ":WindowsDriver",
2757         ":config",
2758     ],
2761 cc_library(
2762     name = "OrcShared",
2763     srcs = glob([
2764         "lib/ExecutionEngine/Orc/Shared/*.cpp",
2765     ]),
2766     hdrs = glob([
2767         "include/llvm/ExecutionEngine/Orc/Shared/*.h",
2768     ]),
2769     copts = llvm_copts,
2770     deps = [
2771         ":BinaryFormat",
2772         ":CodeGen",
2773         ":Core",
2774         ":DebugInfo",
2775         ":MC",
2776         ":MCDisassembler",
2777         ":Object",
2778         ":Passes",
2779         ":Support",
2780         ":Target",
2781         ":config",
2782     ],
2785 cc_library(
2786     name = "OrcDebugging",
2787     srcs = glob([
2788         "lib/ExecutionEngine/Orc/Debugging/*.cpp",
2789     ]),
2790     hdrs = glob([
2791         "include/llvm/ExecutionEngine/Orc/Debugging/*.h",
2792     ]),
2793     copts = llvm_copts,
2794     deps = [
2795         ":BinaryFormat",
2796         ":DebugInfo",
2797         ":OrcShared",
2798         ":OrcJIT",
2799         ":JITLink",
2800         ":Support",
2801         ":TargetParser",
2802     ],
2806 cc_library(
2807     name = "OrcTargetProcess",
2808     srcs = glob([
2809         "lib/ExecutionEngine/Orc/TargetProcess/*.cpp",
2810         "lib/ExecutionEngine/Orc/TargetProcess/*.h",
2811     ]),
2812     hdrs = glob([
2813         "include/llvm/ExecutionEngine/Orc/TargetProcess/*.h",
2814     ]),
2815     copts = llvm_copts,
2816     linkopts = select({
2817         "@platforms//os:android": [],
2818         "@platforms//os:windows": [],
2819         "@platforms//os:freebsd": [],
2820         "@platforms//os:macos": [],
2821         "//conditions:default": [
2822             "-lrt",
2823         ],
2824     }),
2825     deps = [
2826         ":BinaryFormat",
2827         ":CodeGen",
2828         ":Core",
2829         ":DebugInfo",
2830         ":MC",
2831         ":MCDisassembler",
2832         ":Object",
2833         ":OrcShared",
2834         ":Passes",
2835         ":Support",
2836         ":Target",
2837         ":TargetParser",
2838         ":config",
2839     ],
2842 cc_library(
2843     name = "DWARFLinker",
2844     srcs = glob([
2845         "lib/DWARFLinker/*.cpp",
2846         "lib/DWARFLinker/*.h",
2847     ]),
2848     hdrs = glob(["include/llvm/DWARFLinker/*.h"]),
2849     copts = llvm_copts,
2850     deps = [
2851         ":BinaryFormat",
2852         ":CodeGen",
2853         ":CodeGenTypes",
2854         ":DebugInfoDWARF",
2855         ":MC",
2856         ":Support",
2857         ":Target",
2858         ":TargetParser",
2859     ],
2862 cc_library(
2863     name = "DWARFLinkerParallel",
2864     srcs = glob([
2865         "lib/DWARFLinkerParallel/*.cpp",
2866         "lib/DWARFLinkerParallel/*.h",
2867     ]),
2868     hdrs = glob(["include/llvm/DWARFLinkerParallel/*.h"]),
2869     copts = llvm_copts,
2870     deps = [
2871         ":BinaryFormat",
2872         ":CodeGen",
2873         ":DWARFLinker",
2874         ":DebugInfoDWARF",
2875         ":MC",
2876         ":Object",
2877         ":Support",
2878         ":Target",
2879         ":TargetParser",
2880     ],
2883 gentbl(
2884     name = "DllOptionsTableGen",
2885     strip_include_prefix = "lib/ToolDrivers/llvm-dlltool",
2886     tbl_outs = [(
2887         "-gen-opt-parser-defs",
2888         "lib/ToolDrivers/llvm-dlltool/Options.inc",
2889     )],
2890     tblgen = ":llvm-tblgen",
2891     td_file = "lib/ToolDrivers/llvm-dlltool/Options.td",
2892     td_srcs = ["include/llvm/Option/OptParser.td"],
2895 cc_library(
2896     name = "DlltoolDriver",
2897     srcs = glob(["lib/ToolDrivers/llvm-dlltool/*.cpp"]),
2898     hdrs = glob(["include/llvm/ToolDrivers/llvm-dlltool/*.h"]),
2899     copts = llvm_copts,
2900     deps = [
2901         ":DllOptionsTableGen",
2902         ":Object",
2903         ":Option",
2904         ":Support",
2905         ":TargetParser",
2906     ],
2909 gentbl(
2910     name = "LibOptionsTableGen",
2911     strip_include_prefix = "lib/ToolDrivers/llvm-lib",
2912     tbl_outs = [(
2913         "-gen-opt-parser-defs",
2914         "lib/ToolDrivers/llvm-lib/Options.inc",
2915     )],
2916     tblgen = ":llvm-tblgen",
2917     td_file = "lib/ToolDrivers/llvm-lib/Options.td",
2918     td_srcs = ["include/llvm/Option/OptParser.td"],
2921 cc_library(
2922     name = "LibDriver",
2923     srcs = glob(["lib/ToolDrivers/llvm-lib/*.cpp"]),
2924     hdrs = glob(["include/llvm/ToolDrivers/llvm-lib/*.h"]),
2925     copts = llvm_copts,
2926     deps = [
2927         ":BinaryFormat",
2928         ":BitReader",
2929         ":LibOptionsTableGen",
2930         ":Object",
2931         ":Option",
2932         ":Support",
2933     ],
2936 cc_library(
2937     name = "InterfaceStub",
2938     srcs = glob([
2939         "lib/InterfaceStub/*.cpp",
2940         "lib/InterfaceStub/*.h",
2941     ]),
2942     hdrs = glob([
2943         "include/llvm/InterfaceStub/*.h",
2944     ]),
2945     copts = llvm_copts,
2946     deps = [
2947         ":BinaryFormat",
2948         ":MC",
2949         ":Object",
2950         ":Support",
2951         ":TargetParser",
2952         ":config",
2953     ],
2956 cc_library(
2957     name = "WindowsDriver",
2958     srcs = glob([
2959         "lib/WindowsDriver/*.cpp",
2960     ]),
2961     hdrs = glob([
2962         "include/llvm/WindowsDriver/*.h",
2963     ]),
2964     copts = llvm_copts,
2965     deps = [
2966         ":Option",
2967         ":Support",
2968         ":TargetParser",
2969     ],
2972 cc_library(
2973     name = "WindowsManifest",
2974     srcs = glob([
2975         "lib/WindowsManifest/*.cpp",
2976     ]),
2977     hdrs = glob([
2978         "include/llvm/WindowsManifest/*.h",
2979     ]),
2980     copts = llvm_copts,
2981     deps = [
2982         ":Support",
2983         ":config",
2984     ],
2987 cc_library(
2988     name = "MCA",
2989     srcs = glob([
2990         "lib/MCA/**/*.cpp",
2991         "lib/MCA/**/*.h",
2992     ]),
2993     hdrs = glob([
2994         "include/llvm/MCA/**/*.h",
2995     ]),
2996     copts = llvm_copts,
2997     deps = [
2998         ":MC",
2999         ":MCDisassembler",
3000         ":Object",
3001         ":Support",
3002     ],
3005 cc_library(
3006     name = "llvm-mca-headers",
3007     hdrs = glob([
3008         "tools/llvm-mca/*.h",
3009         "tools/llvm-mca/Views/*.h",
3010     ]),
3011     strip_include_prefix = "tools/llvm-mca",
3014 cc_library(
3015     name = "XRay",
3016     srcs = glob([
3017         "lib/XRay/*.cpp",
3018         "lib/XRay/*.h",
3019     ]),
3020     hdrs = glob(["include/llvm/XRay/*.h"]),
3021     copts = llvm_copts,
3022     deps = [
3023         ":Object",
3024         ":Support",
3025         ":TargetParser",
3026     ],
3029 # A flag to pick which `pfm` to use for Exegesis.
3030 # Usage: `--@llvm-project//llvm:pfm=<disable|external|system>`.
3031 # Flag documentation: https://bazel.build/extending/config
3032 string_flag(
3033     name = "pfm",
3034     build_setting_default = "external",
3035     values = [
3036         "disable",  # Don't include pfm at all
3037         "external",  # Build pfm from source
3038         "system",  # Use system pfm (non hermetic)
3039     ],
3042 config_setting(
3043     name = "pfm_disable",
3044     flag_values = {":pfm": "disable"},
3047 config_setting(
3048     name = "pfm_external",
3049     flag_values = {":pfm": "external"},
3052 config_setting(
3053     name = "pfm_system",
3054     flag_values = {":pfm": "system"},
3057 cc_library(
3058     name = "maybe_pfm",
3059     # We want dependencies of this library to have -DHAVE_LIBPFM conditionally
3060     # defined, so we set `defines` instead of `copts`.
3061     defines = select({
3062         ":pfm_external": ["HAVE_LIBPFM=1"],
3063         ":pfm_system": ["HAVE_LIBPFM=1"],
3064         "//conditions:default": [],
3065     }),
3066     deps = select({
3067         ":pfm_external": ["@pfm//:pfm_external"],
3068         ":pfm_system": ["@pfm//:pfm_system"],
3069         "//conditions:default": [],
3070     }),
3073 cc_library(
3074     name = "Exegesis",
3075     srcs = glob([
3076         "tools/llvm-exegesis/lib/*.cpp",
3077         # We have to include these headers here as well as in the `hdrs` below
3078         # to allow the `.cpp` files to use file-relative-inclusion to find
3079         # them, even though consumers of this library use inclusion relative to
3080         # `tools/llvm-exegesis/lib` with the `strip_includes_prefix` of this
3081         # library. This mixture appears to be incompatible with header modules.
3082         "tools/llvm-exegesis/lib/*.h",
3083     ] + [
3084         "tools/llvm-exegesis/lib/{}/*.cpp".format(t)
3085         for t in llvm_target_exegesis
3086     ] + [
3087         "tools/llvm-exegesis/lib/{}/*.h".format(t)
3088         for t in llvm_target_exegesis
3089     ]),
3090     hdrs = glob(["tools/llvm-exegesis/lib/*.h"]),
3091     copts = llvm_copts,
3092     features = [
3093         "-header_modules",
3094         "-layering_check",
3095     ],
3096     strip_include_prefix = "tools/llvm-exegesis/lib",
3097     deps = [
3098         ":AllTargetsAsmParsers",
3099         ":AllTargetsCodeGens",
3100         ":CodeGen",
3101         ":CodeGenTypes",
3102         ":Core",
3103         ":ExecutionEngine",
3104         ":MC",
3105         ":MCA",
3106         ":MCDisassembler",
3107         ":MCJIT",
3108         ":Object",
3109         ":ObjectYAML",
3110         ":Support",
3111         ":Target",
3112         ":config",
3113         ":maybe_pfm",
3114     ],
3117 ################################################################################
3118 # LLVM toolchain and development binaries
3120 gentbl(
3121     name = "DsymutilTableGen",
3122     strip_include_prefix = "tools/dsymutil",
3123     tbl_outs = [(
3124         "-gen-opt-parser-defs",
3125         "tools/dsymutil/Options.inc",
3126     )],
3127     tblgen = ":llvm-tblgen",
3128     td_file = "tools/dsymutil/Options.td",
3129     td_srcs = ["include/llvm/Option/OptParser.td"],
3132 expand_template(
3133     name = "dsymutil_main",
3134     out = "dsymutil-driver.cpp",
3135     substitutions = {
3136         "@TOOL_NAME@": "dsymutil",
3137     },
3138     template = "cmake/modules/llvm-driver-template.cpp.in",
3141 cc_binary(
3142     name = "dsymutil",
3143     srcs = glob([
3144         "tools/dsymutil/*.cpp",
3145         "tools/dsymutil/*.h",
3146     ]) + ["dsymutil-driver.cpp"],
3147     copts = llvm_copts,
3148     stamp = 0,
3149     deps = [
3150         ":AllTargetsCodeGens",
3151         ":BinaryFormat",
3152         ":CodeGen",
3153         ":CodeGenTypes",
3154         ":DWARFLinker",
3155         ":DWARFLinkerParallel",
3156         ":DebugInfo",
3157         ":DebugInfoDWARF",
3158         ":DsymutilTableGen",
3159         ":MC",
3160         ":Object",
3161         ":Option",
3162         ":Remarks",
3163         ":Support",
3164         ":Target",
3165         ":TargetParser",
3166         ":config",
3167         ":remark_linker",
3168     ],
3171 cc_binary(
3172     name = "llc",
3173     srcs = glob([
3174         "tools/llc/*.cpp",
3175         "tools/llc/*.h",
3176     ]),
3177     copts = llvm_copts,
3178     stamp = 0,
3179     deps = [
3180         ":AllTargetsAsmParsers",
3181         ":AllTargetsCodeGens",
3182         ":Analysis",
3183         ":AsmParser",
3184         ":BitReader",
3185         ":CodeGen",
3186         ":CodeGenTypes",
3187         ":Core",
3188         ":IRPrinter",
3189         ":IRReader",
3190         ":MC",
3191         ":Remarks",
3192         ":Support",
3193         ":Target",
3194         ":TargetParser",
3195         ":TransformUtils",
3196     ],
3199 cc_binary(
3200     name = "lli",
3201     srcs = glob([
3202         "tools/lli/*.cpp",
3203         "tools/lli/*.h",
3204     ]),
3205     copts = llvm_copts,
3206     # ll scripts rely on symbols from dependent
3207     # libraries being resolvable.
3208     linkopts = select({
3209         "@platforms//os:windows": [],
3210         "@platforms//os:macos": [],
3211         "//conditions:default": [
3212             "-Wl,--undefined=_ZTIi",
3213             "-Wl,--export-dynamic-symbol=_ZTIi",
3214             "-Wl,--export-dynamic-symbol=__cxa_begin_catch",
3215             "-Wl,--export-dynamic-symbol=__cxa_end_catch",
3216             "-Wl,--export-dynamic-symbol=__gxx_personality_v0",
3217             "-Wl,--export-dynamic-symbol=__cxa_allocate_exception",
3218             "-Wl,--export-dynamic-symbol=__cxa_throw",
3219             "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper",
3220             "-Wl,--export-dynamic-symbol=llvm_orc_registerEHFrameSectionWrapper",
3221             "-Wl,--export-dynamic-symbol=llvm_orc_deregisterEHFrameSectionWrapper",
3222         ],
3223     }),
3224     stamp = 0,
3225     deps = [
3226         ":AllTargetsAsmParsers",
3227         ":AllTargetsCodeGens",
3228         ":AsmParser",
3229         ":BitReader",
3230         ":CodeGen",
3231         ":Core",
3232         ":ExecutionEngine",
3233         ":IRPrinter",
3234         ":IRReader",
3235         ":Instrumentation",
3236         ":Interpreter",
3237         ":MCJIT",
3238         ":Object",
3239         ":OrcJIT",
3240         ":OrcTargetProcess",
3241         ":OrcDebugging",
3242         ":Support",
3243         ":TargetParser",
3244         ":config",
3245     ],
3248 expand_template(
3249     name = "ar_main",
3250     out = "llvm-ar-driver.cpp",
3251     substitutions = {
3252         "@TOOL_NAME@": "llvm_ar",
3253     },
3254     template = "cmake/modules/llvm-driver-template.cpp.in",
3257 cc_binary(
3258     name = "llvm-ar",
3259     srcs = glob([
3260         "tools/llvm-ar/*.cpp",
3261         "tools/llvm-ar/*.h",
3262     ]) + ["llvm-ar-driver.cpp"],
3263     copts = llvm_copts,
3264     stamp = 0,
3265     deps = [
3266         ":AllTargetsAsmParsers",
3267         ":AllTargetsCodeGens",
3268         ":BinaryFormat",
3269         ":Core",
3270         ":DlltoolDriver",
3271         ":LibDriver",
3272         ":Object",
3273         ":Support",
3274         ":TargetParser",
3275     ],
3278 # We need to run llvm-ar with different basenames to make it run with
3279 # different behavior.
3280 binary_alias(
3281     name = "llvm-dlltool",
3282     binary = ":llvm-ar",
3285 binary_alias(
3286     name = "llvm-lib",
3287     binary = ":llvm-ar",
3290 binary_alias(
3291     name = "llvm-ranlib",
3292     binary = ":llvm-ar",
3295 cc_binary(
3296     name = "llvm-as",
3297     srcs = glob([
3298         "tools/llvm-as/*.cpp",
3299         "tools/llvm-as/*.h",
3300     ]),
3301     copts = llvm_copts,
3302     stamp = 0,
3303     deps = [
3304         ":Analysis",
3305         ":AsmParser",
3306         ":BitWriter",
3307         ":Core",
3308         ":Support",
3309     ],
3312 cc_binary(
3313     name = "llvm-bcanalyzer",
3314     srcs = glob([
3315         "tools/llvm-bcanalyzer/*.cpp",
3316         "tools/llvm-bcanalyzer/*.h",
3317     ]),
3318     copts = llvm_copts,
3319     stamp = 0,
3320     deps = [
3321         ":BitReader",
3322         ":Support",
3323     ],
3326 cc_binary(
3327     name = "llvm-cat",
3328     srcs = glob([
3329         "tools/llvm-cat/*.cpp",
3330     ]),
3331     copts = llvm_copts,
3332     stamp = 0,
3333     deps = [
3334         ":BitReader",
3335         ":BitWriter",
3336         ":Core",
3337         ":IRPrinter",
3338         ":IRReader",
3339         ":Support",
3340     ],
3343 cc_binary(
3344     name = "llvm-cfi-verify",
3345     srcs = glob([
3346         "tools/llvm-cfi-verify/*.cpp",
3347         "tools/llvm-cfi-verify/lib/*.cpp",
3348         "tools/llvm-cfi-verify/lib/*.h",
3349     ]),
3350     copts = llvm_copts,
3351     stamp = 0,
3352     deps = [
3353         ":AllTargetsAsmParsers",
3354         ":AllTargetsCodeGens",
3355         ":AllTargetsDisassemblers",
3356         ":BinaryFormat",
3357         ":DebugInfoDWARF",
3358         ":MC",
3359         ":MCDisassembler",
3360         ":MCParser",
3361         ":Object",
3362         ":Support",
3363         ":Symbolize",
3364     ],
3367 cc_binary(
3368     name = "llvm-cov",
3369     srcs = glob([
3370         "tools/llvm-cov/*.cpp",
3371         "tools/llvm-cov/*.h",
3372     ]),
3373     copts = llvm_copts,
3374     stamp = 0,
3375     deps = [
3376         ":Coverage",
3377         ":Debuginfod",
3378         ":Instrumentation",
3379         ":Object",
3380         ":ProfileData",
3381         ":Support",
3382         ":TargetParser",
3383         ":config",
3384     ],
3387 gentbl(
3388     name = "CvtResTableGen",
3389     strip_include_prefix = "tools/llvm-cvtres",
3390     tbl_outs = [(
3391         "-gen-opt-parser-defs",
3392         "tools/llvm-cvtres/Opts.inc",
3393     )],
3394     tblgen = ":llvm-tblgen",
3395     td_file = "tools/llvm-cvtres/Opts.td",
3396     td_srcs = ["include/llvm/Option/OptParser.td"],
3399 cc_binary(
3400     name = "llvm-cvtres",
3401     srcs = glob([
3402         "tools/llvm-cvtres/*.cpp",
3403         "tools/llvm-cvtres/*.h",
3404     ]),
3405     copts = llvm_copts,
3406     stamp = 0,
3407     deps = [
3408         ":BinaryFormat",
3409         ":CvtResTableGen",
3410         ":Object",
3411         ":Option",
3412         ":Support",
3413     ],
3416 cc_binary(
3417     name = "llvm-cxxdump",
3418     srcs = glob([
3419         "tools/llvm-cxxdump/*.cpp",
3420         "tools/llvm-cxxdump/*.h",
3421     ]),
3422     copts = llvm_copts,
3423     stamp = 0,
3424     deps = [
3425         ":AllTargetsCodeGens",
3426         ":BitReader",
3427         ":MC",
3428         ":Object",
3429         ":Support",
3430     ],
3433 cc_binary(
3434     name = "llvm-cxxmap",
3435     srcs = glob([
3436         "tools/llvm-cxxmap/*.cpp",
3437         "tools/llvm-cxxmap/*.h",
3438     ]),
3439     copts = llvm_copts,
3440     stamp = 0,
3441     deps = [
3442         ":ProfileData",
3443         ":Support",
3444     ],
3447 gentbl(
3448     name = "CxxfiltOptsTableGen",
3449     strip_include_prefix = "tools/llvm-cxxfilt",
3450     tbl_outs = [(
3451         "-gen-opt-parser-defs",
3452         "tools/llvm-cxxfilt/Opts.inc",
3453     )],
3454     tblgen = ":llvm-tblgen",
3455     td_file = "tools/llvm-cxxfilt/Opts.td",
3456     td_srcs = ["include/llvm/Option/OptParser.td"],
3459 expand_template(
3460     name = "cxxfilt_main",
3461     out = "llvm-cxxfilt-driver.cpp",
3462     substitutions = {
3463         "@TOOL_NAME@": "llvm_cxxfilt",
3464     },
3465     template = "cmake/modules/llvm-driver-template.cpp.in",
3468 cc_binary(
3469     name = "llvm-cxxfilt",
3470     srcs = glob([
3471         "tools/llvm-cxxfilt/*.cpp",
3472         "tools/llvm-cxxfilt/*.h",
3473     ]) + ["llvm-cxxfilt-driver.cpp"],
3474     copts = llvm_copts,
3475     stamp = 0,
3476     deps = [
3477         ":CxxfiltOptsTableGen",
3478         ":Demangle",
3479         ":Option",
3480         ":Support",
3481         ":TargetParser",
3482     ],
3485 cc_binary(
3486     name = "llvm-debuginfo-analyzer",
3487     srcs = glob([
3488         "tools/llvm-debuginfo-analyzer/*.cpp",
3489         "tools/llvm-debuginfo-analyzer/*.h",
3490     ]),
3491     copts = llvm_copts,
3492     stamp = 0,
3493     deps = [
3494         ":AllTargetsCodeGens",
3495         ":AllTargetsDisassemblers",
3496         ":DebugInfoLogicalView",
3497         ":Support",
3498     ],
3501 cc_binary(
3502     name = "llvm-debuginfod-find",
3503     srcs = glob([
3504         "tools/llvm-debuginfod-find/*.cpp",
3505         "tools/llvm-debuginfod-find/*.h",
3506     ]),
3507     copts = llvm_copts,
3508     stamp = 0,
3509     deps = [
3510         ":BitReader",
3511         ":Core",
3512         ":Debuginfod",
3513         ":Support",
3514         ":Symbolize",
3515     ],
3518 cc_binary(
3519     name = "llvm-dis",
3520     srcs = glob([
3521         "tools/llvm-dis/*.cpp",
3522         "tools/llvm-dis/*.h",
3523     ]),
3524     copts = llvm_copts,
3525     stamp = 0,
3526     deps = [
3527         ":Analysis",
3528         ":BitReader",
3529         ":Core",
3530         ":Support",
3531     ],
3534 cc_binary(
3535     name = "llvm-dwarfdump",
3536     srcs = glob([
3537         "tools/llvm-dwarfdump/*.cpp",
3538         "tools/llvm-dwarfdump/*.h",
3539     ]),
3540     copts = llvm_copts,
3541     stamp = 0,
3542     deps = [
3543         ":AllTargetsCodeGens",
3544         ":BinaryFormat",
3545         ":DebugInfo",
3546         ":DebugInfoDWARF",
3547         ":MC",
3548         ":Object",
3549         ":Support",
3550         ":TargetParser",
3551     ],
3554 gentbl(
3555     name = "DwarfutilOptionsTableGen",
3556     strip_include_prefix = "tools/llvm-dwarfutil",
3557     tbl_outs = [(
3558         "-gen-opt-parser-defs",
3559         "tools/llvm-dwarfutil/Options.inc",
3560     )],
3561     tblgen = ":llvm-tblgen",
3562     td_file = "tools/llvm-dwarfutil/Options.td",
3563     td_srcs = ["include/llvm/Option/OptParser.td"],
3566 cc_binary(
3567     name = "llvm-dwarfutil",
3568     srcs = glob([
3569         "tools/llvm-dwarfutil/*.cpp",
3570         "tools/llvm-dwarfutil/*.h",
3571     ]),
3572     copts = llvm_copts,
3573     stamp = 0,
3574     deps = [
3575         ":AllTargetsAsmParsers",
3576         ":AllTargetsCodeGens",
3577         ":CodeGenTypes",
3578         ":DWARFLinker",
3579         ":DWARFLinkerParallel",
3580         ":DebugInfoDWARF",
3581         ":DwarfutilOptionsTableGen",
3582         ":MC",
3583         ":ObjCopy",
3584         ":Object",
3585         ":Option",
3586         ":Support",
3587         ":Target",
3588         ":TargetParser",
3589     ],
3592 gentbl(
3593     name = "DwpOptionsTableGen",
3594     strip_include_prefix = "tools/llvm-dwp",
3595     tbl_outs = [(
3596         "-gen-opt-parser-defs",
3597         "tools/llvm-dwp/Opts.inc",
3598     )],
3599     tblgen = ":llvm-tblgen",
3600     td_file = "tools/llvm-dwp/Opts.td",
3601     td_srcs = ["include/llvm/Option/OptParser.td"],
3604 expand_template(
3605     name = "dwp_main",
3606     out = "llvm-dwp-driver.cpp",
3607     substitutions = {
3608         "@TOOL_NAME@": "llvm_dwp",
3609     },
3610     template = "cmake/modules/llvm-driver-template.cpp.in",
3613 cc_binary(
3614     name = "llvm-dwp",
3615     srcs = glob([
3616         "tools/llvm-dwp/*.cpp",
3617         "tools/llvm-dwp/*.h",
3618     ]) + ["llvm-dwp-driver.cpp"],
3619     copts = llvm_copts,
3620     stamp = 0,
3621     deps = [
3622         ":AllTargetsCodeGens",
3623         ":DWP",
3624         ":DwpOptionsTableGen",
3625         ":MC",
3626         ":Option",
3627         ":Support",
3628     ],
3631 cc_binary(
3632     name = "llvm-exegesis",
3633     srcs = [
3634         "tools/llvm-exegesis/llvm-exegesis.cpp",
3635     ],
3636     copts = llvm_copts,
3637     stamp = 0,
3638     deps = [
3639         ":AllTargetsAsmParsers",
3640         ":AllTargetsCodeGens",
3641         ":AllTargetsDisassemblers",
3642         ":CodeGenTypes",
3643         ":Exegesis",
3644         ":MC",
3645         ":MCParser",
3646         ":Object",
3647         ":Support",
3648         ":TargetParser",
3649         ":config",
3650     ],
3653 cc_binary(
3654     name = "llvm-extract",
3655     srcs = glob([
3656         "tools/llvm-extract/*.cpp",
3657         "tools/llvm-extract/*.h",
3658     ]),
3659     copts = llvm_copts,
3660     stamp = 0,
3661     deps = [
3662         ":AsmParser",
3663         ":BitReader",
3664         ":BitWriter",
3665         ":Core",
3666         ":IPO",
3667         ":IRPrinter",
3668         ":IRReader",
3669         ":Passes",
3670         ":Support",
3671     ],
3674 gentbl(
3675     name = "GSYMUtilOptionsTableGen",
3676     strip_include_prefix = "tools/llvm-gsymutil",
3677     tbl_outs = [(
3678         "-gen-opt-parser-defs",
3679         "tools/llvm-gsymutil/Opts.inc",
3680     )],
3681     tblgen = ":llvm-tblgen",
3682     td_file = "tools/llvm-gsymutil/Opts.td",
3683     td_srcs = ["include/llvm/Option/OptParser.td"],
3686 expand_template(
3687     name = "gsymutil_main",
3688     out = "llvm-gsymutil-driver.cpp",
3689     substitutions = {
3690         "@TOOL_NAME@": "llvm_gsymutil",
3691     },
3692     template = "cmake/modules/llvm-driver-template.cpp.in",
3695 cc_binary(
3696     name = "llvm-gsymutil",
3697     srcs = glob([
3698         "tools/llvm-gsymutil/*.cpp",
3699         "tools/llvm-gsymutil/*.h",
3700     ]) + ["llvm-gsymutil-driver.cpp"],
3701     copts = llvm_copts,
3702     stamp = 0,
3703     deps = [
3704         ":AllTargetsCodeGens",
3705         ":DebugInfo",
3706         ":DebugInfoDWARF",
3707         ":DebugInfoGSYM",
3708         ":GSYMUtilOptionsTableGen",
3709         ":MC",
3710         ":Object",
3711         ":Option",
3712         ":Support",
3713         ":Target",
3714         ":TargetParser",
3715     ],
3718 gentbl(
3719     name = "IfsOptionsTableGen",
3720     strip_include_prefix = "tools/llvm-ifs",
3721     tbl_outs = [(
3722         "-gen-opt-parser-defs",
3723         "tools/llvm-ifs/Opts.inc",
3724     )],
3725     tblgen = ":llvm-tblgen",
3726     td_file = "tools/llvm-ifs/Opts.td",
3727     td_srcs = ["include/llvm/Option/OptParser.td"],
3730 expand_template(
3731     name = "ifs_main",
3732     out = "llvm-ifs-driver.cpp",
3733     substitutions = {
3734         "@TOOL_NAME@": "llvm_ifs",
3735     },
3736     template = "cmake/modules/llvm-driver-template.cpp.in",
3739 cc_binary(
3740     name = "llvm-ifs",
3741     srcs = glob([
3742         "tools/llvm-ifs/*.cpp",
3743         "tools/llvm-ifs/*.h",
3744     ]) + ["llvm-ifs-driver.cpp"],
3745     copts = llvm_copts,
3746     stamp = 0,
3747     deps = [
3748         ":BinaryFormat",
3749         ":IfsOptionsTableGen",
3750         ":InterfaceStub",
3751         ":ObjectYAML",
3752         ":Option",
3753         ":Support",
3754         ":TargetParser",
3755         ":TextAPI",
3756     ],
3759 cc_binary(
3760     name = "llvm-jitlink",
3761     srcs = glob([
3762         "tools/llvm-jitlink/*.cpp",
3763         "tools/llvm-jitlink/*.h",
3764     ]),
3765     copts = llvm_copts,
3766     # Make symbols from the standard library dynamically resolvable.
3767     linkopts = select({
3768         "@platforms//os:windows": [],
3769         "@platforms//os:macos": [],
3770         "//conditions:default": [
3771             "-Wl,--undefined=_ZTIi",
3772             "-Wl,--export-dynamic-symbol=_ZTIi",
3773             "-Wl,--export-dynamic-symbol=__cxa_begin_catch",
3774             "-Wl,--export-dynamic-symbol=__cxa_end_catch",
3775             "-Wl,--export-dynamic-symbol=__gxx_personality_v0",
3776             "-Wl,--export-dynamic-symbol=__cxa_allocate_exception",
3777             "-Wl,--export-dynamic-symbol=__cxa_throw",
3778             "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper",
3779         ],
3780     }),
3781     stamp = 0,
3782     deps = [
3783         ":AllTargetsAsmParsers",
3784         ":AllTargetsCodeGens",
3785         ":AllTargetsDisassemblers",
3786         ":AsmParser",
3787         ":BinaryFormat",
3788         ":BitReader",
3789         ":CodeGen",
3790         ":ExecutionEngine",
3791         ":MC",
3792         ":MCDisassembler",
3793         ":MCJIT",
3794         ":Object",
3795         ":OrcDebugging",
3796         ":OrcJIT",
3797         ":OrcShared",
3798         ":OrcTargetProcess",
3799         ":Support",
3800         ":TargetParser",
3801         ":config",
3802     ],
3805 gentbl(
3806     name = "LibtoolDarwinOptionsTableGen",
3807     strip_include_prefix = "tools/llvm-libtool-darwin",
3808     tbl_outs = [(
3809         "-gen-opt-parser-defs",
3810         "tools/llvm-libtool-darwin/Opts.inc",
3811     )],
3812     tblgen = ":llvm-tblgen",
3813     td_file = "tools/llvm-libtool-darwin/Opts.td",
3814     td_srcs = ["include/llvm/Option/OptParser.td"],
3817 expand_template(
3818     name = "libtool-darwin_main",
3819     out = "llvm-libtool-darwin-driver.cpp",
3820     substitutions = {
3821         "@TOOL_NAME@": "llvm_libtool_darwin",
3822     },
3823     template = "cmake/modules/llvm-driver-template.cpp.in",
3826 cc_binary(
3827     name = "llvm-libtool-darwin",
3828     srcs = glob([
3829         "tools/llvm-libtool-darwin/*.cpp",
3830         "tools/llvm-libtool-darwin/*.h",
3831     ]) + ["llvm-libtool-darwin-driver.cpp"],
3832     copts = llvm_copts,
3833     stamp = 0,
3834     deps = [
3835         ":AllTargetsAsmParsers",
3836         ":AllTargetsCodeGens",
3837         ":BinaryFormat",
3838         ":Core",
3839         ":LibtoolDarwinOptionsTableGen",
3840         ":Object",
3841         ":Option",
3842         ":Support",
3843         ":TextAPI",
3844     ],
3847 cc_binary(
3848     name = "llvm-link",
3849     srcs = glob([
3850         "tools/llvm-link/*.cpp",
3851         "tools/llvm-link/*.h",
3852     ]),
3853     copts = llvm_copts,
3854     stamp = 0,
3855     deps = [
3856         ":AsmParser",
3857         ":BinaryFormat",
3858         ":BitReader",
3859         ":BitWriter",
3860         ":Core",
3861         ":IPO",
3862         ":IRPrinter",
3863         ":IRReader",
3864         ":Linker",
3865         ":Object",
3866         ":Support",
3867         ":TransformUtils",
3868     ],
3871 gentbl(
3872     name = "LipoOptsTableGen",
3873     strip_include_prefix = "tools/llvm-lipo",
3874     tbl_outs = [(
3875         "-gen-opt-parser-defs",
3876         "tools/llvm-lipo/LipoOpts.inc",
3877     )],
3878     tblgen = ":llvm-tblgen",
3879     td_file = "tools/llvm-lipo/LipoOpts.td",
3880     td_srcs = ["include/llvm/Option/OptParser.td"],
3883 expand_template(
3884     name = "lipo_main",
3885     out = "llvm-lipo-driver.cpp",
3886     substitutions = {
3887         "@TOOL_NAME@": "llvm_lipo",
3888     },
3889     template = "cmake/modules/llvm-driver-template.cpp.in",
3892 cc_binary(
3893     name = "llvm-lipo",
3894     srcs = [
3895         "tools/llvm-lipo/llvm-lipo.cpp",
3896     ] + ["llvm-lipo-driver.cpp"],
3897     copts = llvm_copts,
3898     stamp = 0,
3899     deps = [
3900         ":AllTargetsAsmParsers",
3901         ":BinaryFormat",
3902         ":Core",
3903         ":LipoOptsTableGen",
3904         ":Object",
3905         ":Option",
3906         ":Support",
3907         ":TargetParser",
3908         ":TextAPI",
3909     ],
3912 cc_binary(
3913     name = "llvm-lto",
3914     srcs = glob([
3915         "tools/llvm-lto/*.cpp",
3916         "tools/llvm-lto/*.h",
3917     ]),
3918     copts = llvm_copts,
3919     stamp = 0,
3920     deps = [
3921         ":AllTargetsAsmParsers",
3922         ":AllTargetsCodeGens",
3923         ":BitReader",
3924         ":BitWriter",
3925         ":CodeGen",
3926         ":Core",
3927         ":IRPrinter",
3928         ":IRReader",
3929         ":LTO",
3930         ":Support",
3931         ":Target",
3932     ],
3935 cc_binary(
3936     name = "llvm-lto2",
3937     srcs = glob([
3938         "tools/llvm-lto2/*.cpp",
3939         "tools/llvm-lto2/*.h",
3940     ]),
3941     copts = llvm_copts,
3942     stamp = 0,
3943     deps = [
3944         ":AllTargetsAsmParsers",
3945         ":AllTargetsCodeGens",
3946         ":BitReader",
3947         ":CodeGen",
3948         ":Core",
3949         ":LTO",
3950         ":Passes",
3951         ":Remarks",
3952         ":Support",
3953     ],
3956 cc_binary(
3957     name = "llvm-mc",
3958     srcs = glob([
3959         "tools/llvm-mc/*.cpp",
3960         "tools/llvm-mc/*.h",
3961     ]),
3962     copts = llvm_copts,
3963     stamp = 0,
3964     deps = [
3965         ":AllTargetsAsmParsers",
3966         ":AllTargetsCodeGens",
3967         ":AllTargetsDisassemblers",
3968         ":MC",
3969         ":MCDisassembler",
3970         ":MCParser",
3971         ":Object",
3972         ":Support",
3973         ":TargetParser",
3974     ],
3977 cc_binary(
3978     name = "llvm-mca",
3979     srcs = glob([
3980         "tools/llvm-mca/*.cpp",
3981         "tools/llvm-mca/*.h",
3982         "tools/llvm-mca/Views/*.cpp",
3983         "tools/llvm-mca/Views/*.h",
3984     ]),
3985     copts = llvm_copts,
3986     stamp = 0,
3987     deps = [
3988         ":AllTargetsAsmParsers",
3989         ":AllTargetsCodeGens",
3990         ":AllTargetsDisassemblers",
3991         ":AllTargetsMCAs",
3992         ":MC",
3993         ":MCA",
3994         ":MCParser",
3995         ":Support",
3996         ":TargetParser",
3997         ":llvm-mca-headers",
3998     ],
4001 gentbl(
4002     name = "MlTableGen",
4003     strip_include_prefix = "tools/llvm-ml",
4004     tbl_outs = [(
4005         "-gen-opt-parser-defs",
4006         "tools/llvm-ml/Opts.inc",
4007     )],
4008     tblgen = ":llvm-tblgen",
4009     td_file = "tools/llvm-ml/Opts.td",
4010     td_srcs = ["include/llvm/Option/OptParser.td"],
4013 expand_template(
4014     name = "ml_main",
4015     out = "llvm-ml-driver.cpp",
4016     substitutions = {
4017         "@TOOL_NAME@": "llvm_ml",
4018     },
4019     template = "cmake/modules/llvm-driver-template.cpp.in",
4022 cc_binary(
4023     name = "llvm-ml",
4024     srcs = glob([
4025         "tools/llvm-ml/*.cpp",
4026         "tools/llvm-ml/*.h",
4027     ]) + ["llvm-ml-driver.cpp"],
4028     copts = llvm_copts,
4029     stamp = 0,
4030     deps = [
4031         ":AllTargetsAsmParsers",
4032         ":AllTargetsCodeGens",
4033         ":AllTargetsDisassemblers",
4034         ":MC",
4035         ":MCDisassembler",
4036         ":MCParser",
4037         ":MlTableGen",
4038         ":Option",
4039         ":Support",
4040         ":TargetParser",
4041     ],
4044 cc_binary(
4045     name = "llvm-modextract",
4046     srcs = glob([
4047         "tools/llvm-modextract/*.cpp",
4048     ]),
4049     copts = llvm_copts,
4050     stamp = 0,
4051     deps = [
4052         ":BitReader",
4053         ":BitWriter",
4054         ":IRPrinter",
4055         ":IRReader",
4056         ":Support",
4057     ],
4060 gentbl(
4061     name = "MtTableGen",
4062     strip_include_prefix = "tools/llvm-mt",
4063     tbl_outs = [(
4064         "-gen-opt-parser-defs",
4065         "tools/llvm-mt/Opts.inc",
4066     )],
4067     tblgen = ":llvm-tblgen",
4068     td_file = "tools/llvm-mt/Opts.td",
4069     td_srcs = ["include/llvm/Option/OptParser.td"],
4072 expand_template(
4073     name = "mt_main",
4074     out = "llvm-mt-driver.cpp",
4075     substitutions = {
4076         "@TOOL_NAME@": "llvm_mt",
4077     },
4078     template = "cmake/modules/llvm-driver-template.cpp.in",
4081 cc_binary(
4082     name = "llvm-mt",
4083     srcs = glob([
4084         "tools/llvm-mt/*.cpp",
4085         "tools/llvm-mt/*.h",
4086     ]) + ["llvm-mt-driver.cpp"],
4087     copts = llvm_copts,
4088     stamp = 0,
4089     deps = [
4090         ":MtTableGen",
4091         ":Option",
4092         ":Support",
4093         ":WindowsManifest",
4094     ],
4097 gentbl(
4098     name = "NmOptsTableGen",
4099     strip_include_prefix = "tools/llvm-nm",
4100     tbl_outs = [(
4101         "-gen-opt-parser-defs",
4102         "tools/llvm-nm/Opts.inc",
4103     )],
4104     tblgen = ":llvm-tblgen",
4105     td_file = "tools/llvm-nm/Opts.td",
4106     td_srcs = ["include/llvm/Option/OptParser.td"],
4109 expand_template(
4110     name = "nm_main",
4111     out = "llvm-nm-driver.cpp",
4112     substitutions = {
4113         "@TOOL_NAME@": "llvm_nm",
4114     },
4115     template = "cmake/modules/llvm-driver-template.cpp.in",
4118 cc_binary(
4119     name = "llvm-nm",
4120     srcs = glob([
4121         "tools/llvm-nm/*.cpp",
4122         "tools/llvm-nm/*.h",
4123     ]) + ["llvm-nm-driver.cpp"],
4124     copts = llvm_copts,
4125     stamp = 0,
4126     deps = [
4127         ":AllTargetsAsmParsers",
4128         ":AllTargetsCodeGens",
4129         ":BinaryFormat",
4130         ":BitReader",
4131         ":Core",
4132         ":Demangle",
4133         ":NmOptsTableGen",
4134         ":Object",
4135         ":Option",
4136         ":Support",
4137         ":Symbolize",
4138         ":TargetParser",
4139     ],
4142 gentbl(
4143     name = "llvm-objcopy-opts",
4144     strip_include_prefix = "tools/llvm-objcopy",
4145     tbl_outs = [(
4146         "-gen-opt-parser-defs",
4147         "tools/llvm-objcopy/ObjcopyOpts.inc",
4148     )],
4149     tblgen = ":llvm-tblgen",
4150     td_file = "tools/llvm-objcopy/ObjcopyOpts.td",
4151     td_srcs = [
4152         "include/llvm/Option/OptParser.td",
4153         "tools/llvm-objcopy/CommonOpts.td",
4154     ],
4157 gentbl(
4158     name = "llvm-installnametool-opts",
4159     strip_include_prefix = "tools/llvm-objcopy",
4160     tbl_outs = [(
4161         "-gen-opt-parser-defs",
4162         "tools/llvm-objcopy/InstallNameToolOpts.inc",
4163     )],
4164     tblgen = ":llvm-tblgen",
4165     td_file = "tools/llvm-objcopy/InstallNameToolOpts.td",
4166     td_srcs = [
4167         "include/llvm/Option/OptParser.td",
4168         "tools/llvm-objcopy/CommonOpts.td",
4169     ],
4172 gentbl(
4173     name = "llvm-strip-opts",
4174     strip_include_prefix = "tools/llvm-objcopy",
4175     tbl_outs = [(
4176         "-gen-opt-parser-defs",
4177         "tools/llvm-objcopy/StripOpts.inc",
4178     )],
4179     tblgen = ":llvm-tblgen",
4180     td_file = "tools/llvm-objcopy/StripOpts.td",
4181     td_srcs = [
4182         "include/llvm/Option/OptParser.td",
4183         "tools/llvm-objcopy/CommonOpts.td",
4184     ],
4187 gentbl(
4188     name = "llvm-bitcode-strip-opts",
4189     strip_include_prefix = "tools/llvm-objcopy",
4190     tbl_outs = [(
4191         "-gen-opt-parser-defs",
4192         "tools/llvm-objcopy/BitcodeStripOpts.inc",
4193     )],
4194     tblgen = ":llvm-tblgen",
4195     td_file = "tools/llvm-objcopy/BitcodeStripOpts.td",
4196     td_srcs = [
4197         "include/llvm/Option/OptParser.td",
4198         "tools/llvm-objcopy/CommonOpts.td",
4199     ],
4202 cc_binary(
4203     name = "llvm-stress",
4204     srcs = glob([
4205         "tools/llvm-stress/*.cpp",
4206         "tools/llvm-stress/*.h",
4207     ]),
4208     copts = llvm_copts,
4209     stamp = 0,
4210     deps = [
4211         ":Core",
4212         ":Support",
4213     ],
4216 expand_template(
4217     name = "objcopy_main",
4218     out = "llvm-objcopy-driver.cpp",
4219     substitutions = {
4220         "@TOOL_NAME@": "llvm_objcopy",
4221     },
4222     template = "cmake/modules/llvm-driver-template.cpp.in",
4225 cc_binary(
4226     name = "llvm-objcopy",
4227     srcs = glob([
4228         "tools/llvm-objcopy/*.cpp",
4229         "tools/llvm-objcopy/*.h",
4230     ]) + ["llvm-objcopy-driver.cpp"],
4231     copts = llvm_copts,
4232     stamp = 0,
4233     deps = [
4234         ":BinaryFormat",
4235         ":MC",
4236         ":ObjCopy",
4237         ":Object",
4238         ":ObjectYAML",
4239         ":Option",
4240         ":Support",
4241         ":Target",
4242         ":TargetParser",
4243         ":llvm-bitcode-strip-opts",
4244         ":llvm-installnametool-opts",
4245         ":llvm-objcopy-opts",
4246         ":llvm-strip-opts",
4247     ],
4250 binary_alias(
4251     name = "llvm-strip",
4252     binary = ":llvm-objcopy",
4255 binary_alias(
4256     name = "llvm-bitcode-strip",
4257     binary = ":llvm-objcopy",
4260 binary_alias(
4261     name = "llvm-install-name-tool",
4262     binary = ":llvm-objcopy",
4265 expand_template(
4266     name = "objdump_main",
4267     out = "llvm-objdump-driver.cpp",
4268     substitutions = {
4269         "@TOOL_NAME@": "llvm_objdump",
4270     },
4271     template = "cmake/modules/llvm-driver-template.cpp.in",
4274 cc_binary(
4275     name = "llvm-objdump",
4276     srcs = glob([
4277         "tools/llvm-objdump/*.cpp",
4278         "tools/llvm-objdump/*.h",
4279     ]) + ["llvm-objdump-driver.cpp"],
4280     copts = llvm_copts,
4281     stamp = 0,
4282     deps = [
4283         ":AllTargetsAsmParsers",
4284         ":AllTargetsCodeGens",
4285         ":AllTargetsDisassemblers",
4286         ":BinaryFormat",
4287         ":CodeGen",
4288         ":DebugInfo",
4289         ":DebugInfoDWARF",
4290         ":Debuginfod",
4291         ":Demangle",
4292         ":MC",
4293         ":MCDisassembler",
4294         ":ObjdumpOptsTableGen",
4295         ":Object",
4296         ":Option",
4297         ":OtoolOptsTableGen",
4298         ":Support",
4299         ":Symbolize",
4300         ":TargetParser",
4301         ":config",
4302     ],
4305 gentbl(
4306     name = "ObjdumpOptsTableGen",
4307     strip_include_prefix = "tools/llvm-objdump",
4308     tbl_outs = [(
4309         "-gen-opt-parser-defs",
4310         "tools/llvm-objdump/ObjdumpOpts.inc",
4311     )],
4312     tblgen = ":llvm-tblgen",
4313     td_file = "tools/llvm-objdump/ObjdumpOpts.td",
4314     td_srcs = ["include/llvm/Option/OptParser.td"],
4317 binary_alias(
4318     name = "llvm-otool",
4319     binary = ":llvm-objdump",
4322 gentbl(
4323     name = "OtoolOptsTableGen",
4324     strip_include_prefix = "tools/llvm-objdump",
4325     tbl_outs = [(
4326         "-gen-opt-parser-defs",
4327         "tools/llvm-objdump/OtoolOpts.inc",
4328     )],
4329     tblgen = ":llvm-tblgen",
4330     td_file = "tools/llvm-objdump/OtoolOpts.td",
4331     td_srcs = ["include/llvm/Option/OptParser.td"],
4334 cc_binary(
4335     name = "llvm-opt-report",
4336     srcs = glob([
4337         "tools/llvm-opt-report/*.cpp",
4338     ]),
4339     copts = llvm_copts,
4340     stamp = 0,
4341     deps = [
4342         ":AllTargetsCodeGens",
4343         ":Demangle",
4344         ":Remarks",
4345         ":Support",
4346     ],
4349 cc_binary(
4350     name = "llvm-pdbutil",
4351     srcs = glob([
4352         "tools/llvm-pdbutil/*.cpp",
4353         "tools/llvm-pdbutil/*.h",
4354     ]),
4355     copts = llvm_copts,
4356     stamp = 0,
4357     deps = [
4358         ":BinaryFormat",
4359         ":DebugInfoBTF",
4360         ":DebugInfoCodeView",
4361         ":DebugInfoMSF",
4362         ":DebugInfoPDB",
4363         ":Object",
4364         ":ObjectYAML",
4365         ":Support",
4366         ":config",
4367     ],
4370 expand_template(
4371     name = "profdata_main",
4372     out = "llvm-profdata-driver.cpp",
4373     substitutions = {
4374         "@TOOL_NAME@": "llvm_profdata",
4375     },
4376     template = "cmake/modules/llvm-driver-template.cpp.in",
4379 cc_binary(
4380     name = "llvm-profdata",
4381     srcs = glob([
4382         "tools/llvm-profdata/*.cpp",
4383         "tools/llvm-profdata/*.h",
4384     ]) + ["llvm-profdata-driver.cpp"],
4385     copts = llvm_copts,
4386     stamp = 0,
4387     deps = [
4388         ":Core",
4389         ":Object",
4390         ":ProfileData",
4391         ":Support",
4392     ],
4395 cc_binary(
4396     name = "llvm-profgen",
4397     srcs = glob([
4398         "tools/llvm-profgen/*.cpp",
4399         "tools/llvm-profgen/*.h",
4400     ]),
4401     copts = llvm_copts,
4402     stamp = 0,
4403     deps = [
4404         ":AllTargetsCodeGens",
4405         ":AllTargetsDisassemblers",
4406         ":Core",
4407         ":DebugInfoDWARF",
4408         ":Demangle",
4409         ":IPO",
4410         ":MC",
4411         ":MCDisassembler",
4412         ":Object",
4413         ":ProfileData",
4414         ":Support",
4415         ":Symbolize",
4416         ":TargetParser",
4417     ],
4420 gentbl(
4421     name = "RcTableGen",
4422     strip_include_prefix = "tools/llvm-rc",
4423     tbl_outs = [(
4424         "-gen-opt-parser-defs",
4425         "tools/llvm-rc/Opts.inc",
4426     )],
4427     tblgen = ":llvm-tblgen",
4428     td_file = "tools/llvm-rc/Opts.td",
4429     td_srcs = ["include/llvm/Option/OptParser.td"],
4432 gentbl(
4433     name = "WindresTableGen",
4434     strip_include_prefix = "tools/llvm-rc",
4435     tbl_outs = [(
4436         "-gen-opt-parser-defs",
4437         "tools/llvm-rc/WindresOpts.inc",
4438     )],
4439     tblgen = ":llvm-tblgen",
4440     td_file = "tools/llvm-rc/WindresOpts.td",
4441     td_srcs = ["include/llvm/Option/OptParser.td"],
4444 # Workaround inability to put `.def` files into `srcs` with a library.
4445 cc_library(
4446     name = "llvm-rc-defs-lib",
4447     textual_hdrs = glob(["tools/llvm-rc/*.def"]),
4450 expand_template(
4451     name = "rc_main",
4452     out = "llvm-rc-driver.cpp",
4453     substitutions = {
4454         "@TOOL_NAME@": "llvm_rc",
4455     },
4456     template = "cmake/modules/llvm-driver-template.cpp.in",
4459 cc_binary(
4460     name = "llvm-rc",
4461     srcs = glob([
4462         "tools/llvm-rc/*.cpp",
4463         "tools/llvm-rc/*.h",
4464     ]) + ["llvm-rc-driver.cpp"],
4465     copts = llvm_copts,
4466     stamp = 0,
4467     deps = [
4468         ":Object",
4469         ":Option",
4470         ":RcTableGen",
4471         ":Support",
4472         ":TargetParser",
4473         ":WindresTableGen",
4474         ":config",
4475         ":llvm-rc-defs-lib",
4476     ],
4479 binary_alias(
4480     name = "llvm-windres",
4481     binary = ":llvm-rc",
4484 gentbl(
4485     name = "ReadobjOptsTableGen",
4486     strip_include_prefix = "tools/llvm-readobj",
4487     tbl_outs = [(
4488         "-gen-opt-parser-defs",
4489         "tools/llvm-readobj/Opts.inc",
4490     )],
4491     tblgen = ":llvm-tblgen",
4492     td_file = "tools/llvm-readobj/Opts.td",
4493     td_srcs = ["include/llvm/Option/OptParser.td"],
4496 expand_template(
4497     name = "readobj_main",
4498     out = "llvm-readobj-driver.cpp",
4499     substitutions = {
4500         "@TOOL_NAME@": "llvm_readobj",
4501     },
4502     template = "cmake/modules/llvm-driver-template.cpp.in",
4505 cc_binary(
4506     name = "llvm-readobj",
4507     srcs = glob([
4508         "tools/llvm-readobj/*.cpp",
4509         "tools/llvm-readobj/*.h",
4510     ]) + ["llvm-readobj-driver.cpp"],
4511     copts = llvm_copts,
4512     stamp = 0,
4513     deps = [
4514         ":AllTargetsCodeGens",
4515         ":BinaryFormat",
4516         ":BitReader",
4517         ":DebugInfoCodeView",
4518         ":DebugInfoDWARF",
4519         ":Demangle",
4520         ":MC",
4521         ":Object",
4522         ":Option",
4523         ":ReadobjOptsTableGen",
4524         ":Support",
4525     ],
4528 # Create an 'llvm-readelf' named binary from the 'llvm-readobj' tool.
4529 binary_alias(
4530     name = "llvm-readelf",
4531     binary = ":llvm-readobj",
4534 cc_binary(
4535     name = "llvm-reduce",
4536     srcs = glob([
4537         "tools/llvm-reduce/**/*.cpp",
4538         "tools/llvm-reduce/**/*.h",
4539     ]),
4540     copts = llvm_copts,
4541     includes = ["tools/llvm-reduce"],
4542     stamp = 0,
4543     deps = [
4544         ":AllTargetsAsmParsers",
4545         ":AllTargetsCodeGens",
4546         ":Analysis",
4547         ":BitReader",
4548         ":BitWriter",
4549         ":CodeGen",
4550         ":CodeGenTypes",
4551         ":Core",
4552         ":IPO",
4553         ":IRReader",
4554         ":MC",
4555         ":Passes",
4556         ":Support",
4557         ":Target",
4558         ":TargetParser",
4559         ":TransformUtils",
4560     ],
4563 cc_binary(
4564     name = "llvm-rtdyld",
4565     srcs = glob([
4566         "tools/llvm-rtdyld/*.cpp",
4567         "tools/llvm-rtdyld/*.h",
4568     ]),
4569     copts = llvm_copts,
4570     stamp = 0,
4571     deps = [
4572         ":AllTargetsCodeGens",
4573         ":AllTargetsDisassemblers",
4574         ":DebugInfo",
4575         ":DebugInfoDWARF",
4576         ":ExecutionEngine",
4577         ":MC",
4578         ":MCDisassembler",
4579         ":Object",
4580         ":Support",
4581     ],
4584 gentbl(
4585     name = "SizeOptsTableGen",
4586     strip_include_prefix = "tools/llvm-size",
4587     tbl_outs = [(
4588         "-gen-opt-parser-defs",
4589         "tools/llvm-size/Opts.inc",
4590     )],
4591     tblgen = ":llvm-tblgen",
4592     td_file = "tools/llvm-size/Opts.td",
4593     td_srcs = ["include/llvm/Option/OptParser.td"],
4596 expand_template(
4597     name = "size_main",
4598     out = "llvm-size-driver.cpp",
4599     substitutions = {
4600         "@TOOL_NAME@": "llvm_size",
4601     },
4602     template = "cmake/modules/llvm-driver-template.cpp.in",
4605 cc_binary(
4606     name = "llvm-size",
4607     srcs = glob([
4608         "tools/llvm-size/*.cpp",
4609         "tools/llvm-size/*.h",
4610     ]) + ["llvm-size-driver.cpp"],
4611     copts = llvm_copts,
4612     stamp = 0,
4613     deps = [
4614         ":Object",
4615         ":Option",
4616         ":SizeOptsTableGen",
4617         ":Support",
4618     ],
4621 cc_binary(
4622     name = "llvm-split",
4623     srcs = glob([
4624         "tools/llvm-split/*.cpp",
4625         "tools/llvm-split/*.h",
4626     ]),
4627     copts = llvm_copts,
4628     stamp = 0,
4629     deps = [
4630         ":BitWriter",
4631         ":Core",
4632         ":IRPrinter",
4633         ":IRReader",
4634         ":Support",
4635         ":TransformUtils",
4636     ],
4639 gentbl(
4640     name = "StringsOptsTableGen",
4641     strip_include_prefix = "tools/llvm-strings",
4642     tbl_outs = [(
4643         "-gen-opt-parser-defs",
4644         "tools/llvm-strings/Opts.inc",
4645     )],
4646     tblgen = ":llvm-tblgen",
4647     td_file = "tools/llvm-strings/Opts.td",
4648     td_srcs = ["include/llvm/Option/OptParser.td"],
4651 cc_binary(
4652     name = "llvm-strings",
4653     srcs = glob([
4654         "tools/llvm-strings/*.cpp",
4655         "tools/llvm-strings/*.h",
4656     ]),
4657     copts = llvm_copts,
4658     stamp = 0,
4659     deps = [
4660         ":Object",
4661         ":Option",
4662         ":StringsOptsTableGen",
4663         ":Support",
4664     ],
4667 gentbl(
4668     name = "SymbolizerOptsTableGen",
4669     strip_include_prefix = "tools/llvm-symbolizer",
4670     tbl_outs = [(
4671         "-gen-opt-parser-defs",
4672         "tools/llvm-symbolizer/Opts.inc",
4673     )],
4674     tblgen = ":llvm-tblgen",
4675     td_file = "tools/llvm-symbolizer/Opts.td",
4676     td_srcs = ["include/llvm/Option/OptParser.td"],
4679 expand_template(
4680     name = "symbolizer_main",
4681     out = "llvm-symbolizer-driver.cpp",
4682     substitutions = {
4683         "@TOOL_NAME@": "llvm_symbolizer",
4684     },
4685     template = "cmake/modules/llvm-driver-template.cpp.in",
4688 cc_binary(
4689     name = "llvm-symbolizer",
4690     srcs = glob([
4691         "tools/llvm-symbolizer/*.cpp",
4692         "tools/llvm-symbolizer/*.h",
4693     ]) + [ "llvm-symbolizer-driver.cpp"],
4694     copts = llvm_copts,
4695     stamp = 0,
4696     deps = [
4697         ":DebugInfoDWARF",
4698         ":DebugInfoPDB",
4699         ":Debuginfod",
4700         ":Object",
4701         ":Option",
4702         ":Support",
4703         ":Symbolize",
4704         ":SymbolizerOptsTableGen",
4705         ":config",
4706     ],
4709 binary_alias(
4710     name = "llvm-addr2line",
4711     binary = ":llvm-symbolizer",
4714 cc_binary(
4715     name = "llvm-undname",
4716     srcs = glob([
4717         "tools/llvm-undname/*.cpp",
4718         "tools/llvm-undname/*.h",
4719     ]),
4720     copts = llvm_copts,
4721     stamp = 0,
4722     deps = [
4723         ":Demangle",
4724         ":Support",
4725     ],
4728 cc_binary(
4729     name = "llvm-xray",
4730     srcs = glob([
4731         "tools/llvm-xray/*.cpp",
4732         "tools/llvm-xray/*.cc",
4733         "tools/llvm-xray/*.h",
4734     ]),
4735     copts = llvm_copts,
4736     stamp = 0,
4737     deps = [
4738         ":DebugInfoDWARF",
4739         ":Object",
4740         ":Support",
4741         ":Symbolize",
4742         ":XRay",
4743     ],
4746 cc_binary(
4747     name = "opt",
4748     srcs = glob([
4749         "tools/opt/*.cpp",
4750         "tools/opt/*.h",
4751     ]),
4752     copts = llvm_copts,
4753     linkopts = select({
4754         "@platforms//os:windows": [],
4755         "@platforms//os:macos": [],
4756         "//conditions:default": ["-Wl,--export-dynamic"],
4757     }),
4758     stamp = 0,
4759     deps = [
4760         ":AllTargetsAsmParsers",
4761         ":AllTargetsCodeGens",
4762         ":Analysis",
4763         ":AsmParser",
4764         ":BitReader",
4765         ":BitWriter",
4766         ":CodeGen",
4767         ":Core",
4768         ":IPO",
4769         ":IRPrinter",
4770         ":IRReader",
4771         ":Instrumentation",
4772         ":MC",
4773         ":Passes",
4774         ":Remarks",
4775         ":Scalar",
4776         ":Support",
4777         ":Target",
4778         ":TargetParser",
4779         ":TransformUtils",
4780         ":common_transforms",
4781         ":config",
4782     ],
4785 gentbl(
4786     name = "SancovOptsTableGen",
4787     strip_include_prefix = "tools/sancov",
4788     tbl_outs = [(
4789         "-gen-opt-parser-defs",
4790         "tools/sancov/Opts.inc",
4791     )],
4792     tblgen = ":llvm-tblgen",
4793     td_file = "tools/sancov/Opts.td",
4794     td_srcs = ["include/llvm/Option/OptParser.td"],
4797 expand_template(
4798     name = "sancov_main",
4799     out = "sancov-driver.cpp",
4800     substitutions = {
4801         "@TOOL_NAME@": "sancov",
4802     },
4803     template = "cmake/modules/llvm-driver-template.cpp.in",
4807 cc_binary(
4808     name = "sancov",
4809     srcs = glob([
4810         "tools/sancov/*.cpp",
4811         "tools/sancov/*.h",
4812     ]) + ["sancov-driver.cpp"],
4813     copts = llvm_copts,
4814     stamp = 0,
4815     deps = [
4816         ":AllTargetsCodeGens",
4817         ":AllTargetsDisassemblers",
4818         ":DebugInfoDWARF",
4819         ":DebugInfoPDB",
4820         ":MC",
4821         ":MCDisassembler",
4822         ":Object",
4823         ":Option",
4824         ":SancovOptsTableGen",
4825         ":Support",
4826         ":Symbolize",
4827     ],
4830 cc_binary(
4831     name = "sanstats",
4832     srcs = glob([
4833         "tools/sanstats/*.cpp",
4834         "tools/sanstats/*.h",
4835     ]),
4836     copts = llvm_copts,
4837     stamp = 0,
4838     deps = [
4839         ":Support",
4840         ":Symbolize",
4841         ":TransformUtils",
4842     ],
4845 cc_binary(
4846     name = "split-file",
4847     srcs = glob([
4848         "utils/split-file/*.cpp",
4849         "utils/split-file/*.h",
4850     ]),
4851     copts = llvm_copts,
4852     stamp = 0,
4853     deps = [
4854         ":Support",
4855     ],
4858 ################################################################################
4859 # Begin testonly libraries
4861 cc_library(
4862     name = "FuzzMutate",
4863     testonly = True,
4864     srcs = glob(["lib/FuzzMutate/*.cpp"]),
4865     hdrs = glob(["include/llvm/FuzzMutate/*.h"]),
4866     copts = llvm_copts,
4867     includes = ["include"],
4868     deps = [
4869         ":Analysis",
4870         ":BitReader",
4871         ":BitWriter",
4872         ":Core",
4873         ":Scalar",
4874         ":Support",
4875         ":TargetParser",
4876         ":TransformUtils",
4877     ],
4880 cc_library(
4881     name = "Diff",
4882     testonly = True,
4883     srcs = glob(["tools/llvm-diff/lib/*.cpp"]),
4884     hdrs = glob(["tools/llvm-diff/lib/*.h"]),
4885     deps = [
4886         ":Core",
4887         ":Support",
4888     ],
4891 py_binary(
4892     name = "lit",
4893     testonly = True,
4894     srcs = ["utils/lit/lit.py"] + glob(["utils/lit/lit/**/*.py"]),
4897 cc_library(
4898     name = "TestingADT",
4899     testonly = True,
4900     hdrs = glob([
4901         "include/llvm/Testing/ADT/*.h",
4902     ]),
4903     copts = llvm_copts,
4904     deps = [
4905         ":Support",
4906         "//third-party/unittest:gmock",
4907     ],
4910 cc_library(
4911     name = "TestingSupport",
4912     testonly = True,
4913     srcs = glob([
4914         "lib/Testing/Support/*.cpp",
4915         "lib/Testing/Support/*.h",
4916     ]),
4917     hdrs = glob(["include/llvm/Testing/Support/*.h"]),
4918     copts = llvm_copts,
4919     deps = [
4920         ":Support",
4921         ":config",
4922         "//third-party/unittest:gmock",
4923         "//third-party/unittest:gtest",
4924     ],
4927 cc_library(
4928     name = "TestingAnnotations",
4929     testonly = True,
4930     srcs = ["lib/Testing/Annotations/Annotations.cpp"],
4931     hdrs = ["include/llvm/Testing/Annotations/Annotations.h"],
4932     copts = llvm_copts,
4933     deps = [":Support"],
4936 ################################################################################
4937 # Begin testonly binary utilities
4939 cc_binary(
4940     name = "FileCheck",
4941     testonly = True,
4942     srcs = glob([
4943         "utils/FileCheck/*.cpp",
4944         "utils/FileCheck/*.h",
4945     ]),
4946     copts = llvm_copts,
4947     stamp = 0,
4948     deps = [
4949         ":FileCheckLib",
4950         ":Support",
4951     ],
4954 cc_binary(
4955     name = "bugpoint",
4956     srcs = glob([
4957         "tools/bugpoint/*.cpp",
4958         "tools/bugpoint/*.h",
4959     ]),
4960     copts = llvm_copts,
4961     stamp = 0,
4962     deps = [
4963         ":AllTargetsAsmParsers",
4964         ":AllTargetsCodeGens",
4965         ":Analysis",
4966         ":AsmParser",
4967         ":BitReader",
4968         ":BitWriter",
4969         ":CodeGen",
4970         ":Core",
4971         ":IPO",
4972         ":IRPrinter",
4973         ":IRReader",
4974         ":Linker",
4975         ":Passes",
4976         ":Scalar",
4977         ":Support",
4978         ":TargetParser",
4979         ":TransformUtils",
4980         ":common_transforms",
4981         ":config",
4982     ],
4985 cc_binary(
4986     name = "count",
4987     testonly = True,
4988     srcs = glob([
4989         "utils/count/*.c",
4990         "utils/count/*.h",
4991     ]),
4992     stamp = 0,
4995 cc_binary(
4996     name = "lli-child-target",
4997     testonly = True,
4998     srcs = glob([
4999         "tools/lli/ChildTarget/*.cpp",
5000         "tools/lli/ChildTarget/*.h",
5001     ]),
5002     copts = llvm_copts,
5003     # The tests load code into this binary that expect to see symbols
5004     # from libstdc++ such as __cxa_begin_catch and _ZTIi. The latter
5005     # isn't even used in the main binary, so we also need to force it
5006     # to be included.
5007     linkopts = select({
5008         "@platforms//os:windows": [],
5009         "@platforms//os:macos": [],
5010         "//conditions:default": [
5011             "-rdynamic",
5012             "-u_ZTIi",
5013         ],
5014     }),
5015     stamp = 0,
5016     deps = [
5017         ":OrcJIT",
5018         ":OrcTargetProcess",
5019         ":Support",
5020         ":attributes_gen",
5021         ":config",
5022         ":intrinsic_enums_gen",
5023     ],
5026 cc_binary(
5027     name = "llvm-c-test",
5028     testonly = True,
5029     srcs = glob([
5030         "tools/llvm-c-test/*.c",
5031         "tools/llvm-c-test/*.cpp",
5032         "tools/llvm-c-test/*.h",
5033     ]),
5034     stamp = 0,
5035     deps = [
5036         ":AllTargetsAsmParsers",
5037         ":AllTargetsCodeGens",
5038         ":AllTargetsDisassemblers",
5039         ":Analysis",
5040         ":BitReader",
5041         ":BitWriter",
5042         ":Core",
5043         ":ExecutionEngine",
5044         ":IPO",
5045         ":IRReader",
5046         ":InstCombine",
5047         ":LTO",
5048         ":Linker",
5049         ":MCDisassembler",
5050         ":Object",
5051         ":OrcJIT",
5052         ":Passes",
5053         ":Remarks",
5054         ":Scalar",
5055         ":Support",
5056         ":Target",
5057         ":TransformUtils",
5058         ":Vectorize",
5059     ],
5062 cc_binary(
5063     name = "llvm-diff",
5064     testonly = True,
5065     srcs = glob([
5066         "tools/llvm-diff/*.cpp",
5067         "tools/llvm-diff/*.h",
5068     ]),
5069     copts = llvm_copts,
5070     stamp = 0,
5071     deps = [
5072         ":Core",
5073         ":Diff",
5074         ":IRPrinter",
5075         ":IRReader",
5076         ":Support",
5077     ],
5080 cc_binary(
5081     name = "llvm-isel-fuzzer",
5082     testonly = True,
5083     srcs = glob([
5084         "tools/llvm-isel-fuzzer/*.cpp",
5085         "tools/llvm-isel-fuzzer/*.h",
5086     ]),
5087     copts = llvm_copts,
5088     stamp = 0,
5089     deps = [
5090         ":AllTargetsAsmParsers",
5091         ":AllTargetsCodeGens",
5092         ":Analysis",
5093         ":BitReader",
5094         ":BitWriter",
5095         ":CodeGen",
5096         ":Core",
5097         ":FuzzMutate",
5098         ":IRPrinter",
5099         ":IRReader",
5100         ":MC",
5101         ":Support",
5102         ":Target",
5103     ],
5106 # This is really a Python script, but call it sh_binary to ignore the hyphen in
5107 # the path, which py_binary does not allow.
5108 # Also, note: llvm-locstats expects llvm-dwarfdump to be in the same directory
5109 # when executed.
5110 sh_binary(
5111     name = "llvm-locstats",
5112     testonly = True,
5113     srcs = glob([
5114         "utils/llvm-locstats/*.py",
5115     ]),
5116     # llvm-locstats is a thin wrapper around llvm-dwarfdump.
5117     data = [":llvm-dwarfdump"],
5120 sh_binary(
5121     name = "llvm-original-di-preservation",
5122     testonly = True,
5123     srcs = ["utils/llvm-original-di-preservation.py"],
5126 cc_binary(
5127     name = "not",
5128     testonly = True,
5129     srcs = glob([
5130         "utils/not/*.cpp",
5131         "utils/not/*.h",
5132     ]),
5133     copts = llvm_copts,
5134     stamp = 0,
5135     deps = [":Support"],
5138 cc_binary(
5139     name = "llvm-opt-fuzzer",
5140     testonly = True,
5141     srcs = glob([
5142         "tools/llvm-opt-fuzzer/*.cpp",
5143     ]),
5144     copts = llvm_copts,
5145     stamp = 0,
5146     deps = [
5147         ":AllTargetsCodeGens",
5148         ":Analysis",
5149         ":BitReader",
5150         ":BitWriter",
5151         ":CodeGen",
5152         ":Core",
5153         ":Coroutines",
5154         ":FuzzMutate",
5155         ":MC",
5156         ":Passes",
5157         ":Support",
5158         ":Target",
5159     ],
5162 cc_binary(
5163     name = "llvm-readtapi",
5164     testonly = True,
5165     srcs = glob([
5166         "tools/llvm-readtapi/*.cpp",
5167         "tools/llvm-readtapi/*.h",
5168     ]),
5169     copts = llvm_copts,
5170     stamp = 0,
5171     deps = [
5172         ":Object",
5173         ":Support",
5174         ":TextAPI",
5175     ],
5178 gentbl(
5179     name = "TLICheckerOptsTableGen",
5180     strip_include_prefix = "tools/llvm-tli-checker",
5181     tbl_outs = [(
5182         "-gen-opt-parser-defs",
5183         "tools/llvm-tli-checker/Opts.inc",
5184     )],
5185     tblgen = ":llvm-tblgen",
5186     td_file = "tools/llvm-tli-checker/Opts.td",
5187     td_srcs = ["include/llvm/Option/OptParser.td"],
5190 cc_binary(
5191     name = "llvm-tli-checker",
5192     testonly = True,
5193     srcs = glob([
5194         "tools/llvm-tli-checker/*.cpp",
5195         "tools/llvm-tli-checker/*.h",
5196     ]),
5197     copts = llvm_copts,
5198     stamp = 0,
5199     deps = [
5200         ":Analysis",
5201         ":BinaryFormat",
5202         ":BitReader",
5203         ":BitstreamReader",
5204         ":Core",
5205         ":Demangle",
5206         ":MC",
5207         ":MCParser",
5208         ":Object",
5209         ":Option",
5210         ":Remarks",
5211         ":Support",
5212         ":TLICheckerOptsTableGen",
5213         ":TargetParser",
5214         ":TextAPI",
5215         ":config",
5216     ],
5219 cc_binary(
5220     name = "obj2yaml",
5221     testonly = True,
5222     srcs = glob([
5223         "tools/obj2yaml/*.cpp",
5224         "tools/obj2yaml/*.h",
5225     ]),
5226     copts = llvm_copts,
5227     stamp = 0,
5228     deps = [
5229         ":BinaryFormat",
5230         ":DebugInfoCodeView",
5231         ":DebugInfoDWARF",
5232         ":Object",
5233         ":ObjectYAML",
5234         ":Support",
5235     ],
5238 cc_binary(
5239     name = "verify-uselistorder",
5240     srcs = glob([
5241         "tools/verify-uselistorder/*.cpp",
5242         "tools/verify-uselistorder/*.h",
5243     ]),
5244     copts = llvm_copts,
5245     stamp = 0,
5246     deps = [
5247         ":AsmParser",
5248         ":BitReader",
5249         ":BitWriter",
5250         ":Core",
5251         ":IRPrinter",
5252         ":IRReader",
5253         ":Support",
5254     ],
5257 cc_binary(
5258     name = "yaml2obj",
5259     testonly = True,
5260     srcs = glob([
5261         "tools/yaml2obj/*.cpp",
5262         "tools/yaml2obj/*.h",
5263     ]),
5264     copts = llvm_copts,
5265     stamp = 0,
5266     deps = [
5267         ":BinaryFormat",
5268         ":DebugInfoCodeView",
5269         ":MC",
5270         ":Object",
5271         ":ObjectYAML",
5272         ":Support",
5273     ],
5276 cc_binary(
5277     name = "yaml-bench",
5278     testonly = True,
5279     srcs = glob([
5280         "utils/yaml-bench/*.cpp",
5281     ]),
5282     copts = llvm_copts,
5283     stamp = 0,
5284     deps = [
5285         ":Support",
5286     ],