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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/high-to-mid/high-to-mid.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/high-to-mid/high-to-mid.sml

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

revision 612, Sat Mar 12 17:56:24 2011 UTC revision 613, Sat Mar 12 19:29:23 2011 UTC
# Line 173  Line 173 
173          type var_env = var_env          type var_env = var_env
174    
175          val rename = rename          val rename = rename
176            val renameList = renameList
177          val expand = DstIL.CFG.mkBlock o expand          val expand = DstIL.CFG.mkBlock o expand
178        end)        end)
179    
180      fun translate (SrcIL.Program{globals, globalInit, strands}) = let      fun translate prog = let
181            val env = VTbl.mkTable (256, Fail "env")            val prog = Trans.translate prog
           fun transMethod (SrcIL.Method{name, stateIn, stateOut, body}) =  
                 DstIL.Method{  
                     name = name,  
                     stateIn = renameList (env, stateIn),  
                     stateOut = renameList (env, stateOut),  
                     body = Trans.translate (env, body)  
                   }  
           fun transStrand (SrcIL.Strand{name, params, state, stateInit, methods}) =  
                 DstIL.Strand{  
                     name = name,  
                     params = renameList (env, params),  
                     state = renameList (env, state),  
                     stateInit = Trans.translate (env, stateInit),  
                     methods = List.map transMethod methods  
                   }  
         (* filter out field variables, since they will be made explicit in  
          * the MidIL.  
          *)  
           val globals = let  
                 fun filter x = (case SrcIL.Var.ty x  
                        of SrcTy.FieldTy => NONE  
                         | _ => SOME x  
                       (* end case *))  
                 in  
                   List.mapPartial filter globals  
                 end  
           val prog = DstIL.Program{  
                   globals = renameList (env, globals),  
                   globalInit = Trans.translate (env, globalInit),  
                   strands = List.map transStrand strands  
                 }  
182            in            in
183              MidILCensus.init prog;              MidILCensus.init prog;
184              prog              prog

Legend:
Removed from v.612  
changed lines
  Added in v.613

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