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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/tree-to-c/tree-to-c.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/tree-to-c/tree-to-c.sml

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

revision 3865, Mon May 16 16:32:19 2016 UTC revision 3866, Mon May 16 16:48:13 2016 UTC
# Line 21  Line 21 
21      structure CL = CLang      structure CL = CLang
22      structure Spec = TargetSpec      structure Spec = TargetSpec
23    
   (* generate a function definition for a strand method *)  
     fun genMethod (spec, strandName, methTy, methName, body) = let  
           val globTy = N.globalsPtrTy props  
           val fName = concat[strandName, "_", methName]  
           val stateParams = if Spec.dualState spec  
                 then [  
                     CL.PARAM(["const"], CL.T_Ptr(CL.T_Named tyName), "selfIn"),  
                     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfOut")  
                   ]  
                 else [CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "self")]  
           val params = if #hasGlobals spec  
                 then CL.PARAM([], globTy, "glob") :: stateParams  
                 else stateParams  
           val methFn = CL.D_Func(["static"], resTy, fName, params, body)  
           in  
             CL.D_Func(["static"], methTy, methName, params, body)  
           end  
   
     fun genInitiallyMethod (_, _, NONE) = []  
       | genInitiallyMethod (spec, strandName, SOME body) =  
           genMethod (spec, strandName, CL.T_Named "StrandStatus_t", "initially", body)  
   
     fun genUpdateMethod (spec, strandName, body) =  
           genMethod (spec, strandName, CL.T_Named "StrandStatus_t", "update", body)  
   
     fun genStabilizeMethod (_, _, NONE) = []  
       | genStabilizeMethod (spec, strandName, SOME body) =  
           genMethod (spec, strandName, CL.voidTy, "stabilize", body)  
   
24      fun generate (tgt : TargetOptions.t) prog = let      fun generate (tgt : TargetOptions.t) prog = let
25            val IR.Program{            val IR.Program{
26                    props, target, consts, inputs, constInit,                    props, target, consts, inputs, constInit,

Legend:
Removed from v.3865  
changed lines
  Added in v.3866

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