BUILD 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_handle.cpp",
  23. ],
  24. hdrs = ["lowering_context.h"],
  25. deps = [
  26. "//common:check",
  27. "//common:vlog",
  28. "//toolchain/semantics:semantics_ir",
  29. "//toolchain/semantics:semantics_node",
  30. "//toolchain/semantics:semantics_node_kind",
  31. "@llvm-project//llvm:Core",
  32. "@llvm-project//llvm:Support",
  33. ],
  34. )
  35. file_test(
  36. name = "lowering_file_test",
  37. srcs = ["lowering_file_test.cpp"],
  38. tests = glob(["testdata/**/*.carbon"]),
  39. deps = [
  40. "//testing/file_test:file_test_base",
  41. "//toolchain/driver",
  42. "@com_google_googletest//:gtest",
  43. "@llvm-project//llvm:Support",
  44. ],
  45. )
  46. glob_sh_run(
  47. args = [
  48. "$(location //toolchain/driver:carbon)",
  49. "dump",
  50. "llvm-ir",
  51. ],
  52. data = ["//toolchain/driver:carbon"],
  53. file_exts = ["carbon"],
  54. )
  55. glob_sh_run(
  56. args = [
  57. "$(location //toolchain/driver:carbon)",
  58. "-v",
  59. "dump",
  60. "llvm-ir",
  61. ],
  62. data = ["//toolchain/driver:carbon"],
  63. file_exts = ["carbon"],
  64. run_ext = "verbose",
  65. )