From 0d757d2fad1bdc682f794455b90828c2b3fe7193 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 1 Jun 2022 20:34:40 +0000 Subject: [PATCH] tint/resolver: Enable abstract-numerics Turn on resolving of abstract-integer and abstract-float types, as well as materialization to their concrete types. Bug: tint:1504 Bug: chromium:1330805 Fixed: tint:1572 Change-Id: I09c95406e11b64bb0267fe7b1ed08af986dbd553 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91840 Commit-Queue: Ben Clayton Reviewed-by: David Neto Reviewed-by: Dan Sinclair --- src/tint/resolver/resolver.cc | 13 ++++--------- src/tint/resolver/resolver.h | 7 +------ src/tint/resolver/resolver_test_helper.cc | 3 +-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc index aa09cfa158..74710ac695 100644 --- a/src/tint/resolver/resolver.cc +++ b/src/tint/resolver/resolver.cc @@ -85,13 +85,12 @@ namespace tint::resolver { -Resolver::Resolver(ProgramBuilder* builder, bool enable_abstract_numerics) +Resolver::Resolver(ProgramBuilder* builder) : builder_(builder), diagnostics_(builder->Diagnostics()), intrinsic_table_(IntrinsicTable::Create(*builder)), sem_(builder, dependencies_), - validator_(builder, sem_), - enable_abstract_numerics_(enable_abstract_numerics) {} + validator_(builder, sem_) {} Resolver::~Resolver() = default; @@ -1632,10 +1631,7 @@ sem::Expression* Resolver::Literal(const ast::LiteralExpression* literal) { [&](const ast::IntLiteralExpression* i) -> sem::Type* { switch (i->suffix) { case ast::IntLiteralExpression::Suffix::kNone: - if (enable_abstract_numerics_) { - return builder_->create(); - } - return builder_->create(); + return builder_->create(); case ast::IntLiteralExpression::Suffix::kI: return builder_->create(); case ast::IntLiteralExpression::Suffix::kU: @@ -1644,8 +1640,7 @@ sem::Expression* Resolver::Literal(const ast::LiteralExpression* literal) { return nullptr; }, [&](const ast::FloatLiteralExpression* f) -> sem::Type* { - if (f->suffix == ast::FloatLiteralExpression::Suffix::kNone && - enable_abstract_numerics_) { + if (f->suffix == ast::FloatLiteralExpression::Suffix::kNone) { return builder_->create(); } return builder_->create(); diff --git a/src/tint/resolver/resolver.h b/src/tint/resolver/resolver.h index 9072ef3b32..99996517d7 100644 --- a/src/tint/resolver/resolver.h +++ b/src/tint/resolver/resolver.h @@ -76,10 +76,7 @@ class Resolver { public: /// Constructor /// @param builder the program builder - /// @param enable_abstract_numerics if true, then treat unsuffixed integers as abstract integers - /// and unsuffixed floats as abstract floats. This is a temporary flag while abstract numerics - /// are being developed. Once complete, this will be permanently enabled. - explicit Resolver(ProgramBuilder* builder, bool enable_abstract_numerics = false); + explicit Resolver(ProgramBuilder* builder); /// Destructor ~Resolver(); @@ -399,8 +396,6 @@ class Resolver { sem::Statement* current_statement_ = nullptr; sem::CompoundStatement* current_compound_statement_ = nullptr; sem::BlockStatement* current_block_ = nullptr; - - bool enable_abstract_numerics_ = false; }; } // namespace tint::resolver diff --git a/src/tint/resolver/resolver_test_helper.cc b/src/tint/resolver/resolver_test_helper.cc index 75a66982ae..dd590d9261 100644 --- a/src/tint/resolver/resolver_test_helper.cc +++ b/src/tint/resolver/resolver_test_helper.cc @@ -18,8 +18,7 @@ namespace tint::resolver { -TestHelper::TestHelper() - : resolver_(std::make_unique(this, /* enable_abstract_numerics */ true)) {} +TestHelper::TestHelper() : resolver_(std::make_unique(this)) {} TestHelper::~TestHelper() = default;