tint/writer: Minor generator cleanup.
No-op change. Change-Id: Ic5057bbacea09c6ed57d4f735a18d6c1040f1f5f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94332 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
01e4d44e1e
commit
3a68ab4a17
|
@ -388,11 +388,10 @@ bool GeneratorImpl::EmitBitcast(std::ostream& out, const ast::BitcastExpression*
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out << "(";
|
ScopedParen sp(out);
|
||||||
if (!EmitExpression(out, expr->expr)) {
|
if (!EmitExpression(out, expr->expr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +431,7 @@ bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExp
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
out << "(";
|
ScopedParen sp(out);
|
||||||
if (!EmitExpression(out, expr->lhs)) {
|
if (!EmitExpression(out, expr->lhs)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +439,6 @@ bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExp
|
||||||
if (!EmitExpression(out, expr->rhs)) {
|
if (!EmitExpression(out, expr->rhs)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +592,7 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e
|
||||||
return EmitFloatModulo(out, expr);
|
return EmitFloatModulo(out, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
out << "(";
|
ScopedParen sp(out);
|
||||||
if (!EmitExpression(out, expr->lhs)) {
|
if (!EmitExpression(out, expr->lhs)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -670,7 +668,6 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +727,8 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out, const sem::Call* call) {
|
||||||
auto name = builder_.Symbols().NameFor(ident->symbol);
|
auto name = builder_.Symbols().NameFor(ident->symbol);
|
||||||
auto caller_sym = ident->symbol;
|
auto caller_sym = ident->symbol;
|
||||||
|
|
||||||
out << name << "(";
|
out << name;
|
||||||
|
ScopedParen sp(out);
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto* arg : args) {
|
for (auto* arg : args) {
|
||||||
|
@ -744,7 +742,6 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out, const sem::Call* call) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,7 +806,8 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << name << "(";
|
out << name;
|
||||||
|
ScopedParen sp(out);
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto* arg : call->Arguments()) {
|
for (auto* arg : call->Arguments()) {
|
||||||
|
@ -823,7 +821,6 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,13 +830,12 @@ bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
||||||
if (!EmitType(out, conv->Target(), ast::StorageClass::kNone, ast::Access::kReadWrite, "")) {
|
if (!EmitType(out, conv->Target(), ast::StorageClass::kNone, ast::Access::kReadWrite, "")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << "(";
|
ScopedParen sp(out);
|
||||||
|
|
||||||
if (!EmitExpression(out, call->Arguments()[0]->Declaration())) {
|
if (!EmitExpression(out, call->Arguments()[0]->Declaration())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1183,7 +1179,9 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << fn << "(";
|
out << fn;
|
||||||
|
ScopedParen sp(out);
|
||||||
|
|
||||||
if (!EmitExpression(out, expr->args[0])) {
|
if (!EmitExpression(out, expr->args[0])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1191,7 +1189,6 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out,
|
||||||
if (!EmitExpression(out, expr->args[1])) {
|
if (!EmitExpression(out, expr->args[1])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << ")";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2352,7 +2349,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool first = true;
|
bool first = true;
|
||||||
out << "(";
|
ScopedParen sp(out);
|
||||||
for (auto* member : str->Members()) {
|
for (auto* member : str->Members()) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
out << ", ";
|
out << ", ";
|
||||||
|
@ -2361,19 +2358,17 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) {
|
||||||
}
|
}
|
||||||
EmitZeroValue(out, member->Type());
|
EmitZeroValue(out, member->Type());
|
||||||
}
|
}
|
||||||
out << ")";
|
|
||||||
} else if (auto* array = type->As<sem::Array>()) {
|
} else if (auto* array = type->As<sem::Array>()) {
|
||||||
if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, "")) {
|
if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, "")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << "(";
|
ScopedParen sp(out);
|
||||||
for (uint32_t i = 0; i < array->Count(); i++) {
|
for (uint32_t i = 0; i < array->Count(); i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
out << ", ";
|
out << ", ";
|
||||||
}
|
}
|
||||||
EmitZeroValue(out, array->ElemType());
|
EmitZeroValue(out, array->ElemType());
|
||||||
}
|
}
|
||||||
out << ")";
|
|
||||||
} else {
|
} else {
|
||||||
diagnostics_.add_error(diag::System::Writer, "Invalid type for zero emission: " +
|
diagnostics_.add_error(diag::System::Writer, "Invalid type for zero emission: " +
|
||||||
type->FriendlyName(builder_.Symbols()));
|
type->FriendlyName(builder_.Symbols()));
|
||||||
|
@ -2925,14 +2920,12 @@ bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression*
|
||||||
out << "-";
|
out << "-";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
out << "(";
|
|
||||||
|
|
||||||
|
ScopedParen sp(out);
|
||||||
if (!EmitExpression(out, expr->expr)) {
|
if (!EmitExpression(out, expr->expr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << ")";
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3709,9 +3709,8 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
||||||
while (auto* arr = base_type->As<sem::Array>()) {
|
while (auto* arr = base_type->As<sem::Array>()) {
|
||||||
if (arr->IsRuntimeSized()) {
|
if (arr->IsRuntimeSized()) {
|
||||||
TINT_ICE(Writer, diagnostics_)
|
TINT_ICE(Writer, diagnostics_)
|
||||||
<< "Runtime arrays may only exist in storage buffers, which "
|
<< "Runtime arrays may only exist in storage buffers, which should have "
|
||||||
"should "
|
"been transformed into a ByteAddressBuffer";
|
||||||
"have been transformed into a ByteAddressBuffer";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sizes.push_back(arr->Count());
|
sizes.push_back(arr->Count());
|
||||||
|
|
Loading…
Reference in New Issue