[tint][sem] Store OverloadInfo on BuiltinFn

This replaces the bool flags derived from the builtin info.

Change-Id: I631e5e4f7f9fea2a26a3fd64207838de7152e932
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/174821
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc
index 76b9ff9..29d313d 100644
--- a/src/tint/lang/wgsl/resolver/resolver.cc
+++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -2415,9 +2415,8 @@
         }
         auto eval_stage = overload->const_eval_fn ? core::EvaluationStage::kConstant
                                                   : core::EvaluationStage::kRuntime;
-        return b.create<sem::BuiltinFn>(
-            fn, overload->return_type, std::move(params), eval_stage, supported_stages,
-            flags.Contains(OverloadFlag::kIsDeprecated), flags.Contains(OverloadFlag::kMustUse));
+        return b.create<sem::BuiltinFn>(fn, overload->return_type, std::move(params), eval_stage,
+                                        supported_stages, *overload->info);
     });
 
     if (fn == wgsl::BuiltinFn::kTintMaterialize) {
diff --git a/src/tint/lang/wgsl/sem/BUILD.bazel b/src/tint/lang/wgsl/sem/BUILD.bazel
index 75399ed..37b8323 100644
--- a/src/tint/lang/wgsl/sem/BUILD.bazel
+++ b/src/tint/lang/wgsl/sem/BUILD.bazel
@@ -113,6 +113,7 @@
     "//src/tint/api/common",
     "//src/tint/lang/core",
     "//src/tint/lang/core/constant",
+    "//src/tint/lang/core/intrinsic",
     "//src/tint/lang/core/type",
     "//src/tint/lang/wgsl",
     "//src/tint/lang/wgsl/ast",
diff --git a/src/tint/lang/wgsl/sem/BUILD.cmake b/src/tint/lang/wgsl/sem/BUILD.cmake
index eba7340..6120b90 100644
--- a/src/tint/lang/wgsl/sem/BUILD.cmake
+++ b/src/tint/lang/wgsl/sem/BUILD.cmake
@@ -112,6 +112,7 @@
   tint_api_common
   tint_lang_core
   tint_lang_core_constant
+  tint_lang_core_intrinsic
   tint_lang_core_type
   tint_lang_wgsl
   tint_lang_wgsl_ast
diff --git a/src/tint/lang/wgsl/sem/BUILD.gn b/src/tint/lang/wgsl/sem/BUILD.gn
index 715f3a6..e6b2b06 100644
--- a/src/tint/lang/wgsl/sem/BUILD.gn
+++ b/src/tint/lang/wgsl/sem/BUILD.gn
@@ -116,6 +116,7 @@
     "${tint_src_dir}/api/common",
     "${tint_src_dir}/lang/core",
     "${tint_src_dir}/lang/core/constant",
+    "${tint_src_dir}/lang/core/intrinsic",
     "${tint_src_dir}/lang/core/type",
     "${tint_src_dir}/lang/wgsl",
     "${tint_src_dir}/lang/wgsl/ast",
diff --git a/src/tint/lang/wgsl/sem/builtin_fn.cc b/src/tint/lang/wgsl/sem/builtin_fn.cc
index 0e48dfc..b0218eb 100644
--- a/src/tint/lang/wgsl/sem/builtin_fn.cc
+++ b/src/tint/lang/wgsl/sem/builtin_fn.cc
@@ -33,6 +33,7 @@
 #include <utility>
 #include <vector>
 
+#include "src/tint/lang/core/intrinsic/table.h"
 #include "src/tint/utils/containers/transform.h"
 
 TINT_INSTANTIATE_TYPEINFO(tint::sem::BuiltinFn);
@@ -48,15 +49,21 @@
                      VectorRef<Parameter*> parameters,
                      core::EvaluationStage eval_stage,
                      PipelineStageSet supported_stages,
-                     bool is_deprecated,
-                     bool must_use)
-    : Base(return_type, std::move(parameters), eval_stage, must_use),
+                     const core::intrinsic::OverloadInfo& overload)
+    : Base(return_type,
+           std::move(parameters),
+           eval_stage,
+           overload.flags.Contains(core::intrinsic::OverloadFlag::kMustUse)),
       fn_(type),
       supported_stages_(supported_stages),
-      is_deprecated_(is_deprecated) {}
+      overload_(overload) {}
 
 BuiltinFn::~BuiltinFn() = default;
 
+bool BuiltinFn::IsDeprecated() const {
+    return overload_.flags.Contains(core::intrinsic::OverloadFlag::kIsDeprecated);
+}
+
 bool BuiltinFn::IsCoarseDerivative() const {
     return wgsl::IsCoarseDerivative(fn_);
 }
diff --git a/src/tint/lang/wgsl/sem/builtin_fn.h b/src/tint/lang/wgsl/sem/builtin_fn.h
index bcac245..18684cc 100644
--- a/src/tint/lang/wgsl/sem/builtin_fn.h
+++ b/src/tint/lang/wgsl/sem/builtin_fn.h
@@ -38,6 +38,11 @@
 #include "src/tint/lang/wgsl/sem/pipeline_stage_set.h"
 #include "src/tint/utils/math/hash.h"
 
+// Forward declarations
+namespace tint::core::intrinsic {
+struct OverloadInfo;
+}
+
 namespace tint::sem {
 
 /// BuiltinFn holds the semantic information for a builtin function.
@@ -49,15 +54,13 @@
     /// @param parameters the parameters for the builtin overload
     /// @param eval_stage the earliest evaluation stage for a call to the builtin
     /// @param supported_stages the pipeline stages that this builtin can be used in
-    /// @param is_deprecated true if the particular overload is considered deprecated
-    /// @param must_use true if the builtin was annotated with `@must_use`
+    /// @param overload the builtin table overload
     BuiltinFn(wgsl::BuiltinFn type,
               const core::type::Type* return_type,
               VectorRef<Parameter*> parameters,
               core::EvaluationStage eval_stage,
               PipelineStageSet supported_stages,
-              bool is_deprecated,
-              bool must_use);
+              const core::intrinsic::OverloadInfo& overload);
 
     /// Destructor
     ~BuiltinFn() override;
@@ -69,7 +72,7 @@
     PipelineStageSet SupportedStages() const { return supported_stages_; }
 
     /// @return true if the builtin overload is considered deprecated
-    bool IsDeprecated() const { return is_deprecated_; }
+    bool IsDeprecated() const;
 
     /// @returns the name of the builtin function type. The spelling, including
     /// case, matches the name in the WGSL spec.
@@ -122,6 +125,9 @@
     /// wgsl::LanguageFeature::kUndefined if no language feature is required.
     wgsl::LanguageFeature RequiredLanguageFeature() const;
 
+    /// @returns the builtin table overload info
+    const core::intrinsic::OverloadInfo& Overload() const { return overload_; }
+
     /// @return the hash code for this object
     tint::HashCode HashCode() const {
         return Hash(Fn(), SupportedStages(), ReturnType(), Parameters(), IsDeprecated());
@@ -130,7 +136,7 @@
   private:
     const wgsl::BuiltinFn fn_;
     const PipelineStageSet supported_stages_;
-    const bool is_deprecated_;
+    const core::intrinsic::OverloadInfo& overload_;
 };
 
 /// Constant value used by the degrees() builtin