diff options
author | Thomas Lively <tlively@google.com> | 2024-05-15 12:07:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-15 12:07:34 -0700 |
commit | 6b43a5ef76149c92e216fddb0a1ee17f736b4b6e (patch) | |
tree | 7b2deb1e6924ba8f74e0b25c26cf2d9a63ad610a /src/parser | |
parent | ef4b57c2a491a2193435dccdc9305f6a79965715 (diff) | |
download | binaryen-6b43a5ef76149c92e216fddb0a1ee17f736b4b6e.tar.gz binaryen-6b43a5ef76149c92e216fddb0a1ee17f736b4b6e.tar.bz2 binaryen-6b43a5ef76149c92e216fddb0a1ee17f736b4b6e.zip |
[Strings] Remove operations not included in imported strings (#6589)
The stringref proposal has been superseded by the imported JS strings proposal,
but the former has many more operations than the latter. To reduce complexity,
remove all operations that are part of stringref but not part of imported
strings.
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/contexts.h | 48 | ||||
-rw-r--r-- | src/parser/parsers.h | 33 |
2 files changed, 12 insertions, 69 deletions
diff --git a/src/parser/contexts.h b/src/parser/contexts.h index b32e32a15..2243c6065 100644 --- a/src/parser/contexts.h +++ b/src/parser/contexts.h @@ -772,8 +772,7 @@ struct NullInstrParserCtx { Result<> makeRefAs(Index, const std::vector<Annotation>&, RefAsOp) { return Ok{}; } - Result<> makeStringNew( - Index, const std::vector<Annotation>&, StringNewOp, bool, MemoryIdxT*) { + Result<> makeStringNew(Index, const std::vector<Annotation>&, StringNewOp) { return Ok{}; } Result<> @@ -784,10 +783,8 @@ struct NullInstrParserCtx { makeStringMeasure(Index, const std::vector<Annotation>&, StringMeasureOp) { return Ok{}; } - Result<> makeStringEncode(Index, - const std::vector<Annotation>&, - StringEncodeOp, - MemoryIdxT*) { + Result<> + makeStringEncode(Index, const std::vector<Annotation>&, StringEncodeOp) { return Ok{}; } Result<> makeStringConcat(Index, const std::vector<Annotation>&) { @@ -2478,24 +2475,8 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> { Result<> makeStringNew(Index pos, const std::vector<Annotation>& annotations, - StringNewOp op, - bool try_, - Name* mem) { - Name memName; - switch (op) { - case StringNewUTF8: - case StringNewWTF8: - case StringNewLossyUTF8: - case StringNewWTF16: { - auto m = getMemory(pos, mem); - CHECK_ERR(m); - memName = *m; - break; - } - default: - break; - } - return withLoc(pos, irBuilder.makeStringNew(op, try_, memName)); + StringNewOp op) { + return withLoc(pos, irBuilder.makeStringNew(op)); } Result<> makeStringConst(Index pos, @@ -2518,23 +2499,8 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> { Result<> makeStringEncode(Index pos, const std::vector<Annotation>& annotations, - StringEncodeOp op, - Name* mem) { - Name memName; - switch (op) { - case StringEncodeUTF8: - case StringEncodeLossyUTF8: - case StringEncodeWTF8: - case StringEncodeWTF16: { - auto m = getMemory(pos, mem); - CHECK_ERR(m); - memName = *m; - break; - } - default: - break; - } - return withLoc(pos, irBuilder.makeStringEncode(op, memName)); + StringEncodeOp op) { + return withLoc(pos, irBuilder.makeStringEncode(op)); } Result<> makeStringConcat(Index pos, diff --git a/src/parser/parsers.h b/src/parser/parsers.h index 60d3f0391..88600fec3 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -266,8 +266,8 @@ Result<> makeArrayInitElem(Ctx&, Index, const std::vector<Annotation>&); template<typename Ctx> Result<> makeRefAs(Ctx&, Index, const std::vector<Annotation>&, RefAsOp op); template<typename Ctx> -Result<> makeStringNew( - Ctx&, Index, const std::vector<Annotation>&, StringNewOp op, bool try_); +Result<> +makeStringNew(Ctx&, Index, const std::vector<Annotation>&, StringNewOp op); template<typename Ctx> Result<> makeStringConst(Ctx&, Index, const std::vector<Annotation>&); template<typename Ctx> @@ -2336,20 +2336,8 @@ template<typename Ctx> Result<> makeStringNew(Ctx& ctx, Index pos, const std::vector<Annotation>& annotations, - StringNewOp op, - bool try_) { - switch (op) { - case StringNewUTF8: - case StringNewWTF8: - case StringNewLossyUTF8: - case StringNewWTF16: { - auto mem = maybeMemidx(ctx); - CHECK_ERR(mem); - return ctx.makeStringNew(pos, annotations, op, try_, mem.getPtr()); - } - default: - return ctx.makeStringNew(pos, annotations, op, try_, nullptr); - } + StringNewOp op) { + return ctx.makeStringNew(pos, annotations, op); } template<typename Ctx> @@ -2376,18 +2364,7 @@ Result<> makeStringEncode(Ctx& ctx, Index pos, const std::vector<Annotation>& annotations, StringEncodeOp op) { - switch (op) { - case StringEncodeUTF8: - case StringEncodeLossyUTF8: - case StringEncodeWTF8: - case StringEncodeWTF16: { - auto mem = maybeMemidx(ctx); - CHECK_ERR(mem); - return ctx.makeStringEncode(pos, annotations, op, mem.getPtr()); - } - default: - return ctx.makeStringEncode(pos, annotations, op, nullptr); - } + return ctx.makeStringEncode(pos, annotations, op); } template<typename Ctx> |