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 3995, Sat Jun 18 20:00:19 2016 UTC revision 3996, Sun Jun 19 15:21:12 2016 UTC
# Line 104  Line 104 
104            end            end
105    
106      fun runFrag (spec, subs) = if TargetSpec.noBSP spec      fun runFrag (spec, subs) = if TargetSpec.noBSP spec
107              then verbFrag (spec, Fragments.parallelRunNoBSP, Fragments.sequentialRunNoBSP, subs)              then verbFrag (spec, CPUFragments.parallelRunNoBSP, CPUFragments.sequentialRunNoBSP, subs)
108              else verbFrag (spec, Fragments.parallelRun, Fragments.sequentialRun, subs)              else verbFrag (spec, CPUFragments.parallelRun, CPUFragments.sequentialRun, subs)
109    
110      fun compile (spec : TargetSpec.t, basename) = let      fun compile (spec : TargetSpec.t, basename) = let
111          (* generate the C compiler flags *)          (* generate the C compiler flags *)
# Line 141  Line 141 
141            val outputs = OutputUtil.gatherOutputs prog            val outputs = OutputUtil.gatherOutputs prog
142            in            in
143              if (TargetSpec.isParallel spec)              if (TargetSpec.isParallel spec)
144                then ppDecl (CL.verbatimDcl [Fragments.parallelExtras] substitutions)                then ppDecl (CL.verbatimDcl [CPUFragments.parallelExtras] substitutions)
145                else ();                else ();
146              if TargetSpec.dualState spec              if TargetSpec.dualState spec
147                then ppDecl (CL.D_Verbatim ["#define DIDEROT_DUAL_STATE\n"])                then ppDecl (CL.D_Verbatim ["#define DIDEROT_DUAL_STATE\n"])
# Line 161  Line 161 
161                else ();                else ();
162              List.app ppDecl methods;              List.app ppDecl methods;
163              List.app ppDecl (GenOutputs.gen (env, dim, outputs));              List.app ppDecl (GenOutputs.gen (env, dim, outputs));
164              ppDecl (CL.verbatimDcl [Fragments.worldMethods] substitutions);              ppDecl (CL.verbatimDcl [CPUFragments.worldMethods] substitutions);
165              ppDecl (GenWorld.genInitiallyFun (env, strand, create));              ppDecl (GenWorld.genInitiallyFun (env, strand, create));
166              ppDecl (runFrag (spec, substitutions))              ppDecl (runFrag (spec, substitutions))
167  (* FIXME: what about the global initially and update code? *)  (* FIXME: what about the global initially and update code? *)
# Line 177  Line 177 
177            val ppDecl = Out.decl outS            val ppDecl = Out.decl outS
178            val fragment = Out.fragment substitutions outS            val fragment = Out.fragment substitutions outS
179            in            in
180              GenExecUtil.head (outS, substitutions);              ppDecl (CL.verbatimDcl [CxxFragments.execHead] substitutions);
181              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));
182                ppDecl (CL.verbatimDcl [CxxFragments.namespaceOpen] substitutions);
183                ppDecl (CL.verbatimDcl [CxxFragments.nrrdSaveHelper] substitutions);
184              outputSrc (outS, env, spec, prog, strand, substitutions,              outputSrc (outS, env, spec, prog, strand, substitutions,
185                fn () => (                fn () => (
186                  GenInputs.genInputsStruct (env, inputs) @                  GenInputs.genInputsStruct (env, inputs) @
187                  GenInputs.genExecInputFuns (env, prog) @                  GenInputs.genExecInputFuns (env, prog) @
188                  GenOutputsUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));                  GenOutputsUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));
189              GenExecUtil.foot (outS, substitutions);              ppDecl (CL.verbatimDcl [CxxFragments.namespaceClose] substitutions);
190            (* generate main function after closing off the namespace *)            (* generate main function after closing off the namespace *)
191              ppDecl (verbFrag (spec, Fragments.parallelMain, Fragments.sequentialMain, substitutions));              ppDecl (verbFrag (spec, CPUFragments.parallelMain, CPUFragments.sequentialMain, substitutions));
192              Out.closeOut outS;              Out.closeOut outS;
193              compile (spec, baseName);              compile (spec, baseName);
194              RunCC.linkExec (baseName, ldFlags spec)              RunCC.linkExec (baseName, ldFlags spec)
# Line 250  Line 252 
252                  inputs = inputs,                  inputs = inputs,
253                  outputs = outputs                  outputs = outputs
254                };                };
255              GenLibraryUtil.head (outS, substitutions);              ppDecl (CL.verbatimDcl [CxxFragments.libCXXHead] substitutions);
256                List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));
257                ppDecl (CL.verbatimDcl [CxxFragments.namespaceOpen] substitutions);
258                ppDecl (CL.verbatimDcl [CxxFragments.nrrdSaveHelper] substitutions);
259              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));
260              outputSrc (outS, env, spec, prog, strand, substitutions,              outputSrc (outS, env, spec, prog, strand, substitutions,
261                fn () => (                fn () => (
# Line 259  Line 264 
264                  GenInputs.genExecInputFuns (env, prog) @                  GenInputs.genExecInputFuns (env, prog) @
265                  GenOutputsUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));                  GenOutputsUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));
266  *)[]));  *)[]));
267              GenLibraryUtil.foot (outS, substitutions);              ppDecl (CL.verbatimDcl [CxxFragments.namespaceClose] substitutions);
268  (* FIXME: generate the extern "C" decls for the exported functions *)  (* FIXME: generate the extern "C" decls for the exported functions *)
           (* generate main function after closing off the namespace *)  
             ppDecl (verbFrag (spec, Fragments.parallelMain, Fragments.sequentialMain, substitutions));  
269              Out.closeOut outS;              Out.closeOut outS;
270            (* compile and link *)            (* compile and link *)
271              compile (spec, baseName);              compile (spec, baseName);

Legend:
Removed from v.3995  
changed lines
  Added in v.3996

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