Home My Page Projects Code Snippets Project Openings diderot

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/simplify/simplify.sml
 [diderot] / branches / vis15 / src / compiler / simplify / simplify.sml

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

revision 4253, Mon Jul 25 13:40:04 2016 UTC revision 4254, Mon Jul 25 14:41:12 2016 UTC
# Line 139  Line 139
139                  in                  in
140                    S.S_Var(x', SOME e') :: stms                    S.S_Var(x', SOME e') :: stms
141                  end                  end
142    (* FIXME: we should also define a "negate" operation on AST expressions so that we can
143     * handle both cases!
144     *)
145                | AST.S_IfThenElse(AST.E_Orelse(e1, e2), s1 as AST.S_Block[], s2) =>
146                    simplifyStmt (errStrm, AST.S_IfThenElse(e1, s1, AST.S_IfThenElse(e2, s1, s2)), stms)
147                | AST.S_IfThenElse(AST.E_Andalso(e1, e2), s1, s2 as AST.S_Block[]) =>
148                    simplifyStmt (errStrm, AST.S_IfThenElse(e1, AST.S_IfThenElse(e2, s1, s2), s2), stms)
149              | AST.S_IfThenElse(e, s1, s2) => let              | AST.S_IfThenElse(e, s1, s2) => let
150                  val (stms, x) = simplifyExpToVar (errStrm, e, stms)                  val (stms, x) = simplifyExpToVar (errStrm, e, stms)
151                  val s1 = simplifyBlock (errStrm, s1)                  val s1 = simplifyBlock (errStrm, s1)
# Line 330  Line 337
337                    in                    in
338                      (S.S_IfThenElse(x, s1, s2) :: stms, S.E_Var result)                      (S.S_IfThenElse(x, s1, s2) :: stms, S.E_Var result)
339                    end                    end
340                  | AST.E_Orelse(e1, e2) => simplifyExp (
341                      errStrm,
342                      AST.E_Cond(e1, AST.E_Lit(Literal.Bool true), e2, Ty.T_Bool),
343                      stms)
344                  | AST.E_Andalso(e1, e2) => simplifyExp (
345                      errStrm,
346                      AST.E_Cond(e1, e2, AST.E_Lit(Literal.Bool false), Ty.T_Bool),
347                      stms)
348                | AST.E_LoadNrrd(_, nrrd, ty) => (case cvtTy ty                | AST.E_LoadNrrd(_, nrrd, ty) => (case cvtTy ty
349                     of ty as STy.T_Sequence(_, NONE) => (stms, S.E_LoadSeq(ty, nrrd))                     of ty as STy.T_Sequence(_, NONE) => (stms, S.E_LoadSeq(ty, nrrd))
350                      | ty as STy.T_Image info => let                      | ty as STy.T_Image info => let

Legend:
 Removed from v.4253 changed lines Added in v.4254