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

SCM Repository

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

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

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

revision 2245, Sun Mar 3 12:51:51 2013 UTC revision 2246, Sun Mar 3 14:51:31 2013 UTC
# Line 155  Line 155 
155                  inputs = List.rev(!inputs),                  inputs = List.rev(!inputs),
156                  globals = List.rev(!globals),                  globals = List.rev(!globals),
157                  globalInit = mkBlock (!globalInit),                  globalInit = mkBlock (!globalInit),
158            globalReduce = S.Block([]),
159          globalBlock = mkBlock(!globalBlock),          globalBlock = mkBlock(!globalBlock),
160                  init = (case !initially                  init = (case !initially
161  (* FIXME: the check for the initially block should really happen in typechecking *)  (* FIXME: the check for the initially block should really happen in typechecking *)
# Line 284  Line 285 
285              end              end
286          | AST.E_Reduction(r,sv,sets,e1,ty)  => let          | AST.E_Reduction(r,sv,sets,e1,ty)  => let
287             val (stms', x') = simplifyExpToVar(e1, [])             val (stms', x') = simplifyExpToVar(e1, [])
288             fun initReduction(r) = (case r             val reduceStms = S.S_Assign(sv,S.E_StrandSet(sets,Var.monoTypeOf sv))::stms'
             of S.R_All => S.E_Lit(Literal.Bool(true))  
              | S.R_Exists => S.E_Lit(Literal.Bool(false))  
              | S.R_Min => S.E_Lit(Literal.Float(FloatLit.posInf))  
              | S.R_Max => S.E_Lit(Literal.Float(FloatLit.negInf))  
              | S.R_Product => S.E_Lit(Literal.Float(FloatLit.fromInt 1))  
              | S.R_Sum => S.E_Lit(Literal.Float (FloatLit.fromInt 0))  
              | S.R_Mean => S.E_Lit(Literal.Float (FloatLit.fromInt 0))  
              | S.R_Variance => S.E_Lit(Literal.Float (FloatLit.fromInt 0))  
              (* end case *))  
289           in           in
290              (List.rev(S.S_Assign(sv,S.E_StrandSet(sets,Var.monoTypeOf sv))::stms'),S.E_Reduction(r,sv,x',ty))              (stms,S.E_Reduction(r,sv,reduceStms,x',ty))
291           end           end
292              | AST.E_Tuple es => raise Fail "E_Tuple not yet implemented"              | AST.E_Tuple es => raise Fail "E_Tuple not yet implemented"
293              | AST.E_Apply(f, tyArgs, args, ty) => let              | AST.E_Apply(f, tyArgs, args, ty) => let
# Line 389  Line 381 
381    
382      fun transform (errStrm, ast) = let      fun transform (errStrm, ast) = let
383            val simple = simplifyProgram ast            val simple = simplifyProgram ast
384         val simple' =  ReductionLift.transform(errStrm,simple)
385  (*  (*
386            val simple = Lift.transform simple            val simple = Lift.transform simple
387                  handle Eval.Error msg => (Error.error(errStrm, msg); simple)                  handle Eval.Error msg => (Error.error(errStrm, msg); simple)
388  *)  *)
389            in            in
390              simple              simple'
391            end            end
392    
393    end    end

Legend:
Removed from v.2245  
changed lines
  Added in v.2246

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