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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/low-to-tree/low-to-tree.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/low-to-tree/low-to-tree.sml

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

revision 4378, Mon Aug 8 15:20:44 2016 UTC revision 4380, Mon Aug 8 17:05:58 2016 UTC
# Line 853  Line 853 
853                          !succ, ifStk,                          !succ, ifStk,
854                          trEigenVecs (env, vals, vecs, TOp.EigenVecs3x3, x, stms))                          trEigenVecs (env, vals, vecs, TOp.EigenVecs3x3, x, stms))
855                    | IR.MASSIGN{stm=(ys, IR.MAPREDUCE mrs), succ, ...} =>                    | IR.MASSIGN{stm=(ys, IR.MAPREDUCE mrs), succ, ...} =>
856                        raise Fail "FIXME: MAPREDUCE"                        doNode (!succ, ifStk, trMapReduce (env, ys, mrs, stms))
857                    | IR.MASSIGN{stm=(ys, rhs), succ, ...} => raise Fail(concat[                    | IR.MASSIGN{stm=(ys, rhs), succ, ...} => raise Fail(concat[
858                          "unexepected rhs ", IR.RHS.toString rhs, " for MASSIGN"                          "unexepected rhs ", IR.RHS.toString rhs, " for MASSIGN"
859                        ])                        ])
# Line 924  Line 924 
924              doNode (IR.CFG.entry cfg, [], [])              doNode (IR.CFG.entry cfg, [], [])
925            end            end
926    
927        and trMapReduce (env, ys, mrs, stms) = let
928              fun getSet (_, _, x::_) = (case IR.Var.getDef x
929                     of IR.OP(Op.Strands(_, set), _) => set
930                      | rhs => raise Fail("expected Strands, but found " ^ IR.RHS.toString rhs)
931                    (* end case *))
932            (* get the least-upper bound of the domains *)
933              val srcSet = List.foldl
934                    (fn (mr, set) => StrandSets.join(getSet mr, set))
935                      (getSet (hd mrs))
936                        mrs
937              in
938    raise Fail "trMapReduce"
939              end
940    
941      fun trCFG info cfg = ScopeVars.assignScopes ([], trCFGWithEnv (Env.new info, cfg))      fun trCFG info cfg = ScopeVars.assignScopes ([], trCFGWithEnv (Env.new info, cfg))
942    
943      (* conversion for global initially and update blocks where we have to handle map-reduce
944       * statements.
945       *)
946        fun trGlobalCFG (info, funcs) cfg =
947              ScopeVars.assignScopes ([], trCFGWithEnv (Env.newWithFuncs (info, funcs), cfg))
948    
949    (* Convert a user-defined function.  We need to check for language features    (* Convert a user-defined function.  We need to check for language features
950     * that require the world pointer (e.g., printing) and for references to global variables.     * that require the world pointer (e.g., printing) and for references to global variables.
951     *)     *)
952      fun trFunc info (IR.Func{name, params, body}) = let      fun trFunc info (IR.Func{name, params, body}) =
953              if Flatten.isMapFunc name
954                then NONE
955                else let
956            val params' = List.map U.newParamVar params            val params' = List.map U.newParamVar params
957            val env = Env.new info            val env = Env.new info
958            val _ = ListPair.appEq            val _ = ListPair.appEq
# Line 939  Line 962 
962            val {needsWorld, usesGlobals} = Util.analyzeBlock body'            val {needsWorld, usesGlobals} = Util.analyzeBlock body'
963            val name' = mkFuncVar (name, needsWorld, usesGlobals)            val name' = mkFuncVar (name, needsWorld, usesGlobals)
964            in            in
965              T.Func{name = name', params = params', body = body'}                  SOME(T.Func{name = name', params = params', body = body'})
966            end            end
967    
968    (* Build a strand method from a TreeIR block.  We need to check for language features    (* Build a strand method from a TreeIR block.  We need to check for language features
# Line 987  Line 1010 
1010                    funcs, globInit, strand, create, init, update                    funcs, globInit, strand, create, init, update
1011                  } = prog                  } = prog
1012            val trCFG = trCFG info            val trCFG = trCFG info
1013              val trGlobalCFG = trGlobalCFG (info, funcs)
1014            in            in
1015              TreeIR.Program{              TreeIR.Program{
1016                  props = props,                  props = props,
# Line 995  Line 1019 
1019                  inputs = List.map (Inputs.map mkGlobalVar) inputs,                  inputs = List.map (Inputs.map mkGlobalVar) inputs,
1020                  constInit = trCFG constInit,                  constInit = trCFG constInit,
1021                  globals = List.map mkGlobalVar globals,                  globals = List.map mkGlobalVar globals,
1022                  funcs = List.map (trFunc info) funcs,                  funcs = List.mapPartial (trFunc info) funcs,
1023                  globInit = trCFG globInit,                  globInit = trCFG globInit,
1024                  strand = trStrand info strand,                  strand = trStrand info strand,
1025                  create = Create.map trCFG create,                  create = Create.map trCFG create,
1026                  init = Option.map trCFG init,                  init = Option.map trGlobalCFG init,
1027                  update = Option.map trCFG update                  update = Option.map trGlobalCFG update
1028                }                }
1029            end            end
1030    

Legend:
Removed from v.4378  
changed lines
  Added in v.4380

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