Rename 'constructed types' to 'type declarartions'

Change-Id: I0c79be17a10a542df602447e555c1344621d2dce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53803
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-06-09 14:32:14 +00:00
parent 8758f10a20
commit 950809f534
36 changed files with 141 additions and 148 deletions

View File

@@ -75,7 +75,7 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap& data) {
// Strip entry point IO decorations from struct declarations.
// TODO(jrprice): This code is duplicated with the SPIR-V transform.
for (auto* ty : ctx.src->AST().ConstructedTypes()) {
for (auto* ty : ctx.src->AST().TypeDecls()) {
if (auto* struct_ty = ty->As<ast::Struct>()) {
// Build new list of struct members without entry point IO decorations.
ast::StructMemberList new_struct_members;

View File

@@ -331,8 +331,8 @@ void InsertGlobal(CloneContext& ctx,
}
}
/// @returns the unwrapped, user-declared constructed type of ty.
const ast::TypeDecl* ConstructedTypeOf(const sem::Type* ty) {
/// @returns the unwrapped, user-declared type of ty.
const ast::TypeDecl* TypeDeclOf(const sem::Type* ty) {
while (true) {
if (auto* ref = ty->As<sem::Reference>()) {
ty = ref->StoreType();
@@ -341,7 +341,7 @@ const ast::TypeDecl* ConstructedTypeOf(const sem::Type* ty) {
if (auto* str = ty->As<sem::Struct>()) {
return str->Declaration();
}
// Not a constructed type
// Not a declared type
return nullptr;
}
}
@@ -762,7 +762,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
auto* offset = access.offset->Build(ctx);
auto* buf_ty = access.var->Type()->UnwrapRef();
auto* el_ty = access.type->UnwrapRef();
auto* insert_after = ConstructedTypeOf(access.var->Type());
auto* insert_after = TypeDeclOf(access.var->Type());
Symbol func = state.LoadFunc(ctx, insert_after, buf_ty, el_ty,
access.var->As<sem::VariableUser>());
@@ -778,7 +778,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
auto* buf_ty = store.target.var->Type()->UnwrapRef();
auto* el_ty = store.target.type->UnwrapRef();
auto* value = store.assignment->rhs();
auto* insert_after = ConstructedTypeOf(store.target.var->Type());
auto* insert_after = TypeDeclOf(store.target.var->Type());
Symbol func = state.StoreFunc(ctx, insert_after, buf_ty, el_ty,
store.target.var->As<sem::VariableUser>());

View File

@@ -71,7 +71,7 @@ Output SingleEntryPoint::Run(const Program* in, const DataMap& data) {
for (auto* decl : in->AST().GlobalDeclarations()) {
if (auto* ty = decl->As<ast::TypeDecl>()) {
// TODO(jrprice): Strip unused types.
out.AST().AddConstructedType(ctx.Clone(ty));
out.AST().AddTypeDecl(ctx.Clone(ty));
} else if (auto* var = decl->As<ast::Variable>()) {
if (var->is_const() || referenced_vars.count(var)) {
out.AST().AddGlobalVariable(ctx.Clone(var));

View File

@@ -127,7 +127,7 @@ void Spirv::HandleEntryPointIOTypes(CloneContext& ctx) const {
// ```
// Strip entry point IO decorations from struct declarations.
for (auto* ty : ctx.src->AST().ConstructedTypes()) {
for (auto* ty : ctx.src->AST().TypeDecls()) {
if (auto* struct_ty = ty->As<ast::Struct>()) {
// Build new list of struct members without entry point IO decorations.
ast::StructMemberList new_struct_members;