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