fix Ir.Bop codegen bugs
This commit is contained in:
parent
22a11c7e47
commit
d7bb317e2b
|
@ -81,11 +81,11 @@ let rec compile_lambda (lam : Ir.lambda) =
|
||||||
|
|
||||||
| Ir.Bop (op, e1, e2) ->
|
| Ir.Bop (op, e1, e2) ->
|
||||||
let r1 = emit_exp_s sp e1; sp in
|
let r1 = emit_exp_s sp e1; sp in
|
||||||
let r2 = emit_exp sp e2 in
|
let r2 = emit_exp (suc sp) e2 in
|
||||||
emit (match op with
|
emit (match op with
|
||||||
| Add -> ADD (sp, r1, r2)
|
| Add -> ADD (sp, r1, r2)
|
||||||
| Sub -> ADD (sp, r1, r2)
|
| Sub -> SUB (sp, r1, r2)
|
||||||
| Mul -> ADD (sp, r1, r2)
|
| Mul -> MUL (sp, r1, r2)
|
||||||
| Div -> failwith "Bcc.compile_exp: TODO(Bop(Div))"
|
| Div -> failwith "Bcc.compile_exp: TODO(Bop(Div))"
|
||||||
| Mod -> failwith "Bcc.compile_exp: TODO(Bop(Mod))"
|
| Mod -> failwith "Bcc.compile_exp: TODO(Bop(Mod))"
|
||||||
| Eql -> EQL (sp, r1, r2)
|
| Eql -> EQL (sp, r1, r2)
|
||||||
|
|
Loading…
Reference in New Issue