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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/simplify/simplify.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/simplify/simplify.sml

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

revision 221, Tue Aug 3 20:13:55 2010 UTC revision 395, Thu Oct 14 16:52:15 2010 UTC
# Line 24  Line 24 
24    (* make a block out of a list of statements that are in reverse order *)    (* make a block out of a list of statements that are in reverse order *)
25      fun mkBlock stms = S.Block(List.rev stms)      fun mkBlock stms = S.Block(List.rev stms)
26    
27      fun transform (AST.Program dcls) = let      fun simplifyProgram (AST.Program dcls) = let
28            val globals = ref []            val globals = ref []
29            val globalInit = ref []            val globalInit = ref []
30            val actors = ref []            val actors = ref []
31            fun simplifyDecl dcl = (case dcl            fun simplifyDecl dcl = (case dcl
32                   of AST.D_Input(x, NONE) => let                   of AST.D_Input(x, NONE) => let
33                        val e' = S.E_Input(Var.nameOf x, NONE)                        val e' = S.E_Input(Var.monoTypeOf x, Var.nameOf x, NONE)
34                        in                        in
35                          globals := x :: !globals;                          globals := x :: !globals;
36                          globalInit := S.S_Assign(x, e') :: !globalInit                          globalInit := S.S_Assign(x, e') :: !globalInit
37                        end                        end
38                    | AST.D_Input(x, SOME e) => let                    | AST.D_Input(x, SOME e) => let
39                        val (stms, x') = simplifyExpToVar (e, [])                        val (stms, x') = simplifyExpToVar (e, [])
40                        val e' = S.E_Input(Var.nameOf x, SOME x')                        val e' = S.E_Input(Var.monoTypeOf x, Var.nameOf x, SOME x')
41                        in                        in
42                          globals := x :: !globals;                          globals := x :: !globals;
43                          globalInit := S.S_Assign(x, e') :: (stms @ !globalInit)                          globalInit := S.S_Assign(x, e') :: (stms @ !globalInit)
# Line 143  Line 143 
143                  in                  in
144                    (stms, S.E_Cons xs)                    (stms, S.E_Cons xs)
145                  end                  end
146                | AST.E_Slice(e, indices) => let (* tensor slicing *)
147                    val (stms, x) = simplifyExpToVar (e, stms)
148                    in
149                      raise Fail "FIXME"
150                    end
151              | AST.E_Cond(e1, e2, e3) => let              | AST.E_Cond(e1, e2, e3) => let
152                (* a conditional expression gets turned into an if-then-else statememt *)                (* a conditional expression gets turned into an if-then-else statememt *)
153                  val result = newTemp Ty.T_Bool                  val result = newTemp Ty.T_Bool
# Line 183  Line 188 
188              f (exps, [], stms)              f (exps, [], stms)
189            end            end
190    
191        fun transform ast = let
192              val simple = simplifyProgram ast
193              val _ = SimplePP.output (Log.logFile(), simple)       (* DEBUG *)
194              val simple = Lift.transform simple
195              in
196                simple
197              end
198    
199    end    end

Legend:
Removed from v.221  
changed lines
  Added in v.395

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