Commits

Paweł Wieczorek  committed 3669e4b

added CWCPS_BetaContraction transformation

  • Participants
  • Parent commits 9852097

Comments (0)

Files changed (3)

File src/Analysis/CWCPS/CWCPS_VariableUsageAnalysis.ml

 (*************************************************************************************************
  ************************************************************************************************)
 
-module Compose = struct
+module Combined = struct
 
     type t =
         { usage_count : variable -> int
 (*************************************************************************************************
  ************************************************************************************************)
 
+let analyze = Combined.analyze
 
+
 open MiniML_to_CWCPS
 open CWCPS_ConstantFolding
 open CWCPS_RemoveDeadCode
-open CWCPS_VariableUsageAnalysis
+open CWCPS_BetaContraction
 open Algebra_Monoid
 
 (************************************************************************************************
             Util.print_words_ln [ "-"; "transform RemoveDeadCode" ];
             let res = CWCPS_RemoveDeadCode.bottomup res in
             CWCPS_driver.pretty_expr res;
+            Util.print_words_ln [ "-"; "transform BetaContraction" ];
+            let res = CWCPS_BetaContraction.bottomup res in
+            CWCPS_driver.pretty_expr res;
             ()
         with
             | Parsing.Parse_error ->

File src/Transformation/CWCPS/CWCPS_BetaContraction.ml

+(*
+ * Opifex
+ *
+ * Copyrights(C) 2012 by Pawel Wieczorek <wieczyk at gmail>
+ *)
+
+open CWCPS_AST
+open CWCPS_Transformation
+open Batteries
+
+(*************************************************************************************************
+ * Unused definitions
+ ************************************************************************************************)
+
+module BetaContraction = struct
+
+    let transformation variable_usage = function
+
+        (* optimalize unused fixs *)
+            
+        | _ ->
+            Transformation.NoChange
+end
+
+(*************************************************************************************************
+ * 
+ ************************************************************************************************)
+
+let bottomup_transformations = 
+    [ BetaContraction.transformation
+    ]
+
+let bottomup =
+    Transformation.bottomups_with_analysis
+        CWCPS_VariableUsageAnalysis.analyze
+        bottomup_transformations 
+