Remove sem::Alias

With the parsers now using ast::Types, nothing should be producing these any more.

This change also removes Resolver::Canonical(), which is now unneeded as there are no sem::Aliases to remove.

Bug: tint:724
Change-Id: I0c1a49f49372c1fcc37864502f07c5c76328d471
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50304
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-05-10 17:38:01 +00:00
committed by Commit Bot service account
parent cbbe576415
commit a34fa0ecb7
63 changed files with 143 additions and 661 deletions

View File

@@ -194,7 +194,7 @@ Output CanonicalizeEntryPointIO::Run(const Program* in, const DataMap&) {
}
// Handle return type.
auto* ret_type = func->ReturnType()->UnwrapAliasIfNeeded();
auto* ret_type = func->ReturnType();
std::function<ast::Type*()> new_ret_type;
if (ret_type->Is<sem::Void>()) {
new_ret_type = [&ctx] { return ctx.dst->ty.void_(); };

View File

@@ -349,11 +349,6 @@ const ast::NamedType* ConstructedTypeOf(const sem::Type* ty) {
}
}
/// @returns the given type with all pointers and aliases removed.
const sem::Type* UnwrapPtrAndAlias(const sem::Type* ty) {
return ty->UnwrapPtrIfNeeded()->UnwrapAliasIfNeeded()->UnwrapPtrIfNeeded();
}
/// StorageBufferAccess describes a single storage buffer access
struct StorageBufferAccess {
sem::Expression const* var = nullptr; // Storage buffer variable
@@ -751,7 +746,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
auto* buf = access.var->Declaration();
auto* offset = access.offset->Build(ctx);
auto* buf_ty = UnwrapPtrAndAlias(access.var->Type());
auto* buf_ty = access.var->Type()->UnwrapPtrIfNeeded();
auto* el_ty = access.type->UnwrapAll();
auto* insert_after = ConstructedTypeOf(access.var->Type());
Symbol func = state.LoadFunc(ctx, insert_after, buf_ty, el_ty);
@@ -765,7 +760,7 @@ Output DecomposeStorageAccess::Run(const Program* in, const DataMap&) {
for (auto& store : state.stores) {
auto* buf = store.target.var->Declaration();
auto* offset = store.target.offset->Build(ctx);
auto* buf_ty = UnwrapPtrAndAlias(store.target.var->Type());
auto* buf_ty = store.target.var->Type()->UnwrapPtrIfNeeded();
auto* el_ty = store.target.type->UnwrapAll();
auto* value = store.assignment->rhs();
auto* insert_after = ConstructedTypeOf(store.target.var->Type());

View File

@@ -107,9 +107,6 @@ ast::Type* Transform::CreateASTTypeFor(CloneContext* ctx, const sem::Type* ty) {
auto* el = CreateASTTypeFor(ctx, ac->type());
return ctx->dst->create<ast::AccessControl>(ac->access_control(), el);
}
if (auto* a = ty->As<sem::Alias>()) {
return ctx->dst->create<ast::TypeName>(ctx->Clone(a->symbol()));
}
if (auto* s = ty->As<sem::Struct>()) {
return ctx->dst->create<ast::TypeName>(
ctx->Clone(s->Declaration()->name()));