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 1432, Tue Jul 5 20:42:33 2011 UTC revision 1443, Mon Jul 11 10:36:10 2011 UTC
# Line 149  Line 149 
149        | GlobalScope        | GlobalScope
150        | InitiallyScope        | InitiallyScope
151        | StrandScope of TreeIL.var list  (* strand initialization *)        | StrandScope of TreeIL.var list  (* strand initialization *)
152        | MethodScope of TreeIL.var list  (* method body; vars are state variables *)        | MethodScope of MethodName.name * TreeIL.var list  (* method body; vars are state variables *)
153    
154    (* the supprted widths of vectors of reals on the target. *)    (* the supprted widths of vectors of reals on the target. *)
155  (* FIXME: for OpenCL 1.1, 3 is also valid *)  (* FIXME: for OpenCL 1.1, 3 is also valid *)
# Line 186  Line 186 
186  (* NOTE: if we move strand initialization to the GPU, then we'll have to change the following code! *)  (* NOTE: if we move strand initialization to the GPU, then we'll have to change the following code! *)
187                   of StrandScope stateVars =>                   of StrandScope stateVars =>
188                        ToCL.trBlock (vMap, saveState "StrandScope" stateVars ToCL.trAssign, blk)                        ToCL.trBlock (vMap, saveState "StrandScope" stateVars ToCL.trAssign, blk)
189                    | MethodScope stateVars =>                    | MethodScope(name, stateVars) =>
190                        ToCL.trBlock (vMap, saveState "MethodScope" stateVars ToCL.trAssign, blk)                        ToCL.trBlock (vMap, saveState "MethodScope" stateVars ToCL.trAssign, blk)
191                    | InitiallyScope => ToCL.trBlock (vMap, fn (_, _, stm) => [stm], blk)                    | InitiallyScope => ToCL.trBlock (vMap, fn (_, _, stm) => [stm], blk)
192                    | _ => ToC.trBlock (vMap, fn (_, _, stm) => [stm], blk)                    | _ => ToC.trBlock (vMap, fn (_, _, stm) => [stm], blk)
# Line 240  Line 240 
240          val scopeGlobal = setScope GlobalScope          val scopeGlobal = setScope GlobalScope
241          val scopeInitially = setScope InitiallyScope          val scopeInitially = setScope InitiallyScope
242          fun scopeStrand (env, svars) = setScope (StrandScope svars) env          fun scopeStrand (env, svars) = setScope (StrandScope svars) env
243          fun scopeMethod (env, svars) = setScope (MethodScope svars) env          fun scopeMethod (env, name, svars) = setScope (MethodScope(name, svars)) env
244        (* bind a TreeIL varaiable to a target variable *)        (* bind a TreeIL varaiable to a target variable *)
245          fun bind (ENV{info, vMap, scope}, x, x') = ENV{          fun bind (ENV{info, vMap, scope}, x, x') = ENV{
246                  info = info,                  info = info,
# Line 773  Line 773 
773    
774        (* register a strand method *)        (* register a strand method *)
775          fun method (Strand{name, tyName, code,...}, methName, body) = let          fun method (Strand{name, tyName, code,...}, methName, body) = let
776                val fName = concat[name, "_", methName]                val fName = concat[name, "_", MethodName.toString methName]
777                val params = [                val params = [
778                        globalParam (CL.T_Ptr(CL.T_Named tyName), "selfIn"),                        globalParam (CL.T_Ptr(CL.T_Named tyName), "selfIn"),
779                        globalParam (CL.T_Ptr(CL.T_Named tyName), "selfOut"),                        globalParam (CL.T_Ptr(CL.T_Named tyName), "selfOut"),
780                        globalParam (CL.T_Ptr(CL.T_Named (RN.globalsTy)), RN.globalsVarName),                        globalParam (CL.T_Ptr(CL.T_Named (RN.globalsTy)), RN.globalsVarName),
781                        CL.PARAM([],CL.T_Named(RN.imageDataType),RN.globalImageDataName)                        CL.PARAM([],CL.T_Named(RN.imageDataType),RN.globalImageDataName)
782                      ]                      ]
783                val methFn = CL.D_Func([], CL.int32, fName, params, body)                val resTy = (case methName
784                         of MethodName.Update => CL.T_Named "StrandStatus_t"
785                          | MethodName.Stabilize => CL.voidTy
786                        (* end case *))
787                  val methFn = CL.D_Func([], resTy, fName, params, body)
788                in                in
789                  code := methFn :: !code                  code := methFn :: !code
790                end                end

Legend:
Removed from v.1432  
changed lines
  Added in v.1443

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