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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/translate/translate.sml
ViewVC logotype

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

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

revision 3500, Wed Dec 16 15:01:40 2015 UTC revision 3501, Thu Dec 17 20:07:13 2015 UTC
# Line 102  Line 102 
102              predKill = Array.array(arity, false)              predKill = Array.array(arity, false)
103            }            }
104    
105  (* FIXME: newForeach *)    (* create a new pending-join node *)
106        fun newForeach (env, x, xs) = JOIN{
107                env = env.
108                arity = ref 2,
109                nd = IR.Node.mkFOREACH(x, xs),
110                phiMap = ref VMap.empty,
111                predKill = Arry.array(2, false)
112              }
113    
114    (* record that a path to the top join in the stack has been killed because f DIE or STABILIZE *)    (* record that a path to the top join in the stack has been killed because f DIE or STABILIZE *)
115      fun killPath ((i, JOIN{arity, predKill, ...}) :: _) = (      fun killPath ((i, JOIN{arity, predKill, ...}) :: _) = (
# Line 281  Line 288 
288            end            end
289  (*DEBUG*)handle ex => raise ex  (*DEBUG*)handle ex => raise ex
290    
291      fun cvtBlock (state, env : env, joinStk, S.Block stms) = let      fun cvtBlock (state, env : env, joinStk, blk as S.Block{code, ...}) = let
292              val _ = AnalyzeSimple.analyze blk
293            fun cvt (env : env, cfg, []) = (cfg, env)            fun cvt (env : env, cfg, []) = (cfg, env)
294              | cvt (env, cfg, stm::stms) = (case stm              | cvt (env, cfg, stm::stms) = (case stm
295                   of S.S_Var(x, NONE) => let                   of S.S_Var(x, NONE) => let
# Line 353  Line 361 
361                    | S.S_Foreach(x, xs, b) => let                    | S.S_Foreach(x, xs, b) => let
362                        val x' = newVar x                        val x' = newVar x
363                        val xs' = lookup env xs                        val xs' = lookup env xs
364                        val join as JOIN{nd=foreachNd, ...} = newForeach (env, 2)                      (* we need to create fresh SSA variables for the free locals that are
365                        in                       * assigned to in the body of the loop.
366                         *)
367                          val assignedVars = freeVarAssignments b
368                          val join as JOIN{nd=foreachNd, ...} = newForeach (env, x', xs')
369                          val (body, _) = cvtBlock (state, env, (1, join)::joinStk, b)
370                          in
371                          (* link in CFG edges *)
372                            IR.Node.setBodyBranch(foreachNd, IR.CFG.entry body);
373                            IR.Node.setPred (IR.CFG.entry body, foreachNd);
374    
375  ??  ??
376                        end                        end
377                    | S.S_New(strandId, args) => let                    | S.S_New(strandId, args) => let

Legend:
Removed from v.3500  
changed lines
  Added in v.3501

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