Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/compiler/CPS/cps/ppcps.sml
ViewVC logotype

Diff of /sml/trunk/compiler/CPS/cps/ppcps.sml

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

revision 4527, Sat Apr 14 14:41:11 2018 UTC revision 4540, Wed Apr 25 17:06:35 2018 UTC
# Line 1  Line 1 
1  (* ppcps.sml  (* ppcps.sml
2   *   *
3   * COPYRIGHT (c) 2017 The Fellowship of SML/NJ (http://www.smlnj.org)   * COPYRIGHT (c) 2018 The Fellowship of SML/NJ (http://www.smlnj.org)
4   * All rights reserved.   * All rights reserved.
5   *)   *)
6    
7  signature PPCPS =  signature PPCPS =
8  sig  sig
9    
10        val value2str : CPS.value -> string
11    
12    val printcps : (CPS.function * LtyDef.lty IntHashTable.hash_table) -> unit    val printcps : (CPS.function * LtyDef.lty IntHashTable.hash_table) -> unit
13    val printcps0: CPS.function -> unit    val printcps0: CPS.function -> unit
14    val prcps : CPS.cexp -> unit    val prcps : CPS.cexp -> unit
# Line 23  Line 26 
26    
27  val sayt = say o CPS.ctyToString  val sayt = say o CPS.ctyToString
28    
29    fun value2str (VAR v) = LV.lvarName v
30      | value2str (LABEL v) = "(L)" ^ LV.lvarName v
31      | value2str (INT i) = "(I)" ^ Int.toString i
32      | value2str (INT32 i) = "(I32)" ^ Word32.toString i
33      | value2str (REAL{rval, ty}) = concat[
34            "(R", Int.toString ty, ")", RealLit.toString rval
35          ]
36      | value2str (STRING s) = concat["\"", String.toString s, "\""]
37      | value2str (OBJECT _) = "(object)"
38      | value2str (VOID) = "(void)"
39    
40  fun numkindName (P.INT bits) = "i" ^ Int.toString bits  fun numkindName (P.INT bits) = "i" ^ Int.toString bits
41    | numkindName (P.UINT bits) = "u" ^ Int.toString bits    | numkindName (P.UINT bits) = "u" ^ Int.toString bits
42    | numkindName (P.FLOAT bits) = "f" ^ Int.toString bits    | numkindName (P.FLOAT bits) = "f" ^ Int.toString bits
# Line 160  Line 174 
174           | RK_FBLOCK => "RK_FBLOCK"           | RK_FBLOCK => "RK_FBLOCK"
175           | RK_I32BLOCK => "RK_I32BLOCK")           | RK_I32BLOCK => "RK_I32BLOCK")
176    
   
177  fun show0 say =  fun show0 say =
178    let fun sayc (#"\n") = say "\\n"    let fun sayc (#"\n") = say "\\n"
179          | sayc c = say(String.str c)          | sayc c = say(String.str c)
180    
181        fun sayv(VAR v) = say(LV.lvarName v)        fun sayv v = say(value2str v)
         | sayv(LABEL v) = say("(L)" ^ LV.lvarName v)  
         | sayv(INT i) = say("(I)" ^ Int.toString i)  
         | sayv(INT32 i) = say("(I32)" ^ Word32.toString i)  
         | sayv(REAL r) = say("(R64)" ^ RealLit.toString r)  
         | sayv(STRING s) = (say "\""; app sayc (explode s); say "\"")  
         | sayv(OBJECT _) = say("(object)")  
         | sayv(VOID) = say("(void)")  
182    
183        fun sayvlist [v] = sayv v        fun sayvlist [v] = sayv v
184          | sayvlist nil = ()          | sayvlist nil = ()
185          | sayvlist (v::vl) = (sayv v; say ","; sayvlist vl)          | sayvlist (v::vl) = (sayv v; say ","; sayvlist vl)
186    
   
187        fun sayrk(RK_RECORD,n) = ()        fun sayrk(RK_RECORD,n) = ()
188          | sayrk(RK_VECTOR,n) = ()          | sayrk(RK_VECTOR,n) = ()
189          | sayrk(k,n : int) = (say (rkstring k); say " ";          | sayrk(k,n : int) = (say (rkstring k); say " ";

Legend:
Removed from v.4527  
changed lines
  Added in v.4540

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