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/apply.sml
ViewVC logotype

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

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

revision 4820, Tue Nov 1 21:29:40 2016 UTC revision 4821, Tue Nov 1 22:10:00 2016 UTC
# Line 10  Line 10 
10    
11  structure Apply : sig  structure Apply : sig
12    
13      val apply : Ein.ein * int * Ein.ein -> (bool * Ein.ein)      val apply : Ein.ein * int * Ein.ein -> Ein.ein option
14    
15    end = struct    end = struct
16    
# Line 131  Line 131 
131                    | E.Value _ => raise Fail "expression before expand"                    | E.Value _ => raise Fail "expression before expand"
132                    | E.Img _ => raise Fail "expression before expand"                    | E.Img _ => raise Fail "expression before expand"
133                    | E.Krn _ => raise Fail "expression before expand"                    | E.Krn _ => raise Fail "expression before expand"
134                    | E.Sum(c, esum) => (                    | E.Sum(indices, esum) => let
135  (* QUESTION: should we flag a change here? *)                        val (ix, _, _) = List.last indices
136                        sumIndex := sumI c;                        in
137                        E.Sum(c, apply esum))                          sumIndex := ix;
138                            E.Sum(indices, apply esum)
139                          end
140                    | E.Op1(op1, e1) => E.Op1(op1, apply e1)                    | E.Op1(op1, e1) => E.Op1(op1, apply e1)
141                    | E.Op2(op2, e1, e2) => E.Op2(op2, apply e1, apply e2)                    | E.Op2(op2, e1, e2) => E.Op2(op2, apply e1, apply e2)
142                    | E.Opn(opn, es) => E.Opn(opn, List.map apply es)                    | E.Opn(opn, es) => E.Opn(opn, List.map apply es)
# Line 142  Line 144 
144                  (* end case *))                  (* end case *))
145            val body'' = apply body            val body'' = apply body
146            in            in
147  (* QUESTION: can we do the following?              if (! changed)
148              if (! changed) then SOME(E.EIN{params=params', index=index, body=body''}) else NONE                then SOME(E.EIN{params=params', index=index, body=body''})
149  *)                else NONE
             (!changed, E.EIN{params=params', index=index, body=body''})  
150            end            end
151    
152      end      end

Legend:
Removed from v.4820  
changed lines
  Added in v.4821

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