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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/c-util/tree-to-c.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/c-util/tree-to-c.sml

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

revision 1870, Fri May 11 17:44:18 2012 UTC revision 1922, Sat Jun 23 11:25:39 2012 UTC
# Line 79  Line 79 
79    (* translate IL basis functions *)    (* translate IL basis functions *)
80      local      local
81        fun mkLookup suffix = let        fun mkLookup suffix = let
82              val tbl = ILBasis.Tbl.mkTable (16, Fail "basis table")              val tbl = MathFuns.Tbl.mkTable (16, Fail "basis table")
83              fun ins f = ILBasis.Tbl.insert tbl (f, ILBasis.toString f ^ suffix)              fun ins f = MathFuns.Tbl.insert tbl (f, MathFuns.toString f ^ suffix)
84              in              in
85                List.app ins ILBasis.allFuns;                List.app ins MathFuns.allFuns;
86                ILBasis.Tbl.lookup tbl                MathFuns.Tbl.lookup tbl
87              end              end
88        val fLookup = mkLookup "f"        val fLookup = mkLookup "f"
89        val dLookup = mkLookup ""        val dLookup = mkLookup ""
# Line 484  Line 484 
484                CL.mkReturn(SOME(CL.mkVar "true")))]                CL.mkReturn(SOME(CL.mkVar "true")))]
485            end            end
486    
487      fun trF (env, stms) = let    (* given the global initialization code, generate code to free the storage that is heap
488       * allocated for globals.
489       *)
490        fun trFree (env, IL.Block{locals, body}) = let
491              val env = trLocals (env, locals)
492            fun trStmt (env, stm) = (case stm            fun trStmt (env, stm) = (case stm
493                   of IL.S_Comment text => [CL.mkComment text]                   of IL.S_Comment text => [CL.mkComment text]
494                    | IL.S_LoadImage(lhs, dim, name) => checkSts (fn sts => let                    | IL.S_LoadImage(lhs, dim, name) => checkSts (fn sts => let
# Line 501  Line 505 
505                        ] end)                        ] end)
506                    | _ => []                    | _ => []
507                  (* end case *))                  (* end case *))
508            in            val stms = List.foldr (fn (stm, stms) => trStmt(env, stm)@stms) [] body
             List.foldr (fn (stm, stms) => trStmt(env, stm)@stms) [] stms  
           end  
   
     and trFr (env, IL.Block{locals, body}) = let  
           val env = trLocals (env, locals)  
           val stms = trF (env, body)  
509            fun mkDecl (x, stms) = (case V.Map.find (env, x)            fun mkDecl (x, stms) = (case V.Map.find (env, x)
510                   of SOME(V(ty, x')) => CL.mkDecl(ty, x', NONE) :: stms                   of SOME(V(ty, x')) => CL.mkDecl(ty, x', NONE) :: stms
511                    | NONE => raise Fail(concat["mkDecl(", V.name x, ", _)"])                    | NONE => raise Fail(concat["mkDecl(", V.name x, ", _)"])
# Line 585  Line 583 
583    
584      val trBlock = trBlk      val trBlock = trBlk
585    
     val trFree = trFr  
   
586    end    end

Legend:
Removed from v.1870  
changed lines
  Added in v.1922

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