BUILD 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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("@rules_cc//cc:defs.bzl", "cc_library")
  5. load("//bazel/sh_run:rules.bzl", "glob_sh_run")
  6. package(default_visibility = ["//visibility:public"])
  7. filegroup(
  8. name = "testdata",
  9. data = glob(["testdata/**/*.carbon"]),
  10. )
  11. cc_library(
  12. name = "lower",
  13. srcs = ["lower.cpp"],
  14. hdrs = ["lower.h"],
  15. deps = [
  16. ":context",
  17. "//toolchain/sem_ir:file",
  18. "@llvm-project//llvm:Core",
  19. "@llvm-project//llvm:Support",
  20. ],
  21. )
  22. cc_library(
  23. name = "context",
  24. srcs = [
  25. "file_context.cpp",
  26. "function_context.cpp",
  27. ] +
  28. # Glob handler files to avoid missing any.
  29. glob([
  30. "handle*.cpp",
  31. ]),
  32. hdrs = [
  33. "file_context.h",
  34. "function_context.h",
  35. ],
  36. deps = [
  37. "//common:check",
  38. "//common:vlog",
  39. "//toolchain/sem_ir:file",
  40. "//toolchain/sem_ir:node",
  41. "//toolchain/sem_ir:node_kind",
  42. "@llvm-project//llvm:Core",
  43. "@llvm-project//llvm:Support",
  44. ],
  45. )
  46. glob_sh_run(
  47. args = [
  48. "$(location //toolchain/driver:carbon)",
  49. "compile",
  50. "--phase=lower",
  51. "--dump-llvm-ir",
  52. ],
  53. data = ["//toolchain/driver:carbon"],
  54. file_exts = ["carbon"],
  55. )
  56. glob_sh_run(
  57. args = [
  58. "$(location //toolchain/driver:carbon)",
  59. "-v",
  60. "compile",
  61. "--phase=lower",
  62. ],
  63. data = ["//toolchain/driver:carbon"],
  64. file_exts = ["carbon"],
  65. run_ext = "verbose",
  66. )