summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gen-s-parser.inc146
-rw-r--r--src/parser/parsers.h23
2 files changed, 59 insertions, 110 deletions
diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc
index a7cdc76c7..309f190ce 100644
--- a/src/gen-s-parser.inc
+++ b/src/gen-s-parser.inc
@@ -3727,77 +3727,66 @@ switch (buf[0]) {
}
}
case 'b': {
- switch (buf[1]) {
- case 'l':
- if (op == "block"sv) {
- CHECK_ERR(makeBlock(ctx, pos));
+ switch (buf[2]) {
+ case '\0':
+ if (op == "br"sv) {
+ CHECK_ERR(makeBreak(ctx, pos));
return Ok{};
}
goto parse_error;
- case 'r': {
- switch (buf[2]) {
- case '\0':
- if (op == "br"sv) {
+ case '_': {
+ switch (buf[3]) {
+ case 'i':
+ if (op == "br_if"sv) {
CHECK_ERR(makeBreak(ctx, pos));
return Ok{};
}
goto parse_error;
- case '_': {
- switch (buf[3]) {
- case 'i':
- if (op == "br_if"sv) {
- CHECK_ERR(makeBreak(ctx, pos));
- return Ok{};
- }
- goto parse_error;
- case 'o': {
- switch (buf[6]) {
- case 'c': {
- switch (buf[10]) {
- case '\0':
- if (op == "br_on_cast"sv) {
- CHECK_ERR(makeBrOnCast(ctx, pos));
- return Ok{};
- }
- goto parse_error;
- case '_':
- if (op == "br_on_cast_fail"sv) {
- CHECK_ERR(makeBrOnCast(ctx, pos, true));
- return Ok{};
- }
- goto parse_error;
- default: goto parse_error;
+ case 'o': {
+ switch (buf[6]) {
+ case 'c': {
+ switch (buf[10]) {
+ case '\0':
+ if (op == "br_on_cast"sv) {
+ CHECK_ERR(makeBrOnCast(ctx, pos));
+ return Ok{};
}
- }
- case 'n': {
- switch (buf[7]) {
- case 'o':
- if (op == "br_on_non_null"sv) {
- CHECK_ERR(makeBrOnNull(ctx, pos, true));
- return Ok{};
- }
- goto parse_error;
- case 'u':
- if (op == "br_on_null"sv) {
- CHECK_ERR(makeBrOnNull(ctx, pos));
- return Ok{};
- }
- goto parse_error;
- default: goto parse_error;
+ goto parse_error;
+ case '_':
+ if (op == "br_on_cast_fail"sv) {
+ CHECK_ERR(makeBrOnCast(ctx, pos, true));
+ return Ok{};
}
- }
+ goto parse_error;
default: goto parse_error;
}
}
- case 't':
- if (op == "br_table"sv) {
- CHECK_ERR(makeBreakTable(ctx, pos));
- return Ok{};
+ case 'n': {
+ switch (buf[7]) {
+ case 'o':
+ if (op == "br_on_non_null"sv) {
+ CHECK_ERR(makeBrOnNull(ctx, pos, true));
+ return Ok{};
+ }
+ goto parse_error;
+ case 'u':
+ if (op == "br_on_null"sv) {
+ CHECK_ERR(makeBrOnNull(ctx, pos));
+ return Ok{};
+ }
+ goto parse_error;
+ default: goto parse_error;
}
- goto parse_error;
+ }
default: goto parse_error;
}
}
+ case 't':
+ if (op == "br_table"sv) {
+ CHECK_ERR(makeBreakTable(ctx, pos));
+ return Ok{};
+ }
+ goto parse_error;
default: goto parse_error;
}
}
@@ -7935,43 +7924,26 @@ switch (buf[0]) {
default: goto parse_error;
}
}
- case 'f':
- if (op == "if"sv) {
- CHECK_ERR(makeIf(ctx, pos));
- return Ok{};
- }
- goto parse_error;
default: goto parse_error;
}
}
case 'l': {
- switch (buf[2]) {
- case 'c': {
- switch (buf[6]) {
- case 'g':
- if (op == "local.get"sv) {
- CHECK_ERR(makeLocalGet(ctx, pos));
- return Ok{};
- }
- goto parse_error;
- case 's':
- if (op == "local.set"sv) {
- CHECK_ERR(makeLocalSet(ctx, pos));
- return Ok{};
- }
- goto parse_error;
- case 't':
- if (op == "local.tee"sv) {
- CHECK_ERR(makeLocalTee(ctx, pos));
- return Ok{};
- }
- goto parse_error;
- default: goto parse_error;
+ switch (buf[6]) {
+ case 'g':
+ if (op == "local.get"sv) {
+ CHECK_ERR(makeLocalGet(ctx, pos));
+ return Ok{};
}
- }
- case 'o':
- if (op == "loop"sv) {
- CHECK_ERR(makeLoop(ctx, pos));
+ goto parse_error;
+ case 's':
+ if (op == "local.set"sv) {
+ CHECK_ERR(makeLocalSet(ctx, pos));
+ return Ok{};
+ }
+ goto parse_error;
+ case 't':
+ if (op == "local.tee"sv) {
+ CHECK_ERR(makeLocalTee(ctx, pos));
return Ok{};
}
goto parse_error;
diff --git a/src/parser/parsers.h b/src/parser/parsers.h
index 7ac25def4..44c4f959e 100644
--- a/src/parser/parsers.h
+++ b/src/parser/parsers.h
@@ -69,8 +69,6 @@ template<typename Ctx> Result<> makeLocalTee(Ctx&, Index);
template<typename Ctx> Result<> makeLocalSet(Ctx&, Index);
template<typename Ctx> Result<> makeGlobalGet(Ctx&, Index);
template<typename Ctx> Result<> makeGlobalSet(Ctx&, Index);
-template<typename Ctx> Result<> makeBlock(Ctx&, Index);
-template<typename Ctx> Result<> makeThenOrElse(Ctx&, Index);
template<typename Ctx> Result<> makeConst(Ctx&, Index, Type type);
template<typename Ctx>
Result<>
@@ -100,10 +98,6 @@ template<typename Ctx> Result<> makeDataDrop(Ctx&, Index);
template<typename Ctx> Result<> makeMemoryCopy(Ctx&, Index);
template<typename Ctx> Result<> makeMemoryFill(Ctx&, Index);
template<typename Ctx> Result<> makePop(Ctx&, Index);
-template<typename Ctx> Result<> makeIf(Ctx&, Index);
-template<typename Ctx>
-Result<> makeMaybeBlock(Ctx&, Index, size_t i, Type type);
-template<typename Ctx> Result<> makeLoop(Ctx&, Index);
template<typename Ctx> Result<> makeCall(Ctx&, Index, bool isReturn);
template<typename Ctx> Result<> makeCallIndirect(Ctx&, Index, bool isReturn);
template<typename Ctx> Result<> makeBreak(Ctx&, Index);
@@ -967,10 +961,6 @@ template<typename Ctx> Result<> makeGlobalSet(Ctx& ctx, Index pos) {
return ctx.makeGlobalSet(pos, *global);
}
-template<typename Ctx> Result<> makeBlock(Ctx& ctx, Index pos) {
- return ctx.in.err("unimplemented instruction");
-}
-
template<typename Ctx> Result<> makeConst(Ctx& ctx, Index pos, Type type) {
assert(type.isBasic());
switch (type.getBasic()) {
@@ -1192,19 +1182,6 @@ template<typename Ctx> Result<> makePop(Ctx& ctx, Index pos) {
return ctx.in.err("unimplemented instruction");
}
-template<typename Ctx> Result<> makeIf(Ctx& ctx, Index pos) {
- return ctx.in.err("unimplemented instruction");
-}
-
-template<typename Ctx>
-Result<> makeMaybeBlock(Ctx& ctx, Index pos, size_t i, Type type) {
- return ctx.in.err("unimplemented instruction");
-}
-
-template<typename Ctx> Result<> makeLoop(Ctx& ctx, Index pos) {
- return ctx.in.err("unimplemented instruction");
-}
-
template<typename Ctx> Result<> makeCall(Ctx& ctx, Index pos, bool isReturn) {
auto func = funcidx(ctx);
CHECK_ERR(func);