sem: Rename Vector::size() to Vector::Width()

`Size()` will be added which is the size of the type in bytes.

Change-Id: If997820d7859cd9d1bb0631d1b72150378e6a24b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59300
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2021-07-22 18:31:34 +00:00
committed by Tint LUCI CQ
parent 4261466a84
commit f5ed2ba906
23 changed files with 147 additions and 146 deletions

View File

@@ -153,7 +153,7 @@ bool IntrinsicDataTypeFor(const sem::Type* ty,
return true;
}
if (auto* vec = ty->As<sem::Vector>()) {
switch (vec->size()) {
switch (vec->Width()) {
case 2:
if (vec->type()->Is<sem::I32>()) {
out = DecomposeMemoryAccess::Intrinsic::DataType::kVec2I32;

View File

@@ -56,7 +56,7 @@ void FoldConstants::Run(CloneContext& ctx, const DataMap&, DataMap&) {
}
if (auto* vec = ty->As<sem::Vector>()) {
uint32_t vec_size = static_cast<uint32_t>(vec->size());
uint32_t vec_size = static_cast<uint32_t>(vec->Width());
// We'd like to construct the new vector with the same number of
// constructor args that the original node had, but after folding

View File

@@ -63,7 +63,7 @@ struct Robustness::State {
Value size; // size of the array, vector or matrix
size.is_signed = false; // size is always unsigned
if (auto* vec = ret_type->As<sem::Vector>()) {
size.u32 = vec->size();
size.u32 = vec->Width();
} else if (auto* arr = ret_type->As<sem::Array>()) {
size.u32 = arr->Count();

View File

@@ -124,7 +124,7 @@ ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const sem::Type* ty) {
}
if (auto* v = ty->As<sem::Vector>()) {
auto* el = CreateASTTypeFor(ctx, v->type());
return ctx.dst->create<ast::Vector>(el, v->size());
return ctx.dst->create<ast::Vector>(el, v->Width());
}
if (auto* a = ty->As<sem::Array>()) {
auto* el = CreateASTTypeFor(ctx, a->ElemType());

View File

@@ -148,7 +148,7 @@ DataType DataTypeOf(sem::Type* ty) {
return {BaseType::kF32, 1};
}
if (auto* vec = ty->As<sem::Vector>()) {
return {DataTypeOf(vec->type()).base_type, vec->size()};
return {DataTypeOf(vec->type()).base_type, vec->Width()};
}
return {BaseType::kInvalid, 0};
}