Remove some unordered_{set|map}

The IR printers were using `unordered_set` and `unordered_map` in a
couple places, while most of the code was using `Hashset` and `Hashmap`.
Remove the usages of the std versions in favour of consistently using
the internal versions.

Change-Id: I4a669423de9168653fe75a6bc67712fe826d1b03
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/204376
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/glsl/writer/printer/printer.cc b/src/tint/lang/glsl/writer/printer/printer.cc
index 855db24..e43d9bd 100644
--- a/src/tint/lang/glsl/writer/printer/printer.cc
+++ b/src/tint/lang/glsl/writer/printer/printer.cc
@@ -28,8 +28,6 @@
 #include "src/tint/lang/glsl/writer/printer/printer.h"
 
 #include <string>
-#include <unordered_map>
-#include <unordered_set>
 #include <utility>
 
 #include "src/tint/lang/core/constant/splat.h"
@@ -131,10 +129,10 @@
     Hashmap<const core::ir::Value*, std::string, 32> names_;
 
     /// Map of builtin structure to unique generated name
-    std::unordered_map<const core::type::Struct*, std::string> builtin_struct_names_;
+    Hashmap<const core::type::Struct*, std::string, 4> builtin_struct_names_;
 
     // The set of emitted structs
-    std::unordered_set<const core::type::Struct*> emitted_structs_;
+    Hashset<const core::type::Struct*, 4> emitted_structs_;
 
     /// @returns the name of the given value, creating a new unique name if the value is unnamed in
     /// the module.
@@ -159,8 +157,8 @@
     std::string StructName(const core::type::Struct* s) {
         auto name = s->Name().Name();
         if (HasPrefix(name, "__")) {
-            name = tint::GetOrAdd(builtin_struct_names_, s,
-                                  [&] { return UniqueIdentifier(name.substr(2)); });
+            name =
+                builtin_struct_names_.GetOrAdd(s, [&] { return UniqueIdentifier(name.substr(2)); });
         }
         return name;
     }
@@ -351,8 +349,7 @@
     }
 
     void EmitStructType(const core::type::Struct* str) {
-        auto it = emitted_structs_.emplace(str);
-        if (!it.second) {
+        if (!emitted_structs_.Add(str)) {
             return;
         }
 
diff --git a/src/tint/lang/hlsl/writer/printer/printer.cc b/src/tint/lang/hlsl/writer/printer/printer.cc
index ee93a6d..69b2c29 100644
--- a/src/tint/lang/hlsl/writer/printer/printer.cc
+++ b/src/tint/lang/hlsl/writer/printer/printer.cc
@@ -31,8 +31,6 @@
 #include <cstddef>
 #include <cstdint>
 #include <string>
-#include <unordered_map>
-#include <unordered_set>
 #include <utility>
 #include <vector>
 
@@ -191,9 +189,9 @@
     /// A hashmap of value to name
     Hashmap<const core::ir::Value*, std::string, 32> names_;
     /// Map of builtin structure to unique generated name
-    std::unordered_map<const core::type::Struct*, std::string> builtin_struct_names_;
+    Hashmap<const core::type::Struct*, std::string, 4> builtin_struct_names_;
     /// Set of structs which have been emitted already
-    std::unordered_set<const core::type::Struct*> emitted_structs_;
+    Hashset<const core::type::Struct*, 4> emitted_structs_;
 
     /// The current function being emitted
     const core::ir::Function* current_function_ = nullptr;
@@ -1455,8 +1453,7 @@
     }
 
     void EmitStructType(const core::type::Struct* str) {
-        auto it = emitted_structs_.emplace(str);
-        if (!it.second) {
+        if (!emitted_structs_.Add(str)) {
             return;
         }
 
@@ -1613,8 +1610,8 @@
     std::string StructName(const core::type::Struct* s) {
         auto name = s->Name().Name();
         if (HasPrefix(name, "__")) {
-            name = tint::GetOrAdd(builtin_struct_names_, s,
-                                  [&] { return UniqueIdentifier(name.substr(2)); });
+            name =
+                builtin_struct_names_.GetOrAdd(s, [&] { return UniqueIdentifier(name.substr(2)); });
         }
         return name;
     }
diff --git a/src/tint/lang/msl/writer/printer/printer.cc b/src/tint/lang/msl/writer/printer/printer.cc
index 1b93146..cc7eb25 100644
--- a/src/tint/lang/msl/writer/printer/printer.cc
+++ b/src/tint/lang/msl/writer/printer/printer.cc
@@ -29,8 +29,6 @@
 
 #include <atomic>
 #include <cstdint>
-#include <unordered_map>
-#include <unordered_set>
 #include <utility>
 
 #include "src/tint/lang/core/constant/composite.h"
@@ -158,7 +156,7 @@
     PrintResult result_;
 
     /// Map of builtin structure to unique generated name
-    std::unordered_map<const core::type::Struct*, std::string> builtin_struct_names_;
+    Hashmap<const core::type::Struct*, std::string, 4> builtin_struct_names_;
 
     core::ir::Module& ir_;
 
@@ -173,7 +171,7 @@
     std::string invariant_define_name_;
 
     Hashset<const core::type::Struct*, 16> host_shareable_structs_;
-    std::unordered_set<const core::type::Struct*> emitted_structs_;
+    Hashset<const core::type::Struct*, 4> emitted_structs_;
 
     /// The current function being emitted
     const core::ir::Function* current_function_ = nullptr;
@@ -1387,8 +1385,7 @@
     /// this function will simply return without emitting anything.
     /// @param str the struct to generate
     void EmitStructType(const core::type::Struct* str) {
-        auto it = emitted_structs_.emplace(str);
-        if (!it.second) {
+        if (!emitted_structs_.Add(str)) {
             return;
         }
 
@@ -1681,8 +1678,8 @@
     std::string StructName(const core::type::Struct* s) {
         auto name = s->Name().Name();
         if (HasPrefix(name, "__")) {
-            name = tint::GetOrAdd(builtin_struct_names_, s,
-                                  [&] { return UniqueIdentifier(name.substr(2)); });
+            name =
+                builtin_struct_names_.GetOrAdd(s, [&] { return UniqueIdentifier(name.substr(2)); });
         }
         return name;
     }