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

# SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/ssa-fn.sml
 [diderot] / trunk / src / compiler / IL / ssa-fn.sml

# Diff of /trunk/src/compiler/IL/ssa-fn.sml

revision 1922, Sat Jun 23 11:25:39 2012 UTC revision 1923, Sat Jun 23 12:02:18 2012 UTC
# Line 98  Line 98
98        | VAR of var        | VAR of var
99        | LIT of Literal.literal        | LIT of Literal.literal
100        | OP of Op.rator * var list        | OP of Op.rator * var list
101        | APPLY of ILBasis.name * var list (* basis function application *)        | APPLY of MathFuns.name * var list (* basis function application *)
102        | CONS of Ty.ty * var list        (* tensor/sequence-value construction *)        | CONS of Ty.ty * var list        (* tensor/sequence-value construction *)
103
104      and var = V of {      and var = V of {
# Line 172  Line 172
172        (* properties *)        (* properties *)
173          fun newProp initFn = PropList.newProp (fn (SV{props, ...}) => props, initFn)          fun newProp initFn = PropList.newProp (fn (SV{props, ...}) => props, initFn)
174          fun newFlag () = PropList.newFlag (fn (SV{props, ...}) => props)          fun newFlag () = PropList.newFlag (fn (SV{props, ...}) => props)
175          (* collections *)
176          local          local
177            structure V =            structure V =
178              struct              struct
# Line 213  Line 214
214        (* properties *)        (* properties *)
215          fun newProp initFn = PropList.newProp (fn (V{props, ...}) => props, initFn)          fun newProp initFn = PropList.newProp (fn (V{props, ...}) => props, initFn)
216          fun newFlag () = PropList.newFlag (fn (V{props, ...}) => props)          fun newFlag () = PropList.newFlag (fn (V{props, ...}) => props)
217          (* collections *)
218          local          local
219            structure V =            structure V =
220              struct              struct
# Line 491  Line 493
493
494        (* apply a function to all of the nodes in the graph rooted at the entry to the statement *)        (* apply a function to all of the nodes in the graph rooted at the entry to the statement *)
495          fun apply (f : node -> unit) (CFG{entry, ...}) = let          fun apply (f : node -> unit) (CFG{entry, ...}) = let
496                val {getFn, setFn} = PropList.newFlag (fn (ND{props, ...}) => props)                val {getFn, setFn} = Node.newFlag()
497                fun dfs (nd, l) =                fun dfs (nd, l) =
498                      if getFn nd                      if getFn nd
499                        then l                        then l
# Line 639  Line 641
641                end                end
642
643          fun app f = let          fun app f = let
644                fun mapf rhs = (case rhs                fun appf rhs = (case rhs
645                       of STATE _ => ()                       of STATE _ => ()
646                        | VAR x => f x                        | VAR x => f x
647                        | LIT _ => ()                        | LIT _ => ()
# Line 648  Line 650
650                        | CONS(ty, xs) => List.app f xs                        | CONS(ty, xs) => List.app f xs
651                      (* end case *))                      (* end case *))
652                in                in
653                  mapf                  appf
654                end                end
655
656        (* return a string representation of a rhs *)        (* return a string representation of a rhs *)
# Line 661  Line 663
663                        "(", String.concatWith "," (List.map Var.toString xs), ")"                        "(", String.concatWith "," (List.map Var.toString xs), ")"
664                      ]                      ]
665                  | APPLY(f, xs) => String.concat [                  | APPLY(f, xs) => String.concat [
666                        ILBasis.toString f,                        MathFuns.toString f,
667                        "(", String.concatWith "," (List.map Var.toString xs), ")"                        "(", String.concatWith "," (List.map Var.toString xs), ")"
668                      ]                      ]
669                  | CONS(ty, xs) => String.concat [                  | CONS(ty, xs) => String.concat [

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