Debian Codegraph @

llvm-project/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel

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