[ir] Add ability to clone in the IR.
Add support for cloning in the IR.
This CL is based off of https://dawn-review.googlesource.com/c/dawn/+/152400
Bug: tint:1718
Change-Id: I8fce30872ad2c02c59363d2cd8b5771917d97342
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152221
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/core/ir/load.h b/src/tint/lang/core/ir/load.h
index 55fb983..1bf1ca1 100644
--- a/src/tint/lang/core/ir/load.h
+++ b/src/tint/lang/core/ir/load.h
@@ -23,7 +23,7 @@
namespace tint::core::ir {
/// A load instruction in the IR.
-class Load : public Castable<Load, OperandInstruction<1, 1>> {
+class Load final : public Castable<Load, OperandInstruction<1, 1>> {
public:
/// The offset in Operands() for the from value
static constexpr size_t kFromOperandOffset = 0;
@@ -35,6 +35,9 @@
~Load() override;
+ /// @copydoc Instruction::Clone()
+ Load* Clone(CloneContext& ctx) override;
+
/// @returns the value being loaded from
Value* From() { return operands_[kFromOperandOffset]; }