Move BlockAllocator from src/tint to src/tint/utils
Change-Id: I4bca9413d73d0095a3e0de23bcc4de956bf3b98e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82740 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
parent
d1003645cb
commit
4cb1329181
|
@ -336,7 +336,6 @@ libtint_source_set("libtint_core_all_src") {
|
|||
"ast/void.h",
|
||||
"ast/workgroup_attribute.cc",
|
||||
"ast/workgroup_attribute.h",
|
||||
"block_allocator.h",
|
||||
"builtin_table.cc",
|
||||
"builtin_table.h",
|
||||
"builtin_table.inl",
|
||||
|
@ -502,6 +501,7 @@ libtint_source_set("libtint_core_all_src") {
|
|||
"transform/wrap_arrays_in_structs.h",
|
||||
"transform/zero_init_workgroup_memory.cc",
|
||||
"transform/zero_init_workgroup_memory.h",
|
||||
"utils/block_allocator.h",
|
||||
"utils/crc32.h",
|
||||
"utils/debugger.cc",
|
||||
"utils/debugger.h",
|
||||
|
|
|
@ -225,7 +225,6 @@ set(TINT_LIB_SRCS
|
|||
ast/void.h
|
||||
ast/workgroup_attribute.cc
|
||||
ast/workgroup_attribute.h
|
||||
block_allocator.h
|
||||
builtin_table.cc
|
||||
builtin_table.h
|
||||
builtin_table.inl
|
||||
|
@ -428,6 +427,7 @@ set(TINT_LIB_SRCS
|
|||
sem/vector_type.h
|
||||
sem/void_type.cc
|
||||
sem/void_type.h
|
||||
utils/block_allocator.h
|
||||
utils/crc32.h
|
||||
utils/enum_set.h
|
||||
utils/hash.h
|
||||
|
@ -705,7 +705,6 @@ if(TINT_BUILD_TESTS)
|
|||
ast/variable_test.cc
|
||||
ast/vector_test.cc
|
||||
ast/workgroup_attribute_test.cc
|
||||
block_allocator_test.cc
|
||||
builtin_table_test.cc
|
||||
castable_test.cc
|
||||
clone_context_test.cc
|
||||
|
@ -783,6 +782,7 @@ if(TINT_BUILD_TESTS)
|
|||
text/unicode_test.cc
|
||||
traits_test.cc
|
||||
transform/transform_test.cc
|
||||
utils/block_allocator_test.cc
|
||||
utils/crc32_test.cc
|
||||
utils/defer_test.cc
|
||||
utils/enum_set_test.cc
|
||||
|
|
|
@ -27,7 +27,7 @@ struct Allocator {
|
|||
}
|
||||
|
||||
private:
|
||||
BlockAllocator<Cloneable> alloc;
|
||||
utils::BlockAllocator<Cloneable> alloc;
|
||||
};
|
||||
|
||||
struct Node : public Castable<Node, Cloneable> {
|
||||
|
|
|
@ -39,10 +39,10 @@ class Module;
|
|||
class Program {
|
||||
public:
|
||||
/// ASTNodeAllocator is an alias to BlockAllocator<ast::Node>
|
||||
using ASTNodeAllocator = BlockAllocator<ast::Node>;
|
||||
using ASTNodeAllocator = utils::BlockAllocator<ast::Node>;
|
||||
|
||||
/// SemNodeAllocator is an alias to BlockAllocator<sem::Node>
|
||||
using SemNodeAllocator = BlockAllocator<sem::Node>;
|
||||
using SemNodeAllocator = utils::BlockAllocator<sem::Node>;
|
||||
|
||||
/// Constructor
|
||||
Program();
|
||||
|
|
|
@ -149,10 +149,10 @@ class ProgramBuilder {
|
|||
|
||||
public:
|
||||
/// ASTNodeAllocator is an alias to BlockAllocator<ast::Node>
|
||||
using ASTNodeAllocator = BlockAllocator<ast::Node>;
|
||||
using ASTNodeAllocator = utils::BlockAllocator<ast::Node>;
|
||||
|
||||
/// SemNodeAllocator is an alias to BlockAllocator<sem::Node>
|
||||
using SemNodeAllocator = BlockAllocator<sem::Node>;
|
||||
using SemNodeAllocator = utils::BlockAllocator<sem::Node>;
|
||||
|
||||
/// `i32` is a type alias to `int`.
|
||||
/// Useful for passing to template methods such as `vec2<i32>()` to imitate
|
||||
|
|
|
@ -268,7 +268,7 @@ const ast::Type* Struct::Build(ProgramBuilder& b) const {
|
|||
/// The PIMPL state of the Types object.
|
||||
struct TypeManager::State {
|
||||
/// The allocator of types
|
||||
BlockAllocator<Type> allocator_;
|
||||
utils::BlockAllocator<Type> allocator_;
|
||||
/// The lazily-created Void type
|
||||
spirv::Void const* void_ = nullptr;
|
||||
/// The lazily-created Bool type
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "src/tint/ast/storage_class.h"
|
||||
#include "src/tint/ast/storage_texture.h"
|
||||
#include "src/tint/ast/texture.h"
|
||||
#include "src/tint/block_allocator.h"
|
||||
#include "src/tint/castable.h"
|
||||
#include "src/tint/utils/block_allocator.h"
|
||||
|
||||
// Forward declarations
|
||||
namespace tint {
|
||||
|
|
|
@ -702,7 +702,7 @@ struct DependencyAnalysis {
|
|||
DependencyGraph& graph_;
|
||||
|
||||
/// Allocator of Globals
|
||||
BlockAllocator<Global> allocator_;
|
||||
utils::BlockAllocator<Global> allocator_;
|
||||
|
||||
/// Global map, keyed by name. Populated by GatherGlobals().
|
||||
GlobalMap globals_;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "src/tint/block_allocator.h"
|
||||
#include "src/tint/sem/type.h"
|
||||
#include "src/tint/utils/block_allocator.h"
|
||||
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
@ -29,7 +29,7 @@ namespace sem {
|
|||
class Manager {
|
||||
public:
|
||||
/// Iterator is the type returned by begin() and end()
|
||||
using Iterator = BlockAllocator<sem::Type>::ConstIterator;
|
||||
using Iterator = utils::BlockAllocator<sem::Type>::ConstIterator;
|
||||
|
||||
/// Constructor
|
||||
Manager();
|
||||
|
@ -91,7 +91,7 @@ class Manager {
|
|||
|
||||
private:
|
||||
std::unordered_map<std::string, sem::Type*> by_name_;
|
||||
BlockAllocator<sem::Type> types_;
|
||||
utils::BlockAllocator<sem::Type> types_;
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "src/tint/ast/disable_validation_attribute.h"
|
||||
#include "src/tint/ast/type_name.h"
|
||||
#include "src/tint/ast/unary_op.h"
|
||||
#include "src/tint/block_allocator.h"
|
||||
#include "src/tint/program_builder.h"
|
||||
#include "src/tint/sem/array.h"
|
||||
#include "src/tint/sem/atomic_type.h"
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include "src/tint/sem/statement.h"
|
||||
#include "src/tint/sem/struct.h"
|
||||
#include "src/tint/sem/variable.h"
|
||||
#include "src/tint/utils/block_allocator.h"
|
||||
#include "src/tint/utils/hash.h"
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
|
@ -315,7 +315,7 @@ struct DecomposeMemoryAccess::State {
|
|||
/// List of storage or uniform buffer writes
|
||||
std::vector<Store> stores;
|
||||
/// Allocations for offsets
|
||||
BlockAllocator<Offset> offsets_;
|
||||
utils::BlockAllocator<Offset> offsets_;
|
||||
|
||||
/// Constructor
|
||||
/// @param context the CloneContext
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_TINT_BLOCK_ALLOCATOR_H_
|
||||
#define SRC_TINT_BLOCK_ALLOCATOR_H_
|
||||
#ifndef SRC_TINT_UTILS_BLOCK_ALLOCATOR_H_
|
||||
#define SRC_TINT_UTILS_BLOCK_ALLOCATOR_H_
|
||||
|
||||
#include <array>
|
||||
#include <utility>
|
||||
|
||||
#include "src/tint/utils/math.h"
|
||||
|
||||
namespace tint {
|
||||
namespace tint::utils {
|
||||
|
||||
/// A container and allocator of objects of (or deriving from) the template
|
||||
/// type `T`. Objects are allocated by calling Create(), and are owned by the
|
||||
|
@ -289,6 +289,6 @@ class BlockAllocator {
|
|||
} pointers_;
|
||||
};
|
||||
|
||||
} // namespace tint
|
||||
} // namespace tint::utils
|
||||
|
||||
#endif // SRC_TINT_BLOCK_ALLOCATOR_H_
|
||||
#endif // SRC_TINT_UTILS_BLOCK_ALLOCATOR_H_
|
|
@ -12,11 +12,11 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/tint/block_allocator.h"
|
||||
#include "src/tint/utils/block_allocator.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace tint {
|
||||
namespace tint::utils {
|
||||
namespace {
|
||||
|
||||
struct LifetimeCounter {
|
||||
|
@ -144,4 +144,4 @@ TEST_F(BlockAllocatorTest, ObjectOrder) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint
|
||||
} // namespace tint::utils
|
|
@ -701,7 +701,6 @@ tint_unittests_source_set("tint_unittests_glsl_writer_src") {
|
|||
|
||||
tint_unittests_source_set("tint_unittests_core_src") {
|
||||
sources = [
|
||||
"../../src/tint/block_allocator_test.cc",
|
||||
"../../src/tint/builtin_table_test.cc",
|
||||
"../../src/tint/castable_test.cc",
|
||||
"../../src/tint/clone_context_test.cc",
|
||||
|
@ -714,6 +713,7 @@ tint_unittests_source_set("tint_unittests_core_src") {
|
|||
"../../src/tint/symbol_table_test.cc",
|
||||
"../../src/tint/symbol_test.cc",
|
||||
"../../src/tint/traits_test.cc",
|
||||
"../../src/tint/utils/block_allocator_test.cc",
|
||||
]
|
||||
|
||||
deps = [ ":tint_unittests_ast_src" ]
|
||||
|
|
Loading…
Reference in New Issue