ast: Rename 'array accessor' to 'index accessor'

This cleans up the remnants of ArrayAccessorExpression which was renamed
in a838bb718.

Change-Id: Ie2c67a49e63774d8b153ec17c3185652708a91e5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68942
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-11-10 19:23:07 +00:00
committed by Ben Clayton
parent 8bc1a3045d
commit 6595b386b5
28 changed files with 123 additions and 123 deletions

View File

@@ -852,7 +852,7 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) {
}
if (auto* accessor = node->As<ast::IndexAccessorExpression>()) {
if (auto access = state.TakeAccess(accessor->array)) {
if (auto access = state.TakeAccess(accessor->object)) {
// X[Y]
if (auto* arr = access.type->As<sem::Array>()) {
auto* offset = state.Mul(arr->Stride(), accessor->index);

View File

@@ -147,10 +147,10 @@ void DecomposeStridedMatrix::Run(CloneContext& ctx, const DataMap&, DataMap&) {
ctx.ReplaceAll([&](const ast::IndexAccessorExpression* expr)
-> const ast::IndexAccessorExpression* {
if (auto* access =
ctx.src->Sem().Get<sem::StructMemberAccess>(expr->array)) {
ctx.src->Sem().Get<sem::StructMemberAccess>(expr->object)) {
auto it = decomposed.find(access->Member()->Declaration());
if (it != decomposed.end()) {
auto* obj = ctx.CloneWithoutTransform(expr->array);
auto* obj = ctx.CloneWithoutTransform(expr->object);
auto* idx = ctx.Clone(expr->index);
return ctx.dst->IndexAccessor(obj, idx);
}

View File

@@ -44,7 +44,7 @@ void CollectSavedArrayIndices(const Program* program,
const ast::Expression* expr,
F&& cb) {
if (auto* a = expr->As<ast::IndexAccessorExpression>()) {
CollectSavedArrayIndices(program, a->array, cb);
CollectSavedArrayIndices(program, a->object, cb);
if (!a->index->Is<ast::Literal>()) {
cb(a->index);
@@ -160,7 +160,7 @@ void InlinePointerLets::Run(CloneContext& ctx, const DataMap&, DataMap&) {
ctx.dst->Const(saved_name, nullptr, ctx.Clone(idx_expr)));
// Place this variable after the pointer typed let. Order here is
// important as order-of-operations needs to be preserved.
// CollectSavedArrayIndices() visits the LHS of an array accessor
// CollectSavedArrayIndices() visits the LHS of an index accessor
// before the index expression.
// Note that repeated calls to InsertAfter() with the same `after`
// argument will result in nodes to inserted in the order the calls

View File

@@ -114,11 +114,11 @@ void PadArrayElements::Run(CloneContext& ctx, const DataMap&, DataMap&) {
return nullptr;
});
// Fix up array accessors so `a[1]` becomes `a[1].el`
// Fix up index accessors so `a[1]` becomes `a[1].el`
ctx.ReplaceAll([&](const ast::IndexAccessorExpression* accessor)
-> const ast::Expression* {
if (auto* array = tint::As<sem::Array>(
sem.Get(accessor->array)->Type()->UnwrapRef())) {
sem.Get(accessor->object)->Type()->UnwrapRef())) {
if (pad(array)) {
// Array element is wrapped in a structure. Emit a member accessor
// to get to the actual array element.

View File

@@ -54,7 +54,7 @@ struct Robustness::State {
/// cloned without changes.
const ast::IndexAccessorExpression* Transform(
const ast::IndexAccessorExpression* expr) {
auto* ret_type = ctx.src->Sem().Get(expr->array)->Type();
auto* ret_type = ctx.src->Sem().Get(expr->object)->Type();
auto* ref = ret_type->As<sem::Reference>();
if (ref && omitted_classes.count(ref->StorageClass()) != 0) {
@@ -83,7 +83,7 @@ struct Robustness::State {
} else if (auto* arr = ret_unwrapped->As<sem::Array>()) {
size.u32 = arr->Count();
} else if (auto* mat = ret_unwrapped->As<sem::Matrix>()) {
// The row accessor would have been an embedded array accessor and already
// The row accessor would have been an embedded index accessor and already
// handled, so we just need to do columns here.
size.u32 = mat->columns();
} else {
@@ -97,7 +97,7 @@ struct Robustness::State {
return nullptr;
}
// Runtime sized array
auto* arr = ctx.Clone(expr->array);
auto* arr = ctx.Clone(expr->object);
size.expr = b.Call("arrayLength", b.AddressOf(arr));
}
@@ -196,8 +196,8 @@ struct Robustness::State {
// Clone arguments outside of create() call to have deterministic ordering
auto src = ctx.Clone(expr->source);
auto* arr = ctx.Clone(expr->array);
return b.IndexAccessor(src, arr, idx.expr);
auto* obj = ctx.Clone(expr->object);
return b.IndexAccessor(src, obj, idx.expr);
}
/// @param type intrinsic type

View File

@@ -56,15 +56,15 @@ void WrapArraysInStructs::Run(CloneContext& ctx, const DataMap&, DataMap&) {
return nullptr;
});
// Fix up array accessors so `a[1]` becomes `a.arr[1]`
// Fix up index accessors so `a[1]` becomes `a.arr[1]`
ctx.ReplaceAll([&](const ast::IndexAccessorExpression* accessor)
-> const ast::IndexAccessorExpression* {
if (auto* array = ::tint::As<sem::Array>(
sem.Get(accessor->array)->Type()->UnwrapRef())) {
sem.Get(accessor->object)->Type()->UnwrapRef())) {
if (wrapper(array)) {
// Array is wrapped in a structure. Emit a member accessor to get
// to the actual array.
auto* arr = ctx.Clone(accessor->array);
auto* arr = ctx.Clone(accessor->object);
auto* idx = ctx.Clone(accessor->index);
auto* unwrapped = ctx.dst->MemberAccessor(arr, "arr");
return ctx.dst->IndexAccessor(accessor->source, unwrapped, idx);