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 2502, Mon Nov 4 21:33:35 2013 UTC revision 2503, Mon Nov 4 22:05:26 2013 UTC
# Line 356  Line 356 
356                                 | "variance" => S.E_Lit(Literal.Float(FloatLit.fromInt 0))                                 | "variance" => S.E_Lit(Literal.Float(FloatLit.fromInt 0))
357                              val identityExp = identity(Var.nameOf rVar)                              val identityExp = identity(Var.nameOf rVar)
358                  val newGlobalReduceVar = newReductionVar(Var.nameOf rVar, rRetTy,identityExp)                  val newGlobalReduceVar = newReductionVar(Var.nameOf rVar, rRetTy,identityExp)
359                  val reduction = S.E_Apply(rVar, argsTy, [e',setVar,kind'], rRetTy)                  val (reduceStms,reduction) = (*if ((Var.nameOf rVar) = "variance")
360                                     then (let
361                                        val (stms,meanVar) = simplifyExp(AST.E_Reduction(BV.fn_rMean,e, ,kind),[])
362                                        in
363                                           (stms @ reduceStms,S.E_Apply(rVar, argsTy, [e',setVar,kind',meanVar], rRetTy))
364                                        end)
365                                      else *) (reduceStms,S.E_Apply(rVar, argsTy, [e',setVar,kind'], rRetTy))
366                  in                  in
367                      (insertReduction(S.S_Assign(newGlobalReduceVar,reduction)::reduceStms);                      (insertReduction(S.S_Assign(newGlobalReduceVar,reduction)::reduceStms);
368                      (stms,S.E_Var newGlobalReduceVar))                      (stms,S.E_Var newGlobalReduceVar))
   
                   (* case r  
                    of S.R_Variance => let  
                         val mean = newTemp (returnTy)  
                         val (meanStms,meanInit) = initReduction(S.R_Mean)  
                         val (meanStms', meanExpV') = simplifyExpToVar(e1, [])  
                         val (stms,meanVar) = simplifyExp(AST.E_Reduction(BV.fn_rMean,e, ,kind),[])  
   
   
                         val meanAssign = S.S_Assign(mean,S.E_Reduction(S.R_Mean,[meanInit,meanExpV',sV,setVar],ty,returnTy))  
                          val varFinal = reduceStms@stms''  
                         val meanFinal=  List.rev(meanStms' @  meanStms @ [meanAssign])  
                         in  
                           (meanFinal@varFinal@stms, S.E_Reduction(r, [initV, expV',sV,setVar,mean],ty,returnTy))  
                         end  
                     | _ => (reduceStms@stms''@stms,S.E_Reduction(r, [initV, expV',sV,setVar],ty,returnTy)) *)  
                   (* end of case *)  
   
369                  end                  end
370              | AST.E_Tuple es => raise Fail "E_Tuple not yet implemented"              | AST.E_Tuple es => raise Fail "E_Tuple not yet implemented"
371              | AST.E_Apply(f, tyArgs, args, ty) => let              | AST.E_Apply(f, tyArgs, args, ty) => let

Legend:
Removed from v.2502  
changed lines
  Added in v.2503

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