BUILD 5.7 KB

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