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 349, Fri Sep 24 00:24:20 2010 UTC revision 350, Fri Sep 24 01:04:36 2010 UTC
# Line 8  Line 8 
8    
9  functor SSAPPFn (IL : SSA) : sig  functor SSAPPFn (IL : SSA) : sig
10    
11        val assignToString : IL.assign -> string
12    
13      val output : TextIO.outstream * string * IL.program -> unit      val output : TextIO.outstream * string * IL.program -> unit
14    
15    end = struct    end = struct
# Line 20  Line 22 
22      fun pr ((outS, _), s) = TextIO.output(outS, s)      fun pr ((outS, _), s) = TextIO.output(outS, s)
23      fun prl (out, l) = pr(out, concat l)      fun prl (out, l) = pr(out, concat l)
24    
25      fun ppRHS (out, IL.VAR x) = pr(out, Var.toString x)      fun assignToString (y, rhs) = let
26        | ppRHS (out, IL.LIT lit) = pr(out, Literal.toString lit)            val rhs = (case rhs
27        | ppRHS (out, IL.OP(rator, [])) = pr(out, Op.toString rator)                   of IL.VAR x => [Var.toString x, ";"]
28        | ppRHS (out, IL.OP(rator, args)) = prl (out, [                    | IL.LIT lit => [Literal.toString lit, ";"]
29              Op.toString rator, "(", String.concatWith "," (List.map Var.toString args), ")"                    | IL.OP(rator, []) => [Op.toString rator, ";"]
30            ])                    | IL.OP(rator, args) => [
31        | ppRHS (out, IL.CONS xs) =                          Op.toString rator, "(",
32            prl (out, ["[", String.concatWith "," (List.map Var.toString xs), "]"])                          String.concatWith "," (List.map Var.toString args), ");"
33                          ]
34                      | IL.CONS xs => ["[", String.concatWith "," (List.map Var.toString xs), "];"]
35                    (* end case *))
36              in
37                String.concat(Var.toString y :: " = " :: rhs)
38              end
39    
40      fun labelOf (IL.STM{id, ...}) = "L"^Stamp.toString id      fun labelOf (IL.STM{id, ...}) = "L"^Stamp.toString id
41    
# Line 55  Line 63 
63                      | IL.BLOCK{body=ref [], ...} => (indent out1; pr (out, "empty;\n"))                      | IL.BLOCK{body=ref [], ...} => (indent out1; pr (out, "empty;\n"))
64                      | IL.BLOCK{body, ...} => (                      | IL.BLOCK{body, ...} => (
65                          List.app                          List.app
66                            (fn (y, rhs) => (                            (fn assign => (indent out1; prl(out1, [assignToString assign, "\n"])))
67                                indent out1;                              (!body))
                               prl(out1, [Var.toString y, " = "]); ppRHS(out1, rhs); pr(out1, ";\n"))  
                           ) (!body))  
68                      | IL.NEW{actor, args, ...} => (                      | IL.NEW{actor, args, ...} => (
69                          indent out1;                          indent out1;
70                          prl (out1, [                          prl (out1, [

Legend:
Removed from v.349  
changed lines
  Added in v.350

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