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

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

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

revision 3917, Sat May 28 16:41:39 2016 UTC revision 3918, Mon May 30 06:31:35 2016 UTC
# Line 62  Line 62 
62      fun verbFrag (spec, parFrag, seqFrag, subs) =      fun verbFrag (spec, parFrag, seqFrag, subs) =
63            CL.verbatimDcl [if (TargetSpec.isParallel spec) then parFrag else seqFrag] subs            CL.verbatimDcl [if (TargetSpec.isParallel spec) then parFrag else seqFrag] subs
64    
   (* generate declarations for the types and operations that are used in the program *)  
     fun genTypesAndOperations (outS, spec : TargetSpec.t, info) = let  
           fun doType (ty, isPrint) = ()  
           in  
             CollectInfo.applyToTypes doType info  
           end  
   
65    (* generate the struct declaration for the global variables *)    (* generate the struct declaration for the global variables *)
66      fun genGlobalStruct (spec : TargetSpec.t, globals) =  (* FIXME: what about constants? *)
67            if #hasGlobals spec      fun genGlobalStruct (env, consts, inputs, globals) =
68              if #hasGlobals(Env.target env)
69              then let              then let
70                val fields = [] (* FIXME *)                fun mkField gv = (TreeToCxx.trType(env, TreeGlobalVar.ty gv), TreeGlobalVar.name gv)
71                  val fields = List.map (mkField o Inputs.varOf) inputs
72                  val fields = fields @ List.map mkField globals
73                in                in
74                  [CL.D_StructDef(SOME "globals", fields, NONE)]                  [CL.D_StructDef(SOME "globals", fields, NONE)]
75                end                end
# Line 146  Line 142 
142    
143    (* generate source code that is common to both libraries and standalone executables *)    (* generate source code that is common to both libraries and standalone executables *)
144      fun outputSrc (outS, env, spec, prog, strand, substitutions, genInputCode) = let      fun outputSrc (outS, env, spec, prog, strand, substitutions, genInputCode) = let
145            val IR.Program{globals, create=IR.Create{dim, ...}, ...} = prog            val IR.Program{consts, inputs, globals, create=IR.Create{dim, ...}, ...} = prog
146            val IR.Strand{name=strandName, ...} = strand            val IR.Strand{name=strandName, ...} = strand
147            val ppDecl = Out.decl outS            val ppDecl = Out.decl outS
148              val {structDef, methods} = GenStrand.gen (env, strand)
149            val outputs = OutputUtil.gatherOutputs prog            val outputs = OutputUtil.gatherOutputs prog
150            in            in
151              if (TargetSpec.isParallel spec)              if (TargetSpec.isParallel spec)
# Line 163  Line 160 
160              if not(#hasInputs spec)              if not(#hasInputs spec)
161                then ppDecl (CL.D_Verbatim ["#define DIDEROT_NO_INPUTS\n"])                then ppDecl (CL.D_Verbatim ["#define DIDEROT_NO_INPUTS\n"])
162                else ();                else ();
163  (* FIXME: what about constants and inputs? *)              List.app ppDecl (genGlobalStruct (env, consts, inputs, globals));
164              List.app ppDecl (genGlobalStruct (spec, globals));              ppDecl structDef;
165              ppDecl (genWorldStruct(spec, strandName));              ppDecl (genWorldStruct(spec, strandName));
166              List.app ppDecl (genInputCode());              List.app ppDecl (genInputCode());
167  (* FIXME: need to gather/generate topDecls  (* FIXME: need to gather/generate topDecls
168              List.app ppDecl (!topDecls);              List.app ppDecl (!topDecls);
169  *)  *)
170              List.app ppDecl (GenStrand.gen (env, strand));              List.app ppDecl methods;
171              List.app ppDecl (GenOutputs.gen (env, dim, outputs));              List.app ppDecl (GenOutputs.gen (env, dim, outputs));
172              ppDecl (CL.verbatimDcl [Fragments.worldMethods] substitutions);              ppDecl (CL.verbatimDcl [Fragments.worldMethods] substitutions);
173  (* TODO  (* TODO
# Line 230  Line 227 
227            val fragment = Out.fragment substitutions outS            val fragment = Out.fragment substitutions outS
228            in            in
229              GenExecUtil.execHead (outS, substitutions);              GenExecUtil.execHead (outS, substitutions);
230              genTypesAndOperations (outS, spec, CollectInfo.collect prog);              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));
231              outputSrc (outS, env, spec, prog, strand, substitutions,              outputSrc (outS, env, spec, prog, strand, substitutions,
232                fn () => (                fn () => (
233                  GenInputs.genInputsStruct (env, inputs) @                  GenInputs.genInputsStruct (env, inputs) @

Legend:
Removed from v.3917  
changed lines
  Added in v.3918

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