changeset 320:132416711463

Expand scope of base type conversion coalesce optimizations
author Adam Chlipala <adamc@hcoop.net>
date Thu, 11 Sep 2008 11:53:33 -0400
parents 1fd2a29a7c85
children cd4cabaf3e52
files src/mono_opt.sml
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/mono_opt.sml	Thu Sep 11 11:44:46 2008 -0400
+++ b/src/mono_opt.sml	Thu Sep 11 11:53:33 2008 -0400
@@ -155,6 +155,12 @@
         EPrim (Prim.String (htmlifyInt n))
       | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", es), _)]) =>
         EFfiApp ("Basis", "htmlifyInt", es)
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "intToString"), _),
+                                                   (EPrim (Prim.Int n), _)), _)]) =>
+        EPrim (Prim.String (htmlifyInt n))
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "intToString"), _),
+                                                   e), _)]) =>
+        EFfiApp ("Basis", "htmlifyInt", [e])
       | EWrite (EFfiApp ("Basis", "htmlifyInt", [e]), _) =>
         EFfiApp ("Basis", "htmlifyInt_w", [e])
 
@@ -162,6 +168,12 @@
         EPrim (Prim.String (htmlifyFloat n))
       | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "floatToString", es), _)]) =>
         EFfiApp ("Basis", "htmlifyFloat", es)
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "floatToString"), _),
+                                                   (EPrim (Prim.Float n), _)), _)]) =>
+        EPrim (Prim.String (htmlifyFloat n))
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "floatToString"), _),
+                                                   e), _)]) =>
+        EFfiApp ("Basis", "htmlifyFloat", [e])
       | EWrite (EFfiApp ("Basis", "htmlifyFloat", [e]), _) =>
         EFfiApp ("Basis", "htmlifyFloat_w", [e])
 
@@ -173,6 +185,15 @@
         EPrim (Prim.String "False")
       | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "boolToString", es), _)]) =>
         EFfiApp ("Basis", "htmlifyBool", es)
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "boolToString"), _),
+                                                   (ECon (Enum, PConFfi {con = "True", ...}, NONE), _)), _)]) =>
+        EPrim (Prim.String "True")
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "boolToString"), _),
+                                                   (ECon (Enum, PConFfi {con = "False", ...}, NONE), _)), _)]) =>
+        EPrim (Prim.String "False")
+      | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "boolToString"), _),
+                                                   e), _)]) =>
+        EFfiApp ("Basis", "htmlifyBool", [e])
       | EWrite (EFfiApp ("Basis", "htmlifyBool", [e]), _) =>
         EFfiApp ("Basis", "htmlifyBool_w", [e])