BUILD 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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/cc_rules:defs.bzl", "cc_library", "cc_test")
  5. load("llvm_tools.bzl", "LLVM_MAIN_TOOLS", "generate_llvm_tools_def")
  6. package(default_visibility = ["//visibility:public"])
  7. cc_library(
  8. name = "for_each_macro",
  9. hdrs = ["for_each_macro.h"],
  10. deps = [
  11. "@llvm-project//llvm:Support",
  12. ],
  13. )
  14. cc_library(
  15. name = "index_base",
  16. hdrs = ["index_base.h"],
  17. deps = [
  18. "//common:ostream",
  19. "@llvm-project//llvm:Support",
  20. ],
  21. )
  22. cc_library(
  23. name = "kind_switch",
  24. hdrs = ["kind_switch.h"],
  25. deps = [
  26. ":for_each_macro",
  27. "@llvm-project//llvm:Support",
  28. ],
  29. )
  30. cc_test(
  31. name = "kind_switch_test",
  32. size = "small",
  33. srcs = ["kind_switch_test.cpp"],
  34. deps = [
  35. ":kind_switch",
  36. "//common:raw_string_ostream",
  37. "//testing/base:gtest_main",
  38. "@googletest//:gtest",
  39. ],
  40. )
  41. cc_library(
  42. name = "pretty_stack_trace_function",
  43. hdrs = ["pretty_stack_trace_function.h"],
  44. deps = [
  45. "@llvm-project//llvm:Support",
  46. ],
  47. )
  48. cc_library(
  49. name = "mem_usage",
  50. hdrs = ["mem_usage.h"],
  51. deps = [
  52. ":yaml",
  53. "//common:map",
  54. "//common:set",
  55. "@llvm-project//llvm:Support",
  56. ],
  57. )
  58. cc_library(
  59. name = "timings",
  60. hdrs = ["timings.h"],
  61. deps = [
  62. ":yaml",
  63. "@llvm-project//llvm:Support",
  64. ],
  65. )
  66. cc_library(
  67. name = "value_ids",
  68. hdrs = ["value_ids.h"],
  69. deps = [
  70. ":index_base",
  71. "//common:check",
  72. "//common:ostream",
  73. "@llvm-project//llvm:Support",
  74. ],
  75. )
  76. cc_library(
  77. name = "fixed_size_value_store",
  78. hdrs = ["fixed_size_value_store.h"],
  79. deps = [
  80. ":mem_usage",
  81. ":value_store",
  82. "//common:check",
  83. "//common:move_only",
  84. "@llvm-project//llvm:Support",
  85. ],
  86. )
  87. cc_library(
  88. name = "value_store",
  89. hdrs = [
  90. "value_store.h",
  91. "value_store_chunk.h",
  92. ],
  93. deps = [
  94. ":mem_usage",
  95. ":yaml",
  96. "//common:check",
  97. "//common:hashtable_key_context",
  98. "//common:ostream",
  99. "//common:set",
  100. "@llvm-project//llvm:Support",
  101. ],
  102. )
  103. cc_test(
  104. name = "value_store_test",
  105. size = "small",
  106. srcs = ["value_store_test.cpp"],
  107. deps = [
  108. ":value_ids",
  109. ":value_store",
  110. "//common:raw_string_ostream",
  111. "//testing/base:gtest_main",
  112. "//toolchain/testing:yaml_test_helpers",
  113. "@googletest//:gtest",
  114. ],
  115. )
  116. cc_library(
  117. name = "int",
  118. srcs = ["int.cpp"],
  119. hdrs = ["int.h"],
  120. deps = [
  121. ":index_base",
  122. ":mem_usage",
  123. ":value_store",
  124. ":yaml",
  125. "//common:check",
  126. "//common:hashtable_key_context",
  127. "//common:ostream",
  128. "//common:set",
  129. "@llvm-project//llvm:Support",
  130. ],
  131. )
  132. cc_test(
  133. name = "int_test",
  134. size = "small",
  135. srcs = ["int_test.cpp"],
  136. deps = [
  137. ":int",
  138. "//common:raw_string_ostream",
  139. "//testing/base:gtest_main",
  140. "//toolchain/testing:yaml_test_helpers",
  141. "@googletest//:gtest",
  142. ],
  143. )
  144. generate_llvm_tools_def(
  145. name = "llvm_tools_def",
  146. out = "llvm_tools.def",
  147. )
  148. config_setting(
  149. name = "is_macos",
  150. constraint_values = ["@platforms//os:macos"],
  151. )
  152. cc_library(
  153. name = "llvm_tools",
  154. srcs = ["llvm_tools.cpp"],
  155. hdrs = ["llvm_tools.h"],
  156. linkopts = select({
  157. # TODO: This should be moved upstream to LLVM's tool libraries that
  158. # require it.
  159. ":is_macos": [
  160. "-framework",
  161. "CoreFoundation",
  162. ],
  163. "//conditions:default": [],
  164. }),
  165. deps = [
  166. ":llvm_tools_def",
  167. "//common:command_line",
  168. "//common:enum_base",
  169. "@llvm-project//llvm:Support",
  170. ] + [info.lib for info in LLVM_MAIN_TOOLS.values()],
  171. )
  172. cc_library(
  173. name = "shared_value_stores",
  174. hdrs = ["shared_value_stores.h"],
  175. deps = [
  176. ":int",
  177. ":mem_usage",
  178. ":value_ids",
  179. ":value_store",
  180. ":yaml",
  181. ],
  182. )
  183. cc_test(
  184. name = "shared_value_stores_test",
  185. size = "small",
  186. srcs = ["shared_value_stores_test.cpp"],
  187. deps = [
  188. ":shared_value_stores",
  189. "//common:raw_string_ostream",
  190. "//testing/base:gtest_main",
  191. "//toolchain/testing:yaml_test_helpers",
  192. "@googletest//:gtest",
  193. ],
  194. )
  195. cc_library(
  196. name = "yaml",
  197. hdrs = ["yaml.h"],
  198. deps = [
  199. "//common:check",
  200. "//common:ostream",
  201. "@llvm-project//llvm:Support",
  202. ],
  203. )