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

SCM Repository

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

Diff of /branches/lamont/src/compiler/tree-il/low-to-tree-fn.sml

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

revision 2083, Thu Nov 8 18:42:05 2012 UTC revision 2084, Fri Nov 9 21:55:00 2012 UTC
# Line 71  Line 71 
71      end      end
72    
73      fun mkBlock stms = T.Block{locals=[], body=stms}      fun mkBlock stms = T.Block{locals=[], body=stms}
74      fun mkForEach (stms,s) = T.S_Foreach(mkBlock stms,s)      fun mkForEach (cond,stms,s) = T.S_Foreach(cond,mkBlock stms,s)
75      fun mkIf (x, stms, []) = T.S_IfThen(x, mkBlock stms)      fun mkIf (x, stms, []) = T.S_IfThen(x, mkBlock stms)
76        | mkIf (x, stms1, stms2) = T.S_IfThenElse(x, mkBlock stms1, mkBlock stms2)        | mkIf (x, stms1, stms2) = T.S_IfThenElse(x, mkBlock stms1, mkBlock stms2)
77    
# Line 415  Line 415 
415       * a JOIN, DIE, or STABILIZE).       * a JOIN, DIE, or STABILIZE).
416       *)       *)
417        | ELSE_BR of T.stm list * T.exp * T.stm list * IL.node_kind        | ELSE_BR of T.stm list * T.exp * T.stm list * IL.node_kind
418        | STM_BR of T.stm list * (IL.var * IL.var list) list * T.var list        | STM_BR of T.exp * T.stm list * (IL.var * IL.var list) list * T.var list
419    
420      fun trCFG (env, prefix, finish, cfg) = let      fun trCFG (env, prefix, finish, cfg) = let
421            fun join (env, [], _, IL.JOIN _) = raise Fail "JOIN with no open if"            fun join (env, [], _, IL.JOIN _) = raise Fail "JOIN with no open if"
# Line 465  Line 465 
465                    | IL.FOREACH{cond,stmBranch,phis,stmBranchDone,varStrandName,succ,...} =>                    | IL.FOREACH{cond,stmBranch,phis,stmBranchDone,varStrandName,succ,...} =>
466                  if !stmBranchDone = false then                  if !stmBranchDone = false then
467                      (let                      (let
468                            val cond = useVar env cond
469                          val (env, stms) = flushPending(env,stms)                          val (env, stms) = flushPending(env,stms)
470                          val (env',stms',phis',varList) =  addPhis(OPEN_JOIN_ND,!phis,env,[],stms,[])                          val (env',stms',phis',varList) =  addPhis(OPEN_JOIN_ND,!phis,env,[],stms,[])
471                       in                       in
472                          (stmBranchDone := true; doNode(env',(STM_BR(stms',phis',varList))::ifStk, [],!stmBranch))                          (stmBranchDone := true; doNode(env',(STM_BR(cond,stms',phis',varList))::ifStk, [],!stmBranch))
473                       end)                       end)
474                  else (                  else (
475                          case (ifStk)                          case (ifStk)
476                          of (STM_BR(stms',phis',varList)::stk)  =>                          of (STM_BR(cond,stms',phis',varList)::stk)  =>
477                                  let                                  let
478                                  val (env',stmBranch,_,_) = addPhis(OPEN_STM_BR,phis',env,[],stms,varList)                                  val (env',stmBranch,_,_) = addPhis(OPEN_STM_BR,phis',env,[],stms,varList)
479    
480                          val stm''' = mkForEach(List.rev stmBranch,!varStrandName)                          val stm''' = mkForEach(cond,List.rev stmBranch,!varStrandName)
481                               in                               in
482                           doNode(env',stk,stm'''::stms',!succ)                           doNode(env',stk,stm'''::stms',!succ)
483                              end                              end

Legend:
Removed from v.2083  
changed lines
  Added in v.2084

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