Add other comparison operators, fix materialising locals, add more TODO comments (v. important)

This commit is contained in:
Jef
2018-12-19 12:42:35 +01:00
parent cbf34a455b
commit 2173f4bcca
3 changed files with 50 additions and 52 deletions

View File

@@ -133,6 +133,9 @@ pub fn translate(
return_ty,
));
// TODO: We want to make this a state machine (maybe requires 1-element lookahead? Not sure) so that we
// can coelesce multiple `end`s and optimise break-at-end-of-block into noop. We can't do one
// without the other, since the main case we want to optimise is `(block (loop (br 1)))`.
for op in operators {
let op = op?;
@@ -279,10 +282,15 @@ pub fn translate(
}
Operator::I32Eq => i32_eq(ctx),
Operator::I32Ne => i32_neq(ctx),
Operator::I32LtS => i32_lt(ctx),
Operator::I32LeS => i32_le(ctx),
Operator::I32GtS => i32_gt(ctx),
Operator::I32GeS => i32_ge(ctx),
Operator::I32LtS => i32_lt_s(ctx),
Operator::I32LeS => i32_le_s(ctx),
Operator::I32GtS => i32_gt_s(ctx),
Operator::I32GeS => i32_ge_s(ctx),
// TODO: `dynasm-rs` inexplicably doesn't support setb
// Operator::I32LtU => i32_lt_u(ctx),
Operator::I32LeU => i32_le_u(ctx),
Operator::I32GtU => i32_gt_u(ctx),
Operator::I32GeU => i32_ge_u(ctx),
Operator::I32Add => i32_add(ctx),
Operator::I32Sub => i32_sub(ctx),
Operator::I32And => i32_and(ctx),