BUILD 5.7 KB

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