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

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/ssa-pp-fn.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/ssa-pp-fn.sml

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

revision 510, Tue Feb 8 16:12:38 2011 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 23  Line 23 
23      fun pr ((outS, _), s) = TextIO.output(outS, s)      fun pr ((outS, _), s) = TextIO.output(outS, s)
24      fun prl (out, l) = pr(out, concat l)      fun prl (out, l) = pr(out, concat l)
25    
26      fun typedVar x = String.concat [Ty.toString(Var.ty x), " ", Var.toString x]      fun typedVar x = String.concat [
27                Ty.toString(Var.ty x), " ", Var.toString x, "#", Int.toString(Var.useCount x)
28              ]
29    
30      fun assignToString (y, rhs) = let      fun assignToString (y, rhs) = let
31            val rhs = (case rhs            val rhs = (case rhs
# Line 68  Line 70 
70                          List.app                          List.app
71                            (fn assign => (indent out1; prl(out1, [assignToString assign, "\n"])))                            (fn assign => (indent out1; prl(out1, [assignToString assign, "\n"])))
72                              (!body))                              (!body))
73                      | IL.NEW{actor, args, ...} => (                      | IL.NEW{strand, args, ...} => (
74                          indent out1;                          indent out1;
75                          prl (out1, [                          prl (out1, [
76                              "new ", Atom.toString actor, "(",                              "new ", Atom.toString strand, "(",
77                              String.concatWith "," (List.map Var.toString args), ");\n"                              String.concatWith "," (List.map Var.toString args), ");\n"
78                            ]))                            ]))
79                      | IL.DIE _ => (indent out1; pr(out1, "die;\n"))                      | IL.DIE _ => (indent out1; pr(out1, "die;\n"))
# Line 103  Line 105 
105              indent out; prl(out, ["end ", Atom.toString name, "\n"])              indent out; prl(out, ["end ", Atom.toString name, "\n"])
106            end            end
107    
108      and ppActor (out, IL.Actor{name, params, state, stateInit, methods}) = let      and ppStrand (out, IL.Strand{name, params, state, stateInit, methods}) = let
109            val out1 = incIndent out            val out1 = incIndent out
110            fun prVars xs = List.app (fn x => prl(out, [" ", typedVar x, ";"])) xs            fun prVars xs = List.app (fn x => prl(out, [" ", typedVar x, ";"])) xs
111            in            in
112              indent out;              indent out;
113              prl(out, [              prl(out, [
114                  "actor ", Atom.toString name, " (",                  "strand ", Atom.toString name, " (",
115                  String.concatWith ", " (List.map typedVar params), ")\n"                  String.concatWith ", " (List.map typedVar params), ")\n"
116                ]);                ]);
117              indent out1; pr(out1, "state: "); prVars state; pr(out1, "\n");              indent out1; pr(out1, "state: "); prVars state; pr(out1, "\n");
# Line 118  Line 120 
120              indent out; prl(out, ["end ", Atom.toString name, "\n"])              indent out; prl(out, ["end ", Atom.toString name, "\n"])
121            end            end
122    
123      fun output (outS, msg, IL.Program{globals, globalInit, actors}) = let      fun output (outS, msg, IL.Program{globals, globalInit, strands}) = let
124            val out = (outS, 0)            val out = (outS, 0)
125            val out1 = incIndent out            val out1 = incIndent out
126            in            in
# Line 129  Line 131 
131                  globals;                  globals;
132              pr (out, "## global initialization\n");              pr (out, "## global initialization\n");
133              ppStmt (out1, globalInit);              ppStmt (out1, globalInit);
134              pr (out, "## actors\n");              pr (out, "## strands\n");
135              List.app (fn actor => ppActor(out1, actor)) actors;              List.app (fn strand => ppStrand(out1, strand)) strands;
136              pr (out, "#### end program ####\n")              pr (out, "#### end program ####\n")
137            end            end
138    

Legend:
Removed from v.510  
changed lines
  Added in v.511

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