BUILD 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. ] +
  24. # Glob handler files to avoid missing any.
  25. glob([
  26. "lowering_handle*.cpp",
  27. ]),
  28. hdrs = [
  29. "lowering_context.h",
  30. "lowering_function_context.h",
  31. ],
  32. deps = [
  33. "//common:check",
  34. "//common:vlog",
  35. "//toolchain/semantics:semantics_ir",
  36. "//toolchain/semantics:semantics_node",
  37. "//toolchain/semantics:semantics_node_kind",
  38. "@llvm-project//llvm:Core",
  39. "@llvm-project//llvm:Support",
  40. ],
  41. )
  42. file_test(
  43. name = "lowering_file_test",
  44. srcs = ["lowering_file_test.cpp"],
  45. tests = glob(["testdata/**/*.carbon"]),
  46. deps = [
  47. "//toolchain/driver:driver_file_test_base",
  48. "@llvm-project//llvm:Support",
  49. ],
  50. )
  51. glob_sh_run(
  52. args = [
  53. "$(location //toolchain/driver:carbon)",
  54. "dump",
  55. "llvm-ir",
  56. ],
  57. data = ["//toolchain/driver:carbon"],
  58. file_exts = ["carbon"],
  59. )
  60. glob_sh_run(
  61. args = [
  62. "$(location //toolchain/driver:carbon)",
  63. "-v",
  64. "dump",
  65. "llvm-ir",
  66. ],
  67. data = ["//toolchain/driver:carbon"],
  68. file_exts = ["carbon"],
  69. run_ext = "verbose",
  70. )