BUILD 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("//bazel/sh_run:rules.bzl", "glob_sh_run")
  5. load("//testing/file_test:rules.bzl", "file_test")
  6. package(default_visibility = ["//visibility:public"])
  7. cc_library(
  8. name = "lower_to_llvm",
  9. srcs = ["lower_to_llvm.cpp"],
  10. hdrs = ["lower_to_llvm.h"],
  11. deps = [
  12. ":lowering_context",
  13. "//toolchain/semantics:semantics_ir",
  14. "@llvm-project//llvm:Core",
  15. "@llvm-project//llvm:Support",
  16. ],
  17. )
  18. cc_library(
  19. name = "lowering_context",
  20. srcs = [
  21. "lowering_context.cpp",
  22. "lowering_function_context.cpp",
  23. "lowering_handle.cpp",
  24. ],
  25. hdrs = [
  26. "lowering_block_worklist.h",
  27. "lowering_context.h",
  28. "lowering_function_context.h",
  29. ],
  30. deps = [
  31. "//common:check",
  32. "//common:vlog",
  33. "//toolchain/semantics:semantics_ir",
  34. "//toolchain/semantics:semantics_node",
  35. "//toolchain/semantics:semantics_node_kind",
  36. "@llvm-project//llvm:Core",
  37. "@llvm-project//llvm:Support",
  38. ],
  39. )
  40. file_test(
  41. name = "lowering_file_test",
  42. srcs = ["lowering_file_test.cpp"],
  43. tests = glob(["testdata/**/*.carbon"]),
  44. deps = [
  45. "//toolchain/driver:driver_file_test_base",
  46. "@llvm-project//llvm:Support",
  47. ],
  48. )
  49. glob_sh_run(
  50. args = [
  51. "$(location //toolchain/driver:carbon)",
  52. "dump",
  53. "llvm-ir",
  54. ],
  55. data = ["//toolchain/driver:carbon"],
  56. file_exts = ["carbon"],
  57. )
  58. glob_sh_run(
  59. args = [
  60. "$(location //toolchain/driver:carbon)",
  61. "-v",
  62. "dump",
  63. "llvm-ir",
  64. ],
  65. data = ["//toolchain/driver:carbon"],
  66. file_exts = ["carbon"],
  67. run_ext = "verbose",
  68. )