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

SCM Repository

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

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

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

revision 1374, Wed Jun 22 21:43:07 2011 UTC revision 1443, Mon Jul 11 10:36:10 2011 UTC
# Line 75  Line 75 
75        | GlobalScope        | GlobalScope
76        | InitiallyScope        | InitiallyScope
77        | StrandScope of TreeIL.var list  (* strand initialization *)        | StrandScope of TreeIL.var list  (* strand initialization *)
78        | MethodScope of TreeIL.var list  (* method body; vars are state variables *)        | MethodScope of MethodName.name * TreeIL.var list  (* method body; vars are state variables *)
79    
80    (* the supprted widths of vectors of reals on the target.  For the GNU vector extensions,    (* the supprted widths of vectors of reals on the target.  For the GNU vector extensions,
81     * the supported sizes are powers of two, but float2 is broken.     * the supported sizes are powers of two, but float2 is broken.
# Line 107  Line 107 
107                  raise Fail(concat["saveState ", cxt, ": length mismatch"]))                  raise Fail(concat["saveState ", cxt, ": length mismatch"]))
108          fun block (ENV{vMap, scope, ...}, blk) = (case scope          fun block (ENV{vMap, scope, ...}, blk) = (case scope
109                 of StrandScope stateVars => ToC.trBlock (vMap, saveState "StrandScope" stateVars, blk)                 of StrandScope stateVars => ToC.trBlock (vMap, saveState "StrandScope" stateVars, blk)
110                  | MethodScope stateVars => ToC.trBlock (vMap, saveState "MethodScope" stateVars, blk)                  | MethodScope(name, stateVars) => ToC.trBlock (vMap, saveState "MethodScope" stateVars, blk)
111                  | _ => ToC.trBlock (vMap, fn (_, _, stm) => [stm], blk)                  | _ => ToC.trBlock (vMap, fn (_, _, stm) => [stm], blk)
112                (* end case *))                (* end case *))
113          fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e)          fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e)
# Line 147  Line 147 
147          val scopeGlobal = setScope GlobalScope          val scopeGlobal = setScope GlobalScope
148          val scopeInitially = setScope InitiallyScope          val scopeInitially = setScope InitiallyScope
149          fun scopeStrand (env, svars) = setScope (StrandScope svars) env          fun scopeStrand (env, svars) = setScope (StrandScope svars) env
150          fun scopeMethod (env, svars) = setScope (MethodScope svars) env          fun scopeMethod (env, name, svars) = setScope (MethodScope(name, svars)) env
151        (* bind a TreeIL varaiable to a target variable *)        (* bind a TreeIL varaiable to a target variable *)
152          fun bind (ENV{info, vMap, scope}, x, x') = ENV{          fun bind (ENV{info, vMap, scope}, x, x') = ENV{
153                  info = info,                  info = info,
# Line 432  Line 432 
432    
433        (* register a strand method *)        (* register a strand method *)
434          fun method (Strand{name, tyName, code, ...}, methName, body) = let          fun method (Strand{name, tyName, code, ...}, methName, body) = let
435                val fName = concat[name, "_", methName]                val fName = concat[name, "_", MethodName.toString methName]
436                val params = [                val params = [
437                        CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfIn"),                        CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfIn"),
438                        CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfOut")                        CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfOut")
439                      ]                      ]
440                val methFn = CL.D_Func(["static"], CL.int32, fName, params, body)                val resTy = (case methName
441                         of MethodName.Update => CL.T_Named "StrandStatus_t"
442                          | MethodName.Stabilize => CL.voidTy
443                        (* end case *))
444                  val methFn = CL.D_Func(["static"], resTy, fName, params, body)
445                in                in
446                  code := methFn :: !code                  code := methFn :: !code
447                end                end

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

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