Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/translate/translate.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/translate/translate.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1572, Fri Oct 28 21:45:29 2011 UTC revision 1573, Fri Oct 28 21:46:49 2011 UTC
# Line 30  Line 30 
30    (* maps from SimpleAST variables to the current corresponding SSA variable *)    (* maps from SimpleAST variables to the current corresponding SSA variable *)
31      type env = IL.var VMap.map      type env = IL.var VMap.map
32    
33    (* +DEBUG *)
34        fun prEnv (prefix, env) = let
35              val wid = ref 0
36              fun pr s = (print s; wid := !wid + size s)
37              fun nl () = if (!wid > 0) then (print "\n"; wid := 0) else ()
38              fun prElem (src, dst) = let
39                    val s = String.concat [
40                            " ", Var.uniqueNameOf src, "->", IL.Var.toString dst
41                          ]
42                    in
43                      pr s;
44                      if (!wid >= 100) then (nl(); pr " ") else ()
45                    end
46              in
47                pr prefix; pr " ENV: {"; nl(); pr " ";
48                VMap.appi prElem env;
49                nl(); pr "}"; nl()
50              end
51    (* -DEBUG *)
52    
53      fun lookup env x = (case VMap.find (env, x)      fun lookup env x = (case VMap.find (env, x)
54             of SOME x' => x'             of SOME x' => x'
55              | NONE => raise Fail(concat[              | NONE => raise Fail(concat[
# Line 178  Line 198 
198                ListPair.foldlEq save IL.CFG.empty (dstState, stateOut),                ListPair.foldlEq save IL.CFG.empty (dstState, stateOut),
199                exit)                exit)
200            end            end
201    handle ex => raise ex
202    
203      fun cvtBlock (state, env : env, joinStk, S.Block stms) = let      fun cvtBlock (state, env : env, joinStk, S.Block stms) = let
204            fun cvt (env : env, cfg, []) = (cfg, env)            fun cvt (env : env, cfg, []) = (cfg, env)
# Line 309  Line 330 
330                    | StrandUtil.Stabilize => IL.Node.mkRETURN []                    | StrandUtil.Stabilize => IL.Node.mkRETURN []
331                  (* end case *))                  (* end case *))
332            val body = IL.CFG.concat (loadCFG, cfg)            val body = IL.CFG.concat (loadCFG, cfg)
333    (*DEBUG**val _ = prEnv (StrandUtil.nameToString name, env);*)
334    (* FIXME: the following code doesn't work properly *)
335            val body = if IL.Node.hasSucc(IL.CFG.exit body)            val body = if IL.Node.hasSucc(IL.CFG.exit body)
336                  then IL.CFG.concat (body, saveStrandState (env, (state, svars), exit))                  then IL.CFG.concat (body, saveStrandState (env, (state, svars), exit))
337                  else IL.CFG{entry = IL.CFG.entry body, exit = exit}                  else IL.CFG{entry = IL.CFG.entry body, exit = exit}

Legend:
Removed from v.1572  
changed lines
  Added in v.1573

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0