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-world.sml
ViewVC logotype

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

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

revision 4348, Tue Aug 2 15:48:33 2016 UTC revision 4349, Tue Aug 2 18:14:48 2016 UTC
# Line 8  Line 8 
8    
9  structure GenWorld : sig  structure GenWorld : sig
10    
11      val genStruct : TargetSpec.t * Atom.atom * int -> CLang.decl      val genStruct : CodeGenEnv.t * Atom.atom * int -> CLang.decl
12    
13      val genInitiallyFun : CodeGenEnv.t * TreeIR.block * TreeIR.strand * TreeIR.create -> CLang.decl      val genInitiallyFun : CodeGenEnv.t * TreeIR.block * TreeIR.strand * TreeIR.create -> CLang.decl
14    
# Line 22  Line 22 
22      structure ToCxx = TreeToCxx      structure ToCxx = TreeToCxx
23    
24    (* generate the struct declaration for the world representation *)    (* generate the struct declaration for the world representation *)
25      fun genStruct (spec : TargetSpec.t, strandName, nAxes) = let      fun genStruct (env : CodeGenEnv.t, strandName, nAxes) = let
26              val spec = Env.target env
27            fun memberVar (ty, name) = CL.mkVarDcl(ty, name)            fun memberVar (ty, name) = CL.mkVarDcl(ty, name)
28            val members = []            val members = []
29            val statePtrTy = CL.T_Ptr(CL.T_Named(Atom.toString strandName ^ "_strand"))            val statePtrTy = CL.T_Ptr(CL.T_Named(Atom.toString strandName ^ "_strand"))
# Line 61  Line 62 
62            val members = if #hasGlobalUpdate spec            val members = if #hasGlobalUpdate spec
63                  then memberFun (CL.voidTy, "global_update", []) :: members                  then memberFun (CL.voidTy, "global_update", []) :: members
64                  else members                  else members
65              val members = if #hasCom spec
66                    then let
67                      val realTy = Env.realTy env
68                      val seqTy = CL.T_Template("diderot::dynseq", [CL.uint32])
69                      val posTy = if nAxes > 1
70                            then TypeToCxx.trType(env, TreeTypes.TensorRefTy[nAxes])
71                            else realTy
72                      in
73                        memberFun (seqTy, "sphere_query", [
74                            CL.PARAM([], posTy, "pos"),
75                            CL.PARAM([], realTy, "radius")
76                          ]) :: members
77                      end
78                    else members
79            in            in
80              CL.D_ClassDef{              CL.D_ClassDef{
81                  name = "world",                  name = "world",

Legend:
Removed from v.4348  
changed lines
  Added in v.4349

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