Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/expr-fn.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/expr-fn.sml

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

revision 1922, Sat Jun 23 11:25:39 2012 UTC revision 1923, Sat Jun 23 12:02:18 2012 UTC
# Line 19  Line 19 
19        | LIT of Literal.literal        | LIT of Literal.literal
20        | OP of Op.rator * expr list        | OP of Op.rator * expr list
21        | MULTIOP of int * Op.rator * expr list     (* n'th result of operator in multi-assignment *)        | MULTIOP of int * Op.rator * expr list     (* n'th result of operator in multi-assignment *)
22        | APPLY of ILBasis.name * expr list        | APPLY of MathFuns.name * expr list
23        | CONS of IL.Ty.ty * expr list        | CONS of IL.Ty.ty * expr list
24        | PHI of expr list        | PHI of expr list
25    
# Line 38  Line 38 
38      val mkLIT   : tbl -> Literal.literal -> expr      val mkLIT   : tbl -> Literal.literal -> expr
39      val mkOP    : tbl -> Op.rator * expr list -> expr      val mkOP    : tbl -> Op.rator * expr list -> expr
40      val mkMULTIOP : tbl -> int * Op.rator * expr list -> expr      val mkMULTIOP : tbl -> int * Op.rator * expr list -> expr
41      val mkAPPLY : tbl -> ILBasis.name * expr list -> expr      val mkAPPLY : tbl -> MathFuns.name * expr list -> expr
42      val mkCONS  : tbl -> IL.Ty.ty * expr list -> expr      val mkCONS  : tbl -> IL.Ty.ty * expr list -> expr
43      val mkPHI   : tbl -> expr list -> expr      val mkPHI   : tbl -> expr list -> expr
44    
# Line 62  Line 62 
62        | LIT of Literal.literal        | LIT of Literal.literal
63        | OP of Op.rator * expr list        | OP of Op.rator * expr list
64        | MULTIOP of int * Op.rator * expr list     (* n'th result of operator *)        | MULTIOP of int * Op.rator * expr list     (* n'th result of operator *)
65        | APPLY of ILBasis.name * expr list        | APPLY of MathFuns.name * expr list
66        | CONS of IL.Ty.ty * expr list        | CONS of IL.Ty.ty * expr list
67        | PHI of expr list        | PHI of expr list
68    
# Line 79  Line 79 
79        | sameNd (MULTIOP(i1, op1, args1), MULTIOP(i2, op2, args2)) =        | sameNd (MULTIOP(i1, op1, args1), MULTIOP(i2, op2, args2)) =
80            (i1 = i2) andalso Op.same(op1, op2) andalso same'(args1, args2)            (i1 = i2) andalso Op.same(op1, op2) andalso same'(args1, args2)
81        | sameNd (APPLY(f1, args1), APPLY(f2, args2)) =        | sameNd (APPLY(f1, args1), APPLY(f2, args2)) =
82            ILBasis.same(f1, f2) andalso same'(args1, args2)            MathFuns.same(f1, f2) andalso same'(args1, args2)
83        | sameNd (CONS(_, args1), CONS(_, args2)) = same'(args1, args2)        | sameNd (CONS(_, args1), CONS(_, args2)) = same'(args1, args2)
84        | sameNd (PHI args1, PHI args2) = same'(args1, args2)        | sameNd (PHI args1, PHI args2) = same'(args1, args2)
85        | sameNd _ = false        | sameNd _ = false
# Line 93  Line 93 
93                    | MULTIOP(i, rator, args) =>                    | MULTIOP(i, rator, args) =>
94                        "#" :: Int.toString i :: "(" :: Op.toString rator :: "("                        "#" :: Int.toString i :: "(" :: Op.toString rator :: "("
95                          :: argsToS (args, "))" :: l)                          :: argsToS (args, "))" :: l)
96                    | APPLY(f, args) => ILBasis.toString f :: "(" :: argsToS (args, ")" :: l)                    | APPLY(f, args) => MathFuns.toString f :: "(" :: argsToS (args, ")" :: l)
97                    | CONS(ty, args) => "<" :: IL.Ty.toString ty :: ">[" :: argsToS (args, "]" :: l)                    | CONS(ty, args) => "<" :: IL.Ty.toString ty :: ">[" :: argsToS (args, "]" :: l)
98                    | PHI args => "PHI(" :: argsToS (args, ")" :: l)                    | PHI args => "PHI(" :: argsToS (args, ")" :: l)
99                  (* end case *))                  (* end case *))
# Line 109  Line 109 
109    
110      fun new () = Tbl(HC.new{eq = sameNd})      fun new () = Tbl(HC.new{eq = sameNd})
111    
112  (* FIXME: need a new prime! *)      fun mkSTATE (Tbl tbl) x = HC.cons0 tbl (0w7477 + IL.StateVar.hash x, STATE x)
     fun mkSTATE (Tbl tbl) x = HC.cons0 tbl (0w7919 + IL.StateVar.hash x, STATE x)  
113      fun mkVAR (Tbl tbl) x = HC.cons0 tbl (0w7919 + IL.Var.hash x, VAR x)      fun mkVAR (Tbl tbl) x = HC.cons0 tbl (0w7919 + IL.Var.hash x, VAR x)
114      fun mkLIT (Tbl tbl) a = HC.cons0 tbl (0w6997 + Literal.hash a, LIT a)      fun mkLIT (Tbl tbl) a = HC.cons0 tbl (0w6997 + Literal.hash a, LIT a)
115      fun mkOP (Tbl tbl) (rator, args) =      fun mkOP (Tbl tbl) (rator, args) =
# Line 118  Line 117 
117      fun mkMULTIOP (Tbl tbl) (i, rator, args) =      fun mkMULTIOP (Tbl tbl) (i, rator, args) =
118            HC.consList tbl (Op.hash rator + Word.fromInt i, fn args => OP(rator, args)) args            HC.consList tbl (Op.hash rator + Word.fromInt i, fn args => OP(rator, args)) args
119      fun mkAPPLY (Tbl tbl) (f, args) =      fun mkAPPLY (Tbl tbl) (f, args) =
120            HC.consList tbl (ILBasis.hash f, fn args => APPLY(f, args)) args            HC.consList tbl (MathFuns.hash f, fn args => APPLY(f, args)) args
121      fun mkCONS (Tbl tbl) (ty, args) =      fun mkCONS (Tbl tbl) (ty, args) =
122            HC.consList tbl (0w5987, fn args => CONS(ty, args)) args            HC.consList tbl (0w5987, fn args => CONS(ty, args)) args
123      fun mkPHI (Tbl tbl) args = HC.consList tbl (0w6079, PHI) args      fun mkPHI (Tbl tbl) args = HC.consList tbl (0w6079, PHI) args

Legend:
Removed from v.1922  
changed lines
  Added in v.1923

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