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 227, Wed Aug 4 05:27:13 2010 UTC revision 395, Thu Oct 14 16:52:15 2010 UTC
# Line 30  Line 30 
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 56  Line 56 
56              List.app simplifyDecl dcls;              List.app simplifyDecl dcls;
57              S.Program{              S.Program{
58                  globals = List.rev(!globals),                  globals = List.rev(!globals),
                 staticInit = mkBlock [],  
59                  globalInit = mkBlock (!globalInit),                  globalInit = mkBlock (!globalInit),
60                  actors = List.rev(!actors)                  actors = List.rev(!actors)
61                }                }
# Line 144  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 186  Line 190 
190    
191      fun transform ast = let      fun transform ast = let
192            val simple = simplifyProgram ast            val simple = simplifyProgram ast
193            val _ = SimplePP.output (TextIO.stdOut, simple)       (* DEBUG *)            val _ = SimplePP.output (Log.logFile(), simple)       (* DEBUG *)
194            val simple = Lift.transform simple            val simple = Lift.transform simple
195            in            in
196              simple              simple

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

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