BUILD 5.4 KB

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