Browse Source

Move BlockValueStore from sem_ir to base (#5779)

The other generic `ValueStore` types are in base; this is for
consistency, to make it easier to find. I think it's only in sem_ir for
historical reasons, since it was probably the first bespoke ValueStore
variant added.
Jon Ross-Perkins 9 months ago
parent
commit
d64ec883d5

+ 14 - 0
toolchain/base/BUILD

@@ -7,6 +7,20 @@ load("llvm_tools.bzl", "LLVM_MAIN_TOOLS", "generate_llvm_tools_def")
 
 package(default_visibility = ["//visibility:public"])
 
+cc_library(
+    name = "block_value_store",
+    hdrs = ["block_value_store.h"],
+    deps = [
+        ":mem_usage",
+        ":value_store",
+        ":yaml",
+        "//common:check",
+        "//common:hashing",
+        "//common:set",
+        "@llvm-project//llvm:Support",
+    ],
+)
+
 cc_library(
     name = "canonical_value_store",
     hdrs = ["canonical_value_store.h"],

+ 3 - 3
toolchain/sem_ir/block_value_store.h → toolchain/base/block_value_store.h

@@ -2,8 +2,8 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#ifndef CARBON_TOOLCHAIN_SEM_IR_BLOCK_VALUE_STORE_H_
-#define CARBON_TOOLCHAIN_SEM_IR_BLOCK_VALUE_STORE_H_
+#ifndef CARBON_TOOLCHAIN_BASE_BLOCK_VALUE_STORE_H_
+#define CARBON_TOOLCHAIN_BASE_BLOCK_VALUE_STORE_H_
 
 #include <type_traits>
 
@@ -150,4 +150,4 @@ class BlockValueStore<IdT, ElementT>::KeyContext
 
 }  // namespace Carbon::SemIR
 
-#endif  // CARBON_TOOLCHAIN_SEM_IR_BLOCK_VALUE_STORE_H_
+#endif  // CARBON_TOOLCHAIN_BASE_BLOCK_VALUE_STORE_H_

+ 1 - 15
toolchain/sem_ir/BUILD

@@ -6,20 +6,6 @@ load("//bazel/cc_rules:defs.bzl", "cc_library", "cc_test")
 
 package(default_visibility = ["//visibility:public"])
 
-cc_library(
-    name = "block_value_store",
-    hdrs = ["block_value_store.h"],
-    deps = [
-        "//common:check",
-        "//common:hashing",
-        "//common:set",
-        "//toolchain/base:mem_usage",
-        "//toolchain/base:value_store",
-        "//toolchain/base:yaml",
-        "@llvm-project//llvm:Support",
-    ],
-)
-
 cc_library(
     name = "typed_insts",
     srcs = [
@@ -124,7 +110,6 @@ cc_library(
         "builtin_function_kind.def",
     ],
     deps = [
-        ":block_value_store",
         ":clang_decl",
         ":typed_insts",
         "//common:check",
@@ -136,6 +121,7 @@ cc_library(
         "//common:raw_string_ostream",
         "//common:set",
         "//common:struct_reflection",
+        "//toolchain/base:block_value_store",
         "//toolchain/base:canonical_value_store",
         "//toolchain/base:index_base",
         "//toolchain/base:int",

+ 1 - 1
toolchain/sem_ir/inst.h

@@ -13,10 +13,10 @@
 #include "common/ostream.h"
 #include "common/raw_string_ostream.h"
 #include "common/struct_reflection.h"
+#include "toolchain/base/block_value_store.h"
 #include "toolchain/base/index_base.h"
 #include "toolchain/base/int.h"
 #include "toolchain/base/value_store.h"
-#include "toolchain/sem_ir/block_value_store.h"
 #include "toolchain/sem_ir/id_kind.h"
 #include "toolchain/sem_ir/inst_kind.h"
 #include "toolchain/sem_ir/singleton_insts.h"

+ 1 - 1
toolchain/sem_ir/struct_type_field.h

@@ -5,7 +5,7 @@
 #ifndef CARBON_TOOLCHAIN_SEM_IR_STRUCT_TYPE_FIELD_H_
 #define CARBON_TOOLCHAIN_SEM_IR_STRUCT_TYPE_FIELD_H_
 
-#include "toolchain/sem_ir/block_value_store.h"
+#include "toolchain/base/block_value_store.h"
 #include "toolchain/sem_ir/ids.h"
 
 namespace Carbon::SemIR {