BUILD 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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:entry_point",
  40. "//toolchain/sem_ir:file",
  41. "//toolchain/sem_ir:inst",
  42. "//toolchain/sem_ir:inst_kind",
  43. "@llvm-project//llvm:Core",
  44. "@llvm-project//llvm:Support",
  45. ],
  46. )
  47. glob_sh_run(
  48. args = [
  49. "$(location //toolchain/driver:carbon)",
  50. "compile",
  51. "--phase=lower",
  52. "--dump-llvm-ir",
  53. ],
  54. data = ["//toolchain/driver:carbon"],
  55. file_exts = ["carbon"],
  56. )
  57. glob_sh_run(
  58. args = [
  59. "$(location //toolchain/driver:carbon)",
  60. "-v",
  61. "compile",
  62. "--phase=lower",
  63. ],
  64. data = ["//toolchain/driver:carbon"],
  65. file_exts = ["carbon"],
  66. run_ext = "verbose",
  67. )