BUILD 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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", "cc_test")
  5. package(default_visibility = ["//visibility:public"])
  6. cc_library(
  7. name = "block_value_store",
  8. hdrs = ["block_value_store.h"],
  9. deps = [
  10. "//common:hashing",
  11. "//common:set",
  12. "//toolchain/base:value_store",
  13. "//toolchain/base:yaml",
  14. "@llvm-project//llvm:Support",
  15. ],
  16. )
  17. cc_library(
  18. name = "typed_insts",
  19. srcs = [
  20. "ids.cpp",
  21. "inst_kind.cpp",
  22. ],
  23. hdrs = [
  24. "id_kind.h",
  25. "ids.h",
  26. "inst_kind.h",
  27. "singleton_insts.h",
  28. "typed_insts.h",
  29. ],
  30. textual_hdrs = ["inst_kind.def"],
  31. deps = [
  32. "//common:check",
  33. "//common:enum_base",
  34. "//common:ostream",
  35. "//toolchain/base:index_base",
  36. "//toolchain/base:int",
  37. "//toolchain/base:value_ids",
  38. "//toolchain/diagnostics:diagnostic_emitter",
  39. "//toolchain/parse:node_kind",
  40. "@llvm-project//llvm:Support",
  41. ],
  42. )
  43. cc_library(
  44. name = "inst",
  45. srcs = ["inst.cpp"],
  46. hdrs = ["inst.h"],
  47. deps = [
  48. ":block_value_store",
  49. ":typed_insts",
  50. "//common:check",
  51. "//common:hashing",
  52. "//common:ostream",
  53. "//common:struct_reflection",
  54. "//toolchain/base:index_base",
  55. "//toolchain/base:int",
  56. "//toolchain/base:value_store",
  57. "@llvm-project//llvm:Support",
  58. ],
  59. )
  60. cc_library(
  61. name = "file",
  62. srcs = [
  63. "builtin_function_kind.cpp",
  64. "class.cpp",
  65. "constant.cpp",
  66. "facet_type_info.cpp",
  67. "file.cpp",
  68. "function.cpp",
  69. "generic.cpp",
  70. "impl.cpp",
  71. "name.cpp",
  72. "name_scope.cpp",
  73. "type.cpp",
  74. "type_info.cpp",
  75. ],
  76. hdrs = [
  77. "builtin_function_kind.h",
  78. "class.h",
  79. "constant.h",
  80. "copy_on_write_block.h",
  81. "entity_name.h",
  82. "entity_with_params_base.h",
  83. "facet_type_info.h",
  84. "file.h",
  85. "function.h",
  86. "generic.h",
  87. "impl.h",
  88. "import_ir.h",
  89. "interface.h",
  90. "name.h",
  91. "name_scope.h",
  92. "struct_type_field.h",
  93. "type.h",
  94. "type_info.h",
  95. ],
  96. textual_hdrs = [
  97. "builtin_function_kind.def",
  98. ],
  99. deps = [
  100. ":block_value_store",
  101. ":inst",
  102. ":typed_insts",
  103. "//common:check",
  104. "//common:enum_base",
  105. "//common:error",
  106. "//common:hashing",
  107. "//common:map",
  108. "//common:ostream",
  109. "//common:set",
  110. "//toolchain/base:int",
  111. "//toolchain/base:kind_switch",
  112. "//toolchain/base:shared_value_stores",
  113. "//toolchain/base:value_ids",
  114. "//toolchain/base:value_store",
  115. "//toolchain/base:yaml",
  116. "//toolchain/lex:token_kind",
  117. "//toolchain/parse:node_kind",
  118. "//toolchain/parse:tree",
  119. "@llvm-project//llvm:Support",
  120. ],
  121. )
  122. cc_library(
  123. name = "stringify_type",
  124. srcs = ["stringify_type.cpp"],
  125. hdrs = ["stringify_type.h"],
  126. deps = [
  127. ":file",
  128. ":typed_insts",
  129. "//common:check",
  130. "//toolchain/base:kind_switch",
  131. "@llvm-project//llvm:Support",
  132. ],
  133. )
  134. cc_library(
  135. name = "inst_namer",
  136. srcs = [
  137. "inst_fingerprinter.cpp",
  138. "inst_namer.cpp",
  139. ],
  140. hdrs = [
  141. "inst_fingerprinter.h",
  142. "inst_namer.h",
  143. ],
  144. deps = [
  145. ":file",
  146. ":typed_insts",
  147. "//common:ostream",
  148. "//toolchain/base:kind_switch",
  149. "//toolchain/base:shared_value_stores",
  150. "//toolchain/base:value_ids",
  151. "//toolchain/lex:tokenized_buffer",
  152. "//toolchain/parse:tree",
  153. "@llvm-project//llvm:Support",
  154. ],
  155. )
  156. cc_library(
  157. name = "formatter",
  158. srcs = ["formatter.cpp"],
  159. hdrs = ["formatter.h"],
  160. deps = [
  161. ":file",
  162. ":inst_namer",
  163. ":typed_insts",
  164. "//common:ostream",
  165. "//toolchain/base:kind_switch",
  166. "//toolchain/base:shared_value_stores",
  167. "//toolchain/lex:tokenized_buffer",
  168. "//toolchain/parse:tree",
  169. "@llvm-project//llvm:Support",
  170. ],
  171. )
  172. cc_library(
  173. name = "entry_point",
  174. srcs = ["entry_point.cpp"],
  175. hdrs = ["entry_point.h"],
  176. deps = [
  177. ":file",
  178. "@llvm-project//llvm:Support",
  179. ],
  180. )
  181. cc_library(
  182. name = "dump",
  183. srcs = ["dump.cpp"],
  184. hdrs = ["dump.h"],
  185. deps = [
  186. ":file",
  187. ":stringify_type",
  188. "//common:ostream",
  189. ],
  190. # Always link dump methods so they are callable from a debugger
  191. # even though they are never called.
  192. alwayslink = 1,
  193. )
  194. cc_test(
  195. name = "name_scope_test",
  196. size = "small",
  197. srcs = ["name_scope_test.cpp"],
  198. deps = [
  199. ":file",
  200. "//testing/base:gtest_main",
  201. "@googletest//:gtest",
  202. ],
  203. )
  204. cc_test(
  205. name = "typed_insts_test",
  206. size = "small",
  207. srcs = ["typed_insts_test.cpp"],
  208. deps = [
  209. ":inst",
  210. ":typed_insts",
  211. "//testing/base:gtest_main",
  212. "@googletest//:gtest",
  213. ],
  214. )
  215. cc_test(
  216. name = "yaml_test",
  217. size = "small",
  218. srcs = ["yaml_test.cpp"],
  219. deps = [
  220. "//common:ostream",
  221. "//testing/base:global_exe_path",
  222. "//testing/base:gtest_main",
  223. "//testing/base:test_raw_ostream",
  224. "//toolchain/driver",
  225. "//toolchain/testing:yaml_test_helpers",
  226. "@googletest//:gtest",
  227. "@llvm-project//llvm:Support",
  228. ],
  229. )