comparison src/mono_opt.sml @ 1024:93415bcf54c0

Optimizing str1 in MonoOpt
author Adam Chlipala <adamc@hcoop.net>
date Sun, 01 Nov 2009 10:31:18 -0500
parents ea9f03ac2710
children 4eb1c4a1b057
comparison
equal deleted inserted replaced
1023:e46227efcbba 1024:93415bcf54c0
500 (case rev es of 500 (case rev es of
501 (e as (_, loc)) :: es => #1 (foldl (fn (e, es) => (EStrcat (e, es), loc)) e es) 501 (e as (_, loc)) :: es => #1 (foldl (fn (e, es) => (EStrcat (e, es), loc)) e es)
502 | [] => raise Fail "MonoOpt impossible nil") 502 | [] => raise Fail "MonoOpt impossible nil")
503 | NONE => e 503 | NONE => e
504 end 504 end
505
506 | EFfiApp ("Basis", "str1", [(EPrim (Prim.Char ch), _)]) =>
507 EPrim (Prim.String (str ch))
508 | EFfiApp ("Basis", "attrifyString", [(EFfiApp ("Basis", "str1", [e]), _)]) =>
509 EFfiApp ("Basis", "attrifyChar", [e])
510 | EFfiApp ("Basis", "attrifyString_w", [(EFfiApp ("Basis", "str1", [e]), _)]) =>
511 EFfiApp ("Basis", "attrifyChar_w", [e])
505 512
506 | _ => e 513 | _ => e
507 514
508 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e) 515 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e)
509 516