From 218a54543d24f82f2b85e80f55b8300e1b6aee31 Mon Sep 17 00:00:00 2001 From: Paweł Dybiec Date: Sun, 27 Jan 2019 14:13:33 +0100 Subject: Constant folding optimization - sources --- source/mod_student/constant_folding.ml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 source/mod_student/constant_folding.ml (limited to 'source/mod_student/constant_folding.ml') diff --git a/source/mod_student/constant_folding.ml b/source/mod_student/constant_folding.ml new file mode 100644 index 0000000..3bebcfa --- /dev/null +++ b/source/mod_student/constant_folding.ml @@ -0,0 +1,31 @@ +open Xi_lib +open Ir + +module Make(T:Iface.COMPILER_TOOLBOX) = struct + + module Implementation(M:sig + val cfg : ControlFlowGraph.t + val proc : procedure + end) = struct + + open M + + let cfa = T.ConstantFoldingAnalysis.analyse proc + + let rewrite () = + Logger.extra_debug begin fun () -> + Logger.dump_constant_folding "before-optimization" cfg cfa; + end; + failwith "not yet implemeneted" + + end + + + let fold_constants proc = + let module Instance = Implementation(struct + let proc = proc + let cfg = cfg_of_procedure proc + end) in + Instance.rewrite () + +end \ No newline at end of file -- cgit 1.4.1