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 4949, Sun Apr 7 12:50:20 2019 UTC revision 4953, Mon Apr 8 17:31:53 2019 UTC
# Line 20  Line 20 
20    
21  local open CPS  local open CPS
22        structure LV = LambdaVar        structure LV = LambdaVar
23          structure U = CPSUtil
24  in  in
25    
26  val say = Control.Print.say  val say = Control.Print.say
27    
28  val sayt = say o CPS.ctyToString  val sayt = say o U.ctyToString
29    
30  fun value2str (VAR v) = LV.lvarName v  fun value2str (VAR v) = LV.lvarName v
31    | value2str (LABEL v) = "(L)" ^ LV.lvarName v    | value2str (LABEL v) = "(L)" ^ LV.lvarName v
# Line 56  Line 57 
57    | branchName (P.cmp{oper, kind}) =    | branchName (P.cmp{oper, kind}) =
58      (numkindName kind ^      (numkindName kind ^
59       (case oper       (case oper
60        of P.>   => ">"        of P.GT   => ">"
61         | P.<   => "<"         | P.LT   => "<"
62         | P.>=  => ">="         | P.GTE  => ">="
63         | P.<=  => "<="         | P.LTE  => "<="
64         | P.eql => "="         | P.EQL => "="
65         | P.neq => "<>"         | P.NEQ => "<>"
66        (*esac*)))        (*esac*)))
67    | branchName(P.fcmp{oper, size}) =    | branchName(P.fcmp{oper, size}) =
68      (numkindName (P.FLOAT size) ^      (numkindName (P.FLOAT size) ^
# Line 96  Line 97 
97    | setterName P.setvar = "setvar"    | setterName P.setvar = "setvar"
98    | setterName P.setspecial = "setspecial"    | setterName P.setspecial = "setspecial"
99    | setterName (P.rawstore {kind}) = ("rawstore" ^ numkindName kind)    | setterName (P.rawstore {kind}) = ("rawstore" ^ numkindName kind)
100    | setterName (P.rawupdate cty) = ("rawupdate" ^ CPS.ctyToString cty)    | setterName (P.rawupdate cty) = ("rawupdate" ^ U.ctyToString cty)
101    
102  val cvtParam = Int.toString  val cvtParam = Int.toString
103  fun cvtParams(from, to) = concat [cvtParam from, "_", cvtParam to]  fun cvtParams(from, to) = concat [cvtParam from, "_", cvtParam to]
104    
105  fun arithName (P.arith{oper,kind}) =  fun arithName (P.arith{oper,kind}) =
106      ((case oper of  P.+ => "+" |  P.- => "-" |  P.* => "*"      ((case oper of  P.ADD => "+" |  P.SUB => "-" |  P.MUL => "*"
107                    | P./ => "/" |  P.~ => "~" | P.abs => "abs"                    | P.DIV => "div" | P.MOD => "mod"
108                    | P.fsqrt => "fsqrt"                    | P.QUOT => "quot" | P.REM => "rem"
109                    | P.fsin => "sin" | P.fcos => "cos" | P.ftan => "tan"                    | P.FDIV => "/"
110                    | P.rshift => "rshift" | P.rshiftl => "rshiftl"                    | P.NEG => "~" | P.ABS => "abs"
111                    | P.lshift => "lshift" | P.andb => "andb"                    | P.FSQRT => "fsqrt"
112                    | P.orb => "orb" | P.xorb => "xorb" | P.notb => "notb"                    | P.FSIN => "sin" | P.FCOS => "cos" | P.FTAN => "tan"
113                    | P.rem => "rem" | P.div => "div" | P.mod => "mod")                    | P.RSHIFT => "rshift" | P.RSHIFTL => "rshiftl"
114                      | P.LSHIFT => "lshift" | P.ANDB => "andb"
115                      | P.ORB => "orb" | P.XORB => "xorb" | P.NOTB => "notb")
116       ^ numkindName kind)       ^ numkindName kind)
117    | arithName(P.test arg) = "test_" ^ cvtParams arg    | arithName(P.test arg) = "test_" ^ cvtParams arg
118    | arithName(P.testu arg) = "testu_" ^ cvtParams arg    | arithName(P.testu arg) = "testu_" ^ cvtParams arg

Legend:
Removed from v.4949  
changed lines
  Added in v.4953

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