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

SCM Repository

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

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

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

revision 1762, Thu Mar 22 18:41:17 2012 UTC revision 1763, Sat Mar 24 02:20:24 2012 UTC
# Line 142  Line 142 
142     *)     *)
143      fun commitJoin (joinStk, JOIN{env, arity, nd, phiMap, predKill}) = (case !arity      fun commitJoin (joinStk, JOIN{env, arity, nd, phiMap, predKill}) = (case !arity
144             of 0 => (env, NONE)             of 0 => (env, NONE)
145              | 1 => (* there is only one path to the join, so we do not need phi nodes *)              | 1 => let
146                  (* there is only one path to the join, so we do not need phi nodes, but
147                   * we still need to propogate assignments to the next join on the stack.
148                   *)
149                    val IL.ND{kind=IL.JOIN{phis, ...}, ...} = nd
150                    val ix = let (* find pred of this join *)
151                          fun find i = if Array.sub(predKill, i) then find(i+1) else i
152                          in
153                            find 0
154                          end
155                    fun doVar (srcVar, (_, xs), env) = let
156                          val dstVar = List.nth(xs, ix)
157                          in
158    (*
159    print(concat["doVar (", Var.uniqueNameOf srcVar, ", ", IL.phiToString phi, ", _) @ ", IL.Node.toString nd, "\n"]);
160    *)
161                            recordAssign (joinStk, srcVar, dstVar);
162                            VMap.insert (env, srcVar, dstVar)
163                          end
164                    val env = VMap.foldli doVar env (!phiMap)
165                    in
166                  (env, SOME nd)                  (env, SOME nd)
167                    end
168              | n => if (n = Array.length predKill)              | n => if (n = Array.length predKill)
169                  then let                  then let
170                    val IL.ND{kind=IL.JOIN{phis, ...}, ...} = nd                    val IL.ND{kind=IL.JOIN{phis, ...}, ...} = nd

Legend:
Removed from v.1762  
changed lines
  Added in v.1763

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