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 1398, Wed Jun 29 17:20:05 2011 UTC revision 1405, Wed Jun 29 18:52:17 2011 UTC
# Line 406  Line 406 
406                fun errorFn msg = CL.mkIfThen(CL.mkBinOp(CL.E_Var errVar, CL.#!=, CL.E_Var "CL_SUCCESS"),                fun errorFn msg = CL.mkIfThen(CL.mkBinOp(CL.E_Var errVar, CL.#!=, CL.E_Var "CL_SUCCESS"),
407                      CL.mkBlock([CL.mkCall("fprintf",[CL.E_Var "stderr", CL.E_Str msg]),                      CL.mkBlock([CL.mkCall("fprintf",[CL.E_Var "stderr", CL.E_Str msg]),
408                      CL.mkCall("exit",[CL.mkInt 1])]))                      CL.mkCall("exit",[CL.mkInt 1])]))
409                val shadowTypeDecl = CL.mkDecl(CL.T_Named(RN.shadowGlobalsTy),RN.shadowGlaobalsName,NONE)                val shadowTypeDecl =
410                        CL.mkDecl(CL.T_Named(RN.shadowGlobalsTy), RN.shadowGlaobalsName, NONE)
411                val globalImagesToShadowStms = List.map (fn (var,nDims) =>                val globalImagesToShadowStms = List.map (fn (var,nDims) =>
412                      CL.mkCall((RN.shadowImageFunc nDims), [                      CL.mkCall((RN.shadowImageFunc nDims), [
413                           CL.mkVar contextVar,                           CL.mkVar contextVar,
414                           CL.mkUnOp(CL.%&,CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),var)),                           CL.mkUnOp(CL.%&,CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),var)),
415    (* FIXME: for vectors and matrices, we need to invoke the appropriate shadow function from shadow-types.h *)
416                           CL.mkIndirect(CL.mkVar(RN.globalsVarName),var)                           CL.mkIndirect(CL.mkVar(RN.globalsVarName),var)
417                           ])) imgGlobals                           ])) imgGlobals
418                (* Converts only the non-image-field types into their corresponding global shadow types *)                (* Converts only the non-image-field types into their corresponding global shadow types *)
419                fun convertToShadow ((global:mirror_var)::rest,(imgGlobal,nDim)::restImages) =                fun convertToShadow ((global:mirror_var)::rest,(imgGlobal,nDim)::restImages) =
420                       if (#var global) = imgGlobal then                      if (#var global) = imgGlobal
421                          convertToShadow(rest,restImages)                        then convertToShadow(rest,restImages)
422                      else                        else CL.mkAssign(CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, #var global),
                         CL.mkAssign(CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),#var global),  
423                                  CL.mkIndirect(CL.mkVar(RN.globalsVarName), #var global))::                                  CL.mkIndirect(CL.mkVar(RN.globalsVarName), #var global))::
424                                      convertToShadow(rest,(imgGlobal,nDim)::restImages)                                      convertToShadow(rest,(imgGlobal,nDim)::restImages)
425                  | convertToShadow ([], _) = []                  | convertToShadow ([], _) = []
# Line 426  Line 427 
427                        CL.mkAssign(CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),#var global),                        CL.mkAssign(CL.mkSelect(CL.mkVar(RN.shadowGlaobalsName),#var global),
428                                  CL.mkIndirect(CL.mkVar(RN.globalsVarName), #var global))::                                  CL.mkIndirect(CL.mkVar(RN.globalsVarName), #var global))::
429                                      convertToShadow(rest,[])                                      convertToShadow(rest,[])
   
430                val globalToShadowStms = convertToShadow(globals,imgGlobals)                val globalToShadowStms = convertToShadow(globals,imgGlobals)
431                val globalBufferDecl = CL.mkDecl(clMemoryTy,concat[RN.globalsVarName,"_cl"],NONE)                val globalBufferDecl = CL.mkDecl(clMemoryTy,concat[RN.globalsVarName,"_cl"],NONE)
432                val globalBuffer = CL.mkAssign(CL.mkVar(concat[RN.globalsVarName,"_cl"]),                val globalBuffer = CL.mkAssign(CL.mkVar(concat[RN.globalsVarName,"_cl"]),

Legend:
Removed from v.1398  
changed lines
  Added in v.1405

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