comparison src/mono_opt.sml @ 2120:e3a79066380d

Evaluate minus and times in MonoOpt
author Adam Chlipala <adam@chlipala.net>
date Mon, 16 Feb 2015 14:52:56 -0500
parents fd6d362666c0
children e10881cd92da
comparison
equal deleted inserted replaced
2119:5439b35c5d0b 2120:e3a79066380d
628 EFfiApp ("Basis", "attrifyChar_w", [e]) 628 EFfiApp ("Basis", "attrifyChar_w", [e])
629 | EWrite (EFfiApp ("Basis", "str1", [e]), _) => 629 | EWrite (EFfiApp ("Basis", "str1", [e]), _) =>
630 EFfiApp ("Basis", "writec", [e]) 630 EFfiApp ("Basis", "writec", [e])
631 631
632 | EBinop (_, "+", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.+ (n1, n2))) 632 | EBinop (_, "+", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.+ (n1, n2)))
633 633 | EBinop (_, "-", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.- (n1, n2)))
634 | EBinop (_, "*", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.* (n1, n2)))
635
634 | _ => e 636 | _ => e
635 637
636 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e) 638 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e)
637 639
638 val optimize = U.File.map {typ = typ, exp = exp, decl = decl} 640 val optimize = U.File.map {typ = typ, exp = exp, decl = decl}