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 397, Thu Oct 14 20:08:03 2010 UTC revision 398, Thu Oct 14 20:08:18 2010 UTC
# Line 16  Line 16 
16    
17      structure Op = IL.Op      structure Op = IL.Op
18      structure Var = IL.Var      structure Var = IL.Var
19        structure Ty = IL.Ty
20    
21      fun indent (outS, i) = TextIO.output(outS, StringCvt.padLeft #" " i "")      fun indent (outS, i) = TextIO.output(outS, StringCvt.padLeft #" " i "")
22      fun incIndent (outS, i) = (outS, i+2)      fun incIndent (outS, i) = (outS, i+2)
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]
27    
28      fun assignToString (y, rhs) = let      fun assignToString (y, rhs) = let
29            val rhs = (case rhs            val rhs = (case rhs
30                   of IL.VAR x => [Var.toString x, ";"]                   of IL.VAR x => [Var.toString x, ";"]
# Line 34  Line 37 
37                    | IL.CONS xs => ["[", String.concatWith "," (List.map Var.toString xs), "];"]                    | IL.CONS xs => ["[", String.concatWith "," (List.map Var.toString xs), "];"]
38                  (* end case *))                  (* end case *))
39            in            in
40              String.concat(Var.toString y :: " = " :: rhs)              String.concat(typedVar y :: " = " :: rhs)
41            end            end
42    
43      fun labelOf (IL.STM{id, ...}) = "L"^Stamp.toString id      fun labelOf (IL.STM{id, ...}) = "L"^Stamp.toString id
# Line 44  Line 47 
47            fun prPhi (y, xs) = (            fun prPhi (y, xs) = (
48                  indent out1;                  indent out1;
49                  prl (out1, [                  prl (out1, [
50                      Var.toString y, " = phi(",                      typedVar y, " = phi(",
51                      String.concatWith "," (List.map Var.toString xs), ")\n"                      String.concatWith "," (List.map Var.toString xs), ")\n"
52                    ]))                    ]))
53            in            in
# Line 91  Line 94 
94    
95      fun ppMethod (out, IL.Method{name, stateIn, stateOut, body}) = let      fun ppMethod (out, IL.Method{name, stateIn, stateOut, body}) = let
96            val out1 = incIndent out            val out1 = incIndent out
97            fun prVars xs = List.app (fn x => prl(out, [" ", Var.toString x])) xs            fun prVars xs = List.app (fn x => prl(out, [" ", typedVar x, ";"])) xs
98            in            in
99              indent out; prl(out, ["method ", Atom.toString name, "\n"]);              indent out; prl(out, ["method ", Atom.toString name, "\n"]);
100              indent out1; pr(out1, "state in: "); prVars stateIn; pr(out1, "\n");              indent out1; pr(out1, "state in: "); prVars stateIn; pr(out1, "\n");
# Line 102  Line 105 
105    
106      and ppActor (out, IL.Actor{name, params, state, stateInit, methods}) = let      and ppActor (out, IL.Actor{name, params, state, stateInit, methods}) = let
107            val out1 = incIndent out            val out1 = incIndent out
108            fun prVars xs = List.app (fn x => prl(out, [" ", Var.toString x])) xs            fun prVars xs = List.app (fn x => prl(out, [" ", typedVar x, ";"])) xs
109            in            in
110              indent out;              indent out;
111              prl(out, [              prl(out, [
112                  "actor ", Atom.toString name, " (",                  "actor ", Atom.toString name, " (",
113                  String.concatWith "," (List.map Var.toString params), ")\n"                  String.concatWith ", " (List.map typedVar params), ")\n"
114                ]);                ]);
115              indent out1; pr(out1, "state: "); prVars state; pr(out1, "\n");              indent out1; pr(out1, "state: "); prVars state; pr(out1, "\n");
116              ppStmt (incIndent out1, stateInit);              ppStmt (incIndent out1, stateInit);
# Line 121  Line 124 
124            in            in
125              pr (out, concat["##### ", msg, " ####\n"]);              pr (out, concat["##### ", msg, " ####\n"]);
126              pr (out, "## globals\n");              pr (out, "## globals\n");
127              List.app (fn x => (indent out1; prl(out1, ["global ", Var.toString x, "\n"]))) globals;              List.app
128                  (fn x => (indent out1; prl(out1, ["global ", typedVar x, "\n"])))
129                    globals;
130              pr (out, "## global initialization\n");              pr (out, "## global initialization\n");
131              ppStmt (out1, globalInit);              ppStmt (out1, globalInit);
132              pr (out, "## actors\n");              pr (out, "## actors\n");

Legend:
Removed from v.397  
changed lines
  Added in v.398

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