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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-opt/normalize.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/high-opt/normalize.sml

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

revision 3586, Thu Jan 14 14:49:31 2016 UTC revision 3587, Thu Jan 14 15:02:27 2016 UTC
# Line 31  Line 31 
31      fun decUse (IR.V{useCnt, ...}) = (useCnt := !useCnt - 1)      fun decUse (IR.V{useCnt, ...}) = (useCnt := !useCnt - 1)
32      fun use x = (incUse x; x)      fun use x = (incUse x; x)
33    
34      fun isEin x = (case V.binding x      fun getEinApp x = (case V.getDef x
35             of IR.VB_RHS(rhs as IR.EINAPP(e, arg)) => SOME rhs             of IR.EINAPP(e, arg) => SOME(e, arg)
             | IR.VB_RHS(IR.VAR x') => isEin x'  
36              | _ => NONE              | _ => NONE
37            (* end case *))            (* end case *))
38    
# Line 81  Line 80 
80            fun rewrite (false, _, _, [], _) = NONE            fun rewrite (false, _, _, [], _) = NONE
81              | rewrite (true, orig, _, [], args') =              | rewrite (true, orig, _, [], args') =
82                  SOME[(lhs, IR.EINAPP(doNormalize orig, args'))]                  SOME[(lhs, IR.EINAPP(doNormalize orig, args'))]
83              | rewrite (changed, orig, place, e::es, args') = (case isEin e              | rewrite (changed, orig, place, e::es, args') = (case getEinApp e
84                   of NONE => rewrite(changed, orig, place+1, es, args'@[e])                   of NONE => rewrite(changed, orig, place+1, es, args'@[e])
85                    | SOME(IR.EINAPP(newE, newA)) => let                    | SOME(newE, newA) => let
86                        val Ein.EIN{params, index, body} = orig                        val Ein.EIN{params, index, body} = orig
87                        val (changed, e', place', done') =                        val (changed, e', place', done') =
88                              rewriteEin (params, place, changed, newE, newA, args', e, orig, lhs)                              rewriteEin (params, place, changed, newE, newA, args', e, orig, lhs)
89                        in                        in
90                          rewrite(changed, e', place', es, done')                          rewrite(changed, e', place', es, done')
91                        end                        end
                   | _ => raise Fail "isEin did not work"  
92                  (* end case *))                  (* end case *))
93            in            in
94              rewrite (false, ein, 0, args, [])              rewrite (false, ein, 0, args, [])

Legend:
Removed from v.3586  
changed lines
  Added in v.3587

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