From ba8ad207029d3121d602a23aeeedd55b4dfd192a Mon Sep 17 00:00:00 2001 From: xleroy Date: Sat, 5 Jan 2013 09:28:24 +0000 Subject: Print Swhile loops. Fix indentation. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2088 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/ExportClight.ml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'cfrontend') diff --git a/cfrontend/ExportClight.ml b/cfrontend/ExportClight.ml index e456d6e..d7a80a5 100644 --- a/cfrontend/ExportClight.ml +++ b/cfrontend/ExportClight.ml @@ -266,29 +266,33 @@ let rec stmt p = function | Ssequence(s1, Sskip) -> stmt p s1 | Ssequence(s1, s2) -> - fprintf p "@[(Ssequence@ %a@ %a)@]" stmt s1 stmt s2 + fprintf p "@[(Ssequence@ %a@ %a)@]" stmt s1 stmt s2 | Sifthenelse(e, s1, s2) -> - fprintf p "@[(Sifthenelse %a@ %a@ %a)@]" expr e stmt s1 stmt s2 + fprintf p "@[(Sifthenelse %a@ %a@ %a)@]" expr e stmt s1 stmt s2 + | Sloop (Ssequence (Sifthenelse(e, Sskip, Sbreak), s), Sskip) -> + fprintf p "@[(Swhile@ %a@ %a)@]" expr e stmt s + | Sloop (Ssequence (Ssequence(Sskip, Sifthenelse(e, Sskip, Sbreak)), s), Sskip) -> + fprintf p "@[(Swhile@ %a@ %a)@]" expr e stmt s | Sloop(s1, s2) -> - fprintf p "@[(Sloop %a@ %a)@]" stmt s1 stmt s2 + fprintf p "@[(Sloop@ %a@ %a)@]" stmt s1 stmt s2 | Sbreak -> fprintf p "Sbreak" | Scontinue -> fprintf p "Scontinue" | Sswitch(e, cases) -> - fprintf p "@[(Sswitch %a@ %a)@]" expr e lblstmts cases + fprintf p "@[(Sswitch %a@ %a)@]" expr e lblstmts cases | Sreturn e -> - fprintf p "@[(Sreturn %a)@]" (print_option expr) e + fprintf p "@[(Sreturn %a)@]" (print_option expr) e | Slabel(lbl, s1) -> - fprintf p "@[(Slabel %a@ %a)@]" ident lbl stmt s1 + fprintf p "@[(Slabel %a@ %a)@]" ident lbl stmt s1 | Sgoto lbl -> fprintf p "(Sgoto %a)" ident lbl and lblstmts p = function | LSdefault s -> - fprintf p "@[(LSdefault@ %a)@]" stmt s + fprintf p "@[(LSdefault@ %a)@]" stmt s | LScase(lbl, s, ls) -> - fprintf p "@[(LScase %a@ %a@ %a)@]" coqint lbl stmt s lblstmts ls + fprintf p "@[(LScase %a@ %a@ %a)@]" coqint lbl stmt s lblstmts ls let print_function p (id, f) = fprintf p "Definition f_%s := {|@ " (extern_atom id); -- cgit v1.2.3