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 651, Thu Jun 1 18:34:03 2000 UTC revision 1183, Fri Mar 29 19:09:48 2002 UTC
# Line 3  Line 3 
3    
4  signature PPCPS =  signature PPCPS =
5  sig  sig
6    val printcps : (CPS.function * LtyDef.lty Intmap.intmap) -> unit    val printcps : (CPS.function * LtyDef.lty IntHashTable.hash_table) -> unit
7    val printcps0: CPS.function -> unit    val printcps0: CPS.function -> unit
8    val prcps : CPS.cexp -> unit    val prcps : CPS.cexp -> unit
9    
# Line 33  Line 33 
33    | lookerName P.deflvar = "deflvar"    | lookerName P.deflvar = "deflvar"
34    | lookerName P.getspecial = "getspecial"    | lookerName P.getspecial = "getspecial"
35    | lookerName P.getpseudo = "getpseudo"    | lookerName P.getpseudo = "getpseudo"
36      | lookerName (P.rawload {kind}) = ("rawload" ^ numkindName kind)
37    
38  fun branchName P.boxed = "boxed"  fun branchName P.boxed = "boxed"
39    | branchName P.unboxed = "unboxed"    | branchName P.unboxed = "unboxed"
# Line 83  Line 84 
84    | setterName P.setpseudo = "setpseudo"    | setterName P.setpseudo = "setpseudo"
85    | setterName P.setmark = "setmark"    | setterName P.setmark = "setmark"
86    | setterName P.acclink = "acclink"    | setterName P.acclink = "acclink"
87      | setterName (P.rawstore {kind}) = ("rawstore" ^ numkindName kind)
88      | setterName (P.rawupdate cty) = ("rawupdate" ^ CPS.ctyToString cty)
89    
90  fun cvtParams(from, to) = Int.toString from ^ "_" ^ Int.toString to  fun cvtParams(from, to) = Int.toString from ^ "_" ^ Int.toString to
91    
92  fun arithName (P.arith{oper,kind}) =  fun arithName (P.arith{oper,kind}) =
93      ((case oper of  P.+ => "+" |  P.- => "-" |  P.* => "*"      ((case oper of  P.+ => "+" |  P.- => "-" |  P.* => "*"
94                    | P./ => "/" |  P.~ => "~" | P.abs => "abs"                    | P./ => "/" |  P.~ => "~" | P.abs => "abs"
95                      | P.fsqrt => "fsqrt"
96                      | P.fsin => "sin" | P.fcos => "cos" | P.ftan => "tan"
97                    | P.rshift => "rshift" | P.rshiftl => "rshiftl"                    | P.rshift => "rshift" | P.rshiftl => "rshiftl"
98                    | P.lshift => "lshift" | P.andb => "andb"                    | P.lshift => "lshift" | P.andb => "andb"
99                    | P.orb => "orb" | P.xorb => "xorb" | P.notb => "notb")                    | P.orb => "orb" | P.xorb => "xorb" | P.notb => "notb"
100                      | P.rem => "rem" | P.div => "div" | P.mod => "mod")
101       ^ numkindName kind)       ^ numkindName kind)
102    | arithName(P.test arg) = "test_" ^ cvtParams arg    | arithName(P.test arg) = "test_" ^ cvtParams arg
103    | arithName(P.testu arg) = "testu_" ^ cvtParams arg    | arithName(P.testu arg) = "testu_" ^ cvtParams arg
# Line 132  Line 138 
138    | pureName P.recsubscript = "recsubscript"    | pureName P.recsubscript = "recsubscript"
139    | pureName P.raw64subscript = "raw64subscript"    | pureName P.raw64subscript = "raw64subscript"
140    | pureName P.newarray0 = "newarray0"    | pureName P.newarray0 = "newarray0"
141      | pureName (P.rawrecord rk) =
142        "rawrecord_"^getOpt(Option.map rkstring rk, "notag")
143      | pureName (P.condmove b) = "condmove "^branchName b
144    
145    and rkstring rk = (case rk
146            of RK_VECTOR => "RK_VECTOR"
147             | RK_RECORD => "RK_RECORD"
148             | RK_SPILL => "RK_SPILL"
149             | RK_ESCAPE => "RK_ESCAPE"
150             | RK_EXN => "RK_EXN"
151             | RK_CONT => "RK_CONT"
152             | RK_FCONT => "RK_FCONT"
153             | RK_KNOWN => "RK_KNOWN"
154             | RK_BLOCK => "RK_BLOCK"
155             | RK_FBLOCK => "RK_FBLOCK"
156             | RK_I32BLOCK => "RK_I32BLOCK")
157    
158    
159  fun show0 say =  fun show0 say =
160    let fun sayc (#"\n") = say "\\n"    let fun sayc (#"\n") = say "\\n"
# Line 151  Line 174 
174          | sayvlist (v::vl) = (sayv v; say ","; sayvlist vl)          | sayvlist (v::vl) = (sayv v; say ","; sayvlist vl)
175    
176    
       fun rkstring rk = (case rk  
         of RK_VECTOR => "RK_VECTOR"  
          | RK_RECORD => "RK_RECORD"  
          | RK_SPILL => "RK_SPILL"  
          | RK_ESCAPE => "RK_ESCAPE"  
          | RK_EXN => "RK_EXN"  
          | RK_CONT => "RK_CONT"  
          | RK_FCONT => "RK_FCONT"  
          | RK_KNOWN => "RK_KNOWN"  
          | RK_BLOCK => "RK_BLOCK"  
          | RK_FBLOCK => "RK_FBLOCK"  
          | RK_I32BLOCK => "RK_I32BLOCK")  
   
177        fun sayrk(RK_RECORD,n) = ()        fun sayrk(RK_RECORD,n) = ()
178          | sayrk(RK_VECTOR,n) = ()          | sayrk(RK_VECTOR,n) = ()
179          | sayrk(k,n : int) = (say (rkstring k); say " ";          | sayrk(k,n : int) = (say (rkstring k); say " ";
# Line 236  Line 246 
246                      indent (n+3) e1;                      indent (n+3) e1;
247                      space n; say "else\n";                      space n; say "else\n";
248                      indent (n+3) e2)                      indent (n+3) e2)
249                  | RCC(k,l,p,vl,w,t,e) =>
250                       (space n;
251                        if k = REENTRANT_RCC then say "reentrant " else ();
252                        if l = "" then () else (say l; say " ");
253                        say "rcc("; sayvlist vl; say ") -> "; sayv(VAR w);
254                        sayt(t);nl(); f e)
255           in f           in f
256          end          end
257   in  indent   in  indent
# Line 247  Line 263 
263    
264      val _ = if (!Control.CG.debugRep)      val _ = if (!Control.CG.debugRep)
265              then (say "************************************************\n";              then (say "************************************************\n";
266                    Intmap.app ptv m;                    IntHashTable.appi ptv m;
267                    say "************************************************\n")                    say "************************************************\n")
268              else ()              else ()
269    
# Line 263  Line 279 
279  end  end
280    
281  exception NULLTABLE  exception NULLTABLE
282  val nulltable : LtyDef.lty Intmap.intmap= Intmap.new(8,NULLTABLE)  val nulltable : LtyDef.lty IntHashTable.hash_table =
283        IntHashTable.mkTable(8,NULLTABLE)
284    
285  fun printcps0 f = printcps(f,nulltable)  fun printcps0 f = printcps(f,nulltable)
286    

Legend:
Removed from v.651  
changed lines
  Added in v.1183

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