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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml

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

revision 1353, Mon Jun 20 17:12:06 2011 UTC revision 1357, Tue Jun 21 03:55:10 2011 UTC
# Line 216  Line 216 
216                    imgGlobals = ref[],                    imgGlobals = ref[],
217                    prFn = ref(CL.D_Comment(["No Print Function"]))                    prFn = ref(CL.D_Comment(["No Print Function"]))
218                  })                  })
219        (* register the global initialization part of a program *)  
 (* FIXME: unused code; can this be removed??  
           fun globalIndirects (globals,stms) = let  
                 fun getGlobals ({name,target as TargetUtil.TARGET_CL}::rest) =  
                       CL.mkAssign(CL.mkIndirect(CL.mkVar RN.globalsVarName,name),CL.mkVar name)  
                         ::getGlobals rest  
                   | getGlobals [] = []  
                   | getGlobals (_::rest) = getGlobals rest  
                 in  
                   stms @ getGlobals globals  
                 end  
 *)  
220        (* register the code that is used to register command-line options for input variables *)        (* register the code that is used to register command-line options for input variables *)
221          fun inputs (Prog{topDecls, ...}, stm) = let          fun inputs (Prog{topDecls, ...}, stm) = let
222                val inputsFn = CL.D_Func(                val inputsFn = CL.D_Func(
# Line 242  Line 231 
231          fun init (Prog{topDecls, ...}, init) = let          fun init (Prog{topDecls, ...}, init) = let
232                val globalsDecl = CL.mkAssign(CL.E_Var RN.globalsVarName,                val globalsDecl = CL.mkAssign(CL.E_Var RN.globalsVarName,
233                      CL.mkApply("malloc", [CL.mkApply("sizeof",[CL.mkVar RN.globalsTy])]))                      CL.mkApply("malloc", [CL.mkApply("sizeof",[CL.mkVar RN.globalsTy])]))
               val initGlobalsCall = CL.mkCall(RN.initGlobalsHelper,[])  
234                val initFn = CL.D_Func(                val initFn = CL.D_Func(
235                      [], CL.voidTy, RN.initGlobals, [],                      [], CL.voidTy, RN.initGlobals, [],
236                      CL.mkBlock([globalsDecl,initGlobalsCall]))                      CL.mkBlock[globalsDecl, CL.mkCall(RN.initGlobalsHelper,[])])
237                val initFn_helper = CL.D_Func(                val initHelperFn = CL.D_Func(
238                      [], CL.voidTy, RN.initGlobalsHelper, [],                      [], CL.voidTy, RN.initGlobalsHelper, [],
239                      init)                      init)
240                val shutdownFn = CL.D_Func(                val shutdownFn = CL.D_Func(
# Line 254  Line 242 
242                      [CL.PARAM([], CL.T_Ptr(CL.T_Named RN.worldTy), "wrld")],                      [CL.PARAM([], CL.T_Ptr(CL.T_Named RN.worldTy), "wrld")],
243                      CL.S_Block[])                      CL.S_Block[])
244                in                in
245                  topDecls := shutdownFn :: initFn :: initFn_helper :: !topDecls                  topDecls := shutdownFn :: initFn :: initHelperFn :: !topDecls
246                end                end
247    
248        (* create and register the initially function for a program *)        (* create and register the initially function for a program *)
249          fun initially {          fun initially {
250                prog = Prog{name=progName, strands, initially, numDims, ...},                prog = Prog{name=progName, strands, initially, numDims, ...},
# Line 520  Line 509 
509        (*generate code for intilizing kernel global data *)        (*generate code for intilizing kernel global data *)
510  (* FIXME: should use List.map here *)  (* FIXME: should use List.map here *)
511          fun initGlobalImages ((name, tyname)::rest) =          fun initGlobalImages ((name, tyname)::rest) =
512               CL.mkAssign(CL.mkIndirect(CL.E_Var RN.globalsVarName, name), CL.mkVar (RN.addBufferSuffix name)) ::                CL.mkAssign(
513               CL.mkAssign(CL.mkIndirect(CL.E_Var RN.globalsVarName,concat[name,"->","data"]),CL.mkVar (RN.addBufferSuffixData name)) ::                  CL.mkIndirect(CL.E_Var RN.globalsVarName, name),
514                    CL.mkVar (RN.addBufferSuffix name)) ::
515                  CL.mkAssign(
516                    CL.mkIndirect(CL.mkIndirect(CL.E_Var RN.globalsVarName, name), "data"),
517                    CL.mkVar (RN.addBufferSuffixData name)) ::
518               initGlobalImages rest               initGlobalImages rest
519            | initGlobalImages [] = []            | initGlobalImages [] = []
520    

Legend:
Removed from v.1353  
changed lines
  Added in v.1357

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