diff options
Diffstat (limited to 'src/wasm-ir-builder.h')
-rw-r--r-- | src/wasm-ir-builder.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h index 2fc03326b..6d4fca3c3 100644 --- a/src/wasm-ir-builder.h +++ b/src/wasm-ir-builder.h @@ -76,7 +76,8 @@ public: [[nodiscard]] Result<> makeIf(Name label, Type type); [[nodiscard]] Result<> makeLoop(Name label, Type type); [[nodiscard]] Result<> makeBreak(Index label); - // [[nodiscard]] Result<> makeSwitch(); + [[nodiscard]] Result<> makeSwitch(const std::vector<Index>& labels, + Index defaultLabel); // Unlike Builder::makeCall, this assumes the function already exists. [[nodiscard]] Result<> makeCall(Name func, bool isReturn); // [[nodiscard]] Result<> makeCallIndirect(); @@ -191,6 +192,8 @@ public: [[nodiscard]] Result<> visitArrayNew(ArrayNew*); [[nodiscard]] Result<> visitBreak(Break*, std::optional<Index> label = std::nullopt); + [[nodiscard]] Result<> + visitSwitch(Switch*, std::optional<Index> defaultLabel = std::nullopt); [[nodiscard]] Result<> visitCall(Call*); private: @@ -392,6 +395,9 @@ private: // the value, if they are different. May only be called directly after // hoistLastValue(). [[nodiscard]] Result<> packageHoistedValue(const HoistedVal&); + + [[nodiscard]] Result<Expression*> getBranchValue(Name labelName, + std::optional<Index> label); }; } // namespace wasm |