| Attached Files | 0001-Print-clambda-when-option-dclambda-is-present.patch [^] (1,581 bytes) 2012-10-11 09:48 [Show Content] [Hide Content]From 32df36842f98306c404a529da77d2160733049de Mon Sep 17 00:00:00 2001
From: Pierre Chambart <pierre.chambart@ocamlpro.org>
Date: Thu, 11 Oct 2012 09:39:05 +0200
Subject: [PATCH] Print clambda when option -dclambda is present
---
asmcomp/asmgen.ml | 4 ++++
asmcomp/printclambda.ml | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/asmcomp/asmgen.ml b/asmcomp/asmgen.ml
index 5f513db..7317c5e 100644
--- a/asmcomp/asmgen.ml
+++ b/asmcomp/asmgen.ml
@@ -37,6 +37,9 @@ let pass_dump_linear_if ppf flag message phrase =
if !flag then fprintf ppf "*** %s@.%a@." message Printlinear.fundecl phrase;
phrase
+let clambda_dump_if ppf ulambda =
+ if !dump_clambda then Printclambda.clambda ppf ulambda; ulambda
+
let rec regalloc ppf round fd =
if round > 50 then
fatal_error(fd.Mach.fun_name ^
@@ -104,6 +107,7 @@ let compile_implementation ?toplevel prefixname ppf (size, lam) =
Emitaux.output_channel := oc;
Emit.begin_assembly();
Closure.intro size lam
+ ++ clambda_dump_if ppf
++ Cmmgen.compunit size
++ List.iter (compile_phrase ppf) ++ (fun () -> ());
(match toplevel with None -> () | Some f -> compile_genfuns ppf f);
diff --git a/asmcomp/printclambda.ml b/asmcomp/printclambda.ml
index fdb048d..8d3fc04 100644
--- a/asmcomp/printclambda.ml
+++ b/asmcomp/printclambda.ml
@@ -128,4 +128,5 @@ and sequence ppf ulam = match ulam with
fprintf ppf "%a@ %a" sequence l1 sequence l2
| _ -> lam ppf ulam
-let clambda = lam
+let clambda ppf ulam =
+ fprintf ppf "%a@." lam ulam
--
1.7.10.4
|