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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/target-cpu/gen-outputs.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/target-cpu/gen-outputs.sml

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

revision 3922, Wed Jun 1 17:02:34 2016 UTC revision 3924, Fri Jun 3 17:30:27 2016 UTC
# Line 104  Line 104 
104          wrld->state[i].name          wrld->state[i].name
105     *)     *)
106      fun stateVar spec name = if TargetSpec.dualState spec      fun stateVar spec name = if TargetSpec.dualState spec
107            then CL.mkIndirect(CL.mkSubscript(CL.mkIndirect(wrldV, "_outState"), iV), name)            then CL.mkIndirect(CL.mkSubscript(CL.mkIndirect(wrldV, "_outState"), iV), "sv_"^name)
108            else CL.mkSelect(CL.mkSubscript(CL.mkIndirect(wrldV, "_state"), iV), name)            else CL.mkSelect(CL.mkSubscript(CL.mkIndirect(wrldV, "_state"), iV), "sv_"^name)
109    
110    (* code fragment to loop over strands    (* code fragment to loop over strands
111          for (unsigned int i = 0;  i < wrld->_num_strands;  i++) ...          for (unsigned int i = 0;  i < wrld->_nstrands;  i++) ...
112     *)     *)
113      fun forStrands stm = CL.mkFor(      fun forStrands stm = CL.mkFor(
114            [(CL.uint32, "i", mkInt 0)],            [(CL.uint32, "i", mkInt 0)],
115            CL.mkBinOp(iV, CL.#<, CL.mkIndirect(wrldV, "_num_strands")),            CL.mkBinOp(iV, CL.#<, CL.mkIndirect(wrldV, "_nstrands")),
116            [CL.mkPostOp(iV, CL.^++)],            [CL.mkPostOp(iV, CL.^++)],
117            stm)            stm)
118    
# Line 243  Line 243 
243          (* generate the nLengths copy code *)          (* generate the nLengths copy code *)
244            val copyLengths = let            val copyLengths = let
245                  val pInit = CL.mkDeclInit(CL.T_Ptr CL.uint32, "ip",                  val pInit = CL.mkDeclInit(CL.T_Ptr CL.uint32, "ip",
246                        CL.mkCast(CL.T_Ptr(CL.uint32), CL.mkIndirect(nLengthsV, "data")))                        CL.mkReinterpretCast(CL.T_Ptr(CL.uint32), CL.mkIndirect(nLengthsV, "data")))
247                  val offsetDecl = CL.mkDeclInit(CL.uint32, "offset", CL.mkInt 0)                  val offsetDecl = CL.mkDeclInit(CL.uint32, "offset", CL.mkInt 0)
248                  val copyBlk = CL.mkBlock[                  val copyBlk = CL.mkBlock[
249                          CL.mkDeclInit(CL.uint32, "n", seqLength(stateVar name)),                          CL.mkDeclInit(CL.uint32, "n", seqLength(stateVar name)),
# Line 266  Line 266 
266          (* generate the nData copy code *)          (* generate the nData copy code *)
267            val copyData = let            val copyData = let
268                  val pInit = CL.mkDeclInit(CL.charPtr, "cp",                  val pInit = CL.mkDeclInit(CL.charPtr, "cp",
269                        CL.mkCast(CL.charPtr, CL.mkIndirect(nDataV, "data")))                        CL.mkReinterpretCast(CL.charPtr, CL.mkIndirect(nDataV, "data")))
270                  val copyStm = CL.mkAssign(cpV, seqCopy(                  val copyStm = CL.mkAssign(cpV, seqCopy(
271                        CL.mkBinOp(mkInt nElems, CL.#*, CL.mkSizeof(elemCTy)), cpV, stateVar name))                        CL.mkBinOp(mkInt nElems, CL.#*, CL.mkSizeof(elemCTy)), cpV, stateVar name))
272                  val copyStm = if #isArray spec                  val copyStm = if #isArray spec
# Line 351  Line 351 
351          (* generate the copy code *)          (* generate the copy code *)
352            val copyCode = let            val copyCode = let
353                  val pDecl = CL.mkDeclInit(CL.charPtr, "cp",                  val pDecl = CL.mkDeclInit(CL.charPtr, "cp",
354                        CL.mkCast(CL.charPtr, CL.mkIndirect(nDataV, "data")))                        CL.mkReinterpretCast(CL.charPtr, CL.mkIndirect(nDataV, "data")))
355                  val copyBlk = CL.mkBlock[                  val copyBlk = CL.mkBlock[
356                          CL.mkCall("memcpy", [                          CL.mkCall("memcpy", [
357                              cpV,                              cpV,

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

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