mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Rename semantic to sem
* Rename namespace semantic to sem * Rename directory src/semantic/ to src/sem/ Bug: tint:724 Change-Id: I76383b821fbca7f1037a803c497b595a706dcb06 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48120 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
26cd48603d
commit
5cd71b8c0a
@@ -17,7 +17,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/variable.h"
|
||||
#include "src/type/access_control_type.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper::Remappings);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/expression.h"
|
||||
#include "src/sem/expression.h"
|
||||
|
||||
namespace tint {
|
||||
namespace transform {
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
#include "src/ast/call_statement.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/call.h"
|
||||
#include "src/semantic/statement.h"
|
||||
#include "src/semantic/struct.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/statement.h"
|
||||
#include "src/sem/struct.h"
|
||||
#include "src/sem/variable.h"
|
||||
#include "src/utils/get_or_create.h"
|
||||
#include "src/utils/hash.h"
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
/// It is used as a key by the array_length_by_usage map.
|
||||
struct ArrayUsage {
|
||||
ast::BlockStatement const* const block;
|
||||
semantic::Node const* const buffer;
|
||||
sem::Node const* const buffer;
|
||||
bool operator==(const ArrayUsage& rhs) const {
|
||||
return block == rhs.block && buffer == rhs.buffer;
|
||||
}
|
||||
@@ -110,8 +110,8 @@ Output CalculateArrayLength::Run(const Program* in, const DataMap&) {
|
||||
for (auto* node : ctx.src->ASTNodes().Objects()) {
|
||||
if (auto* call_expr = node->As<ast::CallExpression>()) {
|
||||
auto* call = sem.Get(call_expr);
|
||||
if (auto* intrinsic = call->Target()->As<semantic::Intrinsic>()) {
|
||||
if (intrinsic->Type() == semantic::IntrinsicType::kArrayLength) {
|
||||
if (auto* intrinsic = call->Target()->As<sem::Intrinsic>()) {
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kArrayLength) {
|
||||
// We're dealing with an arrayLength() call
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/wgsl.html#array-types states:
|
||||
@@ -163,8 +163,8 @@ Output CalculateArrayLength::Run(const Program* in, const DataMap&) {
|
||||
// true) then key the array_length from the variable. If not, key off
|
||||
// the expression semantic node, which will be unique per call to
|
||||
// arrayLength().
|
||||
const semantic::Node* storage_buffer_usage = storage_buffer_sem;
|
||||
if (auto* user = storage_buffer_sem->As<semantic::VariableUser>()) {
|
||||
const sem::Node* storage_buffer_usage = storage_buffer_sem;
|
||||
if (auto* user = storage_buffer_sem->As<sem::VariableUser>()) {
|
||||
storage_buffer_usage = user->Variable();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include <utility>
|
||||
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/function.h"
|
||||
#include "src/semantic/statement.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/function.h"
|
||||
#include "src/sem/statement.h"
|
||||
#include "src/sem/variable.h"
|
||||
|
||||
namespace tint {
|
||||
namespace transform {
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "src/ast/call_statement.h"
|
||||
#include "src/ast/scalar_constructor_expression.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/array.h"
|
||||
#include "src/semantic/call.h"
|
||||
#include "src/semantic/member_accessor_expression.h"
|
||||
#include "src/semantic/struct.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/array.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/member_accessor_expression.h"
|
||||
#include "src/sem/struct.h"
|
||||
#include "src/sem/variable.h"
|
||||
#include "src/type/access_control_type.h"
|
||||
#include "src/utils/get_or_create.h"
|
||||
#include "src/utils/hash.h"
|
||||
@@ -356,7 +356,7 @@ type::Type* UnwrapPtrAndAlias(type::Type* ty) {
|
||||
|
||||
/// StorageBufferAccess describes a single storage buffer access
|
||||
struct StorageBufferAccess {
|
||||
semantic::Expression const* var = nullptr; // Storage buffer variable
|
||||
sem::Expression const* var = nullptr; // Storage buffer variable
|
||||
std::unique_ptr<Offset> offset; // The byte offset on var
|
||||
type::Type* type = nullptr; // The type of the access
|
||||
operator bool() const { return var; } // Returns true if valid
|
||||
@@ -628,7 +628,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
|
||||
if (auto* ident = node->As<ast::IdentifierExpression>()) {
|
||||
// X
|
||||
auto* expr = sem.Get(ident);
|
||||
if (auto* var = expr->As<semantic::VariableUser>()) {
|
||||
if (auto* var = expr->As<sem::VariableUser>()) {
|
||||
if (var->Variable()->StorageClass() == ast::StorageClass::kStorage) {
|
||||
// Variable to a storage buffer
|
||||
state.AddAccesss(ident, {
|
||||
@@ -644,7 +644,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
|
||||
if (auto* accessor = node->As<ast::MemberAccessorExpression>()) {
|
||||
// X.Y
|
||||
auto* accessor_sem = sem.Get(accessor);
|
||||
if (auto* swizzle = accessor_sem->As<semantic::Swizzle>()) {
|
||||
if (auto* swizzle = accessor_sem->As<sem::Swizzle>()) {
|
||||
if (swizzle->Indices().size() == 1) {
|
||||
if (auto access = state.TakeAccess(accessor->structure())) {
|
||||
auto* vec_ty = access.type->As<type::Vector>();
|
||||
@@ -724,8 +724,8 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
|
||||
|
||||
if (auto* call_expr = node->As<ast::CallExpression>()) {
|
||||
auto* call = sem.Get(call_expr);
|
||||
if (auto* intrinsic = call->Target()->As<semantic::Intrinsic>()) {
|
||||
if (intrinsic->Type() == semantic::IntrinsicType::kArrayLength) {
|
||||
if (auto* intrinsic = call->Target()->As<sem::Intrinsic>()) {
|
||||
if (intrinsic->Type() == sem::IntrinsicType::kArrayLength) {
|
||||
// arrayLength(X)
|
||||
// Don't convert X into a load, this actually requires the real
|
||||
// reference.
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
#include "src/ast/struct_block_decoration.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/function.h"
|
||||
#include "src/semantic/member_accessor_expression.h"
|
||||
#include "src/semantic/struct.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/function.h"
|
||||
#include "src/sem/member_accessor_expression.h"
|
||||
#include "src/sem/struct.h"
|
||||
#include "src/sem/variable.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset::BindingPoint);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset::Data);
|
||||
@@ -73,9 +73,8 @@ Output FirstIndexOffset::Run(const Program* in, const DataMap& data) {
|
||||
CloneContext ctx(&out, in);
|
||||
|
||||
// Map of builtin usages
|
||||
std::unordered_map<const semantic::Variable*, const char*> builtin_vars;
|
||||
std::unordered_map<const semantic::StructMember*, const char*>
|
||||
builtin_members;
|
||||
std::unordered_map<const sem::Variable*, const char*> builtin_vars;
|
||||
std::unordered_map<const sem::StructMember*, const char*> builtin_members;
|
||||
|
||||
bool has_vertex_index = false;
|
||||
bool has_instance_index = false;
|
||||
@@ -153,14 +152,14 @@ Output FirstIndexOffset::Run(const Program* in, const DataMap& data) {
|
||||
// Fix up all references to the builtins with the offsets
|
||||
ctx.ReplaceAll([=, &ctx](ast::Expression* expr) -> ast::Expression* {
|
||||
auto* sem = ctx.src->Sem().Get(expr);
|
||||
if (auto* user = sem->As<semantic::VariableUser>()) {
|
||||
if (auto* user = sem->As<sem::VariableUser>()) {
|
||||
auto it = builtin_vars.find(user->Variable());
|
||||
if (it != builtin_vars.end()) {
|
||||
return ctx.dst->Add(ctx.CloneWithoutTransform(expr),
|
||||
ctx.dst->MemberAccessor(buffer_name, it->second));
|
||||
}
|
||||
}
|
||||
if (auto* access = sem->As<semantic::StructMemberAccess>()) {
|
||||
if (auto* access = sem->As<sem::StructMemberAccess>()) {
|
||||
auto it = builtin_members.find(access->Member());
|
||||
if (it != builtin_members.end()) {
|
||||
return ctx.dst->Add(ctx.CloneWithoutTransform(expr),
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "src/ast/stage_decoration.h"
|
||||
#include "src/ast/variable_decl_statement.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/expression.h"
|
||||
#include "src/semantic/statement.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/expression.h"
|
||||
#include "src/sem/statement.h"
|
||||
#include "src/sem/variable.h"
|
||||
#include "src/transform/calculate_array_length.h"
|
||||
#include "src/transform/canonicalize_entry_point_io.h"
|
||||
#include "src/transform/decompose_storage_access.h"
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <utility>
|
||||
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/call.h"
|
||||
#include "src/semantic/member_accessor_expression.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/member_accessor_expression.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::Renamer::Data);
|
||||
|
||||
@@ -861,7 +861,7 @@ Output Renamer::Run(const Program* in, const DataMap&) {
|
||||
<< "MemberAccessorExpression has no semantic info";
|
||||
continue;
|
||||
}
|
||||
if (sem->Is<semantic::Swizzle>()) {
|
||||
if (sem->Is<sem::Swizzle>()) {
|
||||
preserve.emplace(member->member());
|
||||
}
|
||||
} else if (auto* call = node->As<ast::CallExpression>()) {
|
||||
@@ -870,7 +870,7 @@ Output Renamer::Run(const Program* in, const DataMap&) {
|
||||
TINT_ICE(out.Diagnostics()) << "CallExpression has no semantic info";
|
||||
continue;
|
||||
}
|
||||
if (sem->Target()->Is<semantic::Intrinsic>()) {
|
||||
if (sem->Target()->Is<sem::Intrinsic>()) {
|
||||
preserve.emplace(call->func()->As<ast::IdentifierExpression>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#include "src/ast/return_statement.h"
|
||||
#include "src/ast/stage_decoration.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/function.h"
|
||||
#include "src/semantic/statement.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/function.h"
|
||||
#include "src/sem/statement.h"
|
||||
#include "src/sem/variable.h"
|
||||
|
||||
namespace tint {
|
||||
namespace transform {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "src/ast/struct_block_decoration.h"
|
||||
#include "src/ast/variable_decl_statement.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/sem/variable.h"
|
||||
#include "src/utils/get_or_create.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::VertexPulling::Config);
|
||||
|
||||
Reference in New Issue
Block a user