[ir] Change ir::BindingRemapper to take a set of options.

Currently the ir::BindingRemapper uses the BindingRemapperOptions. Those
options only contain a single hash now, so this CL updates the remapper
to take the hash instead of the options structure.

Bug: tint:1718
Change-Id: I9ada66fb0e2ce83b5db839b0ad3fc651ec59824c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152667
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/core/ir/transform/binding_remapper.cc b/src/tint/lang/core/ir/transform/binding_remapper.cc
index 47a591f..b927fd1 100644
--- a/src/tint/lang/core/ir/transform/binding_remapper.cc
+++ b/src/tint/lang/core/ir/transform/binding_remapper.cc
@@ -28,8 +28,9 @@
 
 namespace {
 
-Result<SuccessType> Run(ir::Module& ir, const BindingRemapperOptions& options) {
-    if (options.binding_points.empty()) {
+Result<SuccessType> Run(ir::Module& ir,
+                        const std::unordered_map<BindingPoint, BindingPoint>& binding_points) {
+    if (binding_points.empty()) {
         return Success;
     }
     if (ir.root_block->IsEmpty()) {
@@ -49,8 +50,8 @@
         }
 
         // Replace group and binding index if requested.
-        auto to = options.binding_points.find(bp.value());
-        if (to != options.binding_points.end()) {
+        auto to = binding_points.find(bp.value());
+        if (to != binding_points.end()) {
             var->SetBindingPoint(to->second.group, to->second.binding);
         }
     }
@@ -60,13 +61,15 @@
 
 }  // namespace
 
-Result<SuccessType> BindingRemapper(Module& ir, const BindingRemapperOptions& options) {
+Result<SuccessType> BindingRemapper(
+    Module& ir,
+    const std::unordered_map<BindingPoint, BindingPoint>& binding_points) {
     auto result = ValidateAndDumpIfNeeded(ir, "BindingRemapper transform");
     if (!result) {
         return result;
     }
 
-    return Run(ir, options);
+    return Run(ir, binding_points);
 }
 
 }  // namespace tint::core::ir::transform
diff --git a/src/tint/lang/core/ir/transform/binding_remapper.h b/src/tint/lang/core/ir/transform/binding_remapper.h
index 5d7a2a0..51f4f14 100644
--- a/src/tint/lang/core/ir/transform/binding_remapper.h
+++ b/src/tint/lang/core/ir/transform/binding_remapper.h
@@ -16,8 +16,9 @@
 #define SRC_TINT_LANG_CORE_IR_TRANSFORM_BINDING_REMAPPER_H_
 
 #include <string>
+#include <unordered_map>
 
-#include "src/tint/api/options/binding_remapper.h"
+#include "src/tint/api/common/binding_point.h"
 #include "src/tint/utils/result/result.h"
 
 // Forward declarations.
@@ -29,9 +30,11 @@
 
 /// BindingRemapper is a transform that remaps binding point indices and access controls.
 /// @param module the module to transform
-/// @param options the remapping options
+/// @param binding_points the remapping data
 /// @returns success or failure
-Result<SuccessType> BindingRemapper(Module& module, const BindingRemapperOptions& options);
+Result<SuccessType> BindingRemapper(
+    Module& module,
+    const std::unordered_map<BindingPoint, BindingPoint>& binding_points);
 
 }  // namespace tint::core::ir::transform
 
diff --git a/src/tint/lang/core/ir/transform/binding_remapper_test.cc b/src/tint/lang/core/ir/transform/binding_remapper_test.cc
index 81383c8..9f016fa 100644
--- a/src/tint/lang/core/ir/transform/binding_remapper_test.cc
+++ b/src/tint/lang/core/ir/transform/binding_remapper_test.cc
@@ -41,8 +41,8 @@
 
     auto* expect = src;
 
-    BindingRemapperOptions options;
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
@@ -62,9 +62,9 @@
 
     auto* expect = src;
 
-    BindingRemapperOptions options;
-    options.binding_points[tint::BindingPoint{0u, 1u}] = tint::BindingPoint{1u, 0u};
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    binding_points[tint::BindingPoint{0u, 1u}] = tint::BindingPoint{1u, 0u};
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
@@ -89,9 +89,9 @@
 
 )";
 
-    BindingRemapperOptions options;
-    options.binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{3u, 2u};
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{3u, 2u};
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
@@ -116,9 +116,9 @@
 
 )";
 
-    BindingRemapperOptions options;
-    options.binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{1u, 3u};
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{1u, 3u};
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
@@ -143,9 +143,9 @@
 
 )";
 
-    BindingRemapperOptions options;
-    options.binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{3u, 4u};
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{3u, 4u};
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
@@ -175,10 +175,10 @@
 
 )";
 
-    BindingRemapperOptions options;
-    options.binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{3u, 4u};
-    options.binding_points[tint::BindingPoint{3u, 4u}] = tint::BindingPoint{1u, 2u};
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{3u, 4u};
+    binding_points[tint::BindingPoint{3u, 4u}] = tint::BindingPoint{1u, 2u};
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
@@ -229,10 +229,10 @@
 }
 )";
 
-    BindingRemapperOptions options;
-    options.binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{0u, 1u};
-    options.binding_points[tint::BindingPoint{3u, 4u}] = tint::BindingPoint{0u, 1u};
-    Run(BindingRemapper, options);
+    std::unordered_map<tint::BindingPoint, tint::BindingPoint> binding_points;
+    binding_points[tint::BindingPoint{1u, 2u}] = tint::BindingPoint{0u, 1u};
+    binding_points[tint::BindingPoint{3u, 4u}] = tint::BindingPoint{0u, 1u};
+    Run(BindingRemapper, binding_points);
 
     EXPECT_EQ(expect, str());
 }
diff --git a/src/tint/lang/spirv/writer/raise/raise.cc b/src/tint/lang/spirv/writer/raise/raise.cc
index 6045987..ec72695 100644
--- a/src/tint/lang/spirv/writer/raise/raise.cc
+++ b/src/tint/lang/spirv/writer/raise/raise.cc
@@ -45,7 +45,8 @@
         }                                \
     } while (false)
 
-    RUN_TRANSFORM(core::ir::transform::BindingRemapper, module, options.binding_remapper_options);
+    RUN_TRANSFORM(core::ir::transform::BindingRemapper, module,
+                  options.binding_remapper_options.binding_points);
 
     core::ir::transform::BinaryPolyfillConfig binary_polyfills;
     binary_polyfills.bitshift_modulo = true;