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

SCM Repository

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

Diff of /branches/vis15/src/compiler/tree-opt/tree-contract.sml

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

revision 3922, Wed Jun 1 17:02:34 2016 UTC revision 3923, Wed Jun 1 17:18:20 2016 UTC
# Line 76  Line 76 
76              | IR.E_VLoad(layout, e, i) => IR.E_VLoad(layout, reduce e, i)              | IR.E_VLoad(layout, e, i) => IR.E_VLoad(layout, reduce e, i)
77            (* end case *))            (* end case *))
78    
79      fun reduceBlock (dualState, blk) = let      fun reduceBlock dualState = let
80            fun condReduce e = if canReduce e then reduce e else e            fun condReduce e = if canReduce e then reduce e else e
81            fun reduceStms ([], stms') = List.rev stms'            fun reduceStms ([], stms') = List.rev stms'
82              | reduceStms (stm::stms, stms') = let              | reduceStms (stm::stms, stms') = let
# Line 116  Line 116 
116                            then continue (IR.S_New(name, List.map reduce args) :: stms')                            then continue (IR.S_New(name, List.map reduce args) :: stms')
117                            else continue (stm::stms')                            else continue (stm::stms')
118                      | IR.S_Save(sv, IR.E_State(NONE, sv')) =>                      | IR.S_Save(sv, IR.E_State(NONE, sv')) =>
119                          if TreeStateVar.same(sv, sv') andalso dualState                          if TreeStateVar.same(sv, sv') andalso (not dualState)
120                            then (ST.tick cntIdentityAssign; continue stms')                            then (ST.tick cntIdentityAssign; continue stms')
121                            else continue (stm::stms')                            else continue (stm::stms')
122                      | IR.S_Save(sv, e) =>                      | IR.S_Save(sv, e) =>
# Line 130  Line 130 
130                      locals = locals, body = reduceStms (body, [])                      locals = locals, body = reduceStms (body, [])
131                    }                    }
132            in            in
133              reduceBlk blk              reduceBlk
134            end            end
135    
136  (* TODO: unused variable elimination; tensor/vector conversion elimination *)  (* TODO: unused variable elimination; tensor/vector conversion elimination *)
# Line 140  Line 140 
140                  globals, globalInit, strand, create, update                  globals, globalInit, strand, create, update
141                } = prog                } = prog
142            val IR.Strand{name, params, state, stateInit, initM, updateM, stabilizeM} = strand            val IR.Strand{name, params, state, stateInit, initM, updateM, stabilizeM} = strand
143              val reduceBlk = reduceBlock (Properties.dualState props)
144              val constInit = reduceBlk constInit
145              val globalInit = reduceBlk globalInit
146              val create = (case create
147                     of IR.Create{dim, code} => IR.Create{dim=dim, code=reduceBlk code}
148                    (* end case *))
149              val update = Option.map reduceBlk update
150              val strand = IR.Strand{
151                      name = name, params = params, state = state,
152                      stateInit = reduceBlk stateInit,
153                      initM = Option.map reduceBlk initM,
154                      updateM = reduceBlk updateM,
155                      stabilizeM = Option.map reduceBlk stabilizeM
156                    }
157            in            in
158              IR.Program{              IR.Program{
159                  props = props, target = target, consts = consts,                  props = props, target = target, consts = consts,

Legend:
Removed from v.3922  
changed lines
  Added in v.3923

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