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 3974, Wed Jun 15 13:53:38 2016 UTC revision 3990, Fri Jun 17 21:27:47 2016 UTC
# Line 50  Line 50 
50            in [            in [
51              ("CFILE",                   OS.Path.joinBaseExt{base= #outBase spec, ext= SOME "c"}),              ("CFILE",                   OS.Path.joinBaseExt{base= #outBase spec, ext= SOME "c"}),
52              ("CXXFILE",                 OS.Path.joinBaseExt{base= #outBase spec, ext= SOME "cxx"}),              ("CXXFILE",                 OS.Path.joinBaseExt{base= #outBase spec, ext= SOME "cxx"}),
53              ("HDRFILE",                 OS.Path.joinBaseExt{base= #outBase spec, ext= SOME "h"}),              ("H_FILE",                  OS.Path.joinBaseExt{base= #outBase spec, ext= SOME "h"}),
54              ("PREFIX",                  #namespace spec),              ("PREFIX",                  #namespace spec),
55              ("SRCFILE",                 #srcFile spec),              ("SRCFILE",                 #srcFile spec),
56              ("PROG_NAME",               #outBase spec),              ("PROG_NAME",               #outBase spec),
# Line 165  Line 165 
165              ppDecl (runFrag (spec, substitutions))              ppDecl (runFrag (spec, substitutions))
166            end            end
167    
168        fun exec (spec : TargetSpec.t, prog) = let
169              val IR.Program{inputs, strand, create, ...} = prog
170              val env = mkEnv spec
171              val baseName = OS.Path.joinDirFile{dir = #outDir spec, file = #outBase spec}
172              val substitutions = mkSubs (spec, strand, create)
173            (* output to C++ file *)
174              val outS = openCxxOut baseName
175              val ppDecl = Out.decl outS
176              val fragment = Out.fragment substitutions outS
177              in
178                GenExecUtil.head (outS, substitutions);
179                List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));
180                outputSrc (outS, env, spec, prog, strand, substitutions,
181                  fn () => (
182                    GenInputs.genInputsStruct (env, inputs) @
183                    GenInputs.genExecInputFuns (env, prog) @
184                    GenOutputsUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));
185                GenExecUtil.foot (outS, substitutions);
186              (* generate main function after closing off the namespace *)
187                ppDecl (verbFrag (spec, Fragments.parallelMain, Fragments.sequentialMain, substitutions));
188                Out.closeOut outS;
189                compile (spec, baseName);
190                RunCC.linkExec (baseName, ldFlags spec)
191              end
192    
193  (********************  (********************
194          fun outputLibSrc (baseName, prog as Prog{props, inputs, strands, ...}) = let          fun outputLibSrc (baseName, prog as Prog{props, inputs, strands, ...}) = let
195                val [strand] = AtomTable.listItems strands                val [strand] = AtomTable.listItems strands
# Line 203  Line 228 
228                end                end
229  ********************)  ********************)
230    
231      fun exec (spec : TargetSpec.t, prog) = let      fun library (spec : TargetSpec.t, prog) = let
232            val IR.Program{inputs, strand, create, ...} = prog            val IR.Program{inputs, strand, create, ...} = prog
233            val env = mkEnv spec            val env = mkEnv spec
234            val baseName = OS.Path.joinDirFile{dir = #outDir spec, file = #outBase spec}            val baseName = OS.Path.joinDirFile{dir = #outDir spec, file = #outBase spec}
# Line 212  Line 237 
237            val outS = openCxxOut baseName            val outS = openCxxOut baseName
238            val ppDecl = Out.decl outS            val ppDecl = Out.decl outS
239            val fragment = Out.fragment substitutions outS            val fragment = Out.fragment substitutions outS
240            (* gather the outputs *)
241              val outputs = OutputUtil.gatherOutputs prog
242            in            in
243              GenExecUtil.execHead (outS, substitutions);            (* generate the library .h file *)
244                GenLibraryInterface.gen {
245                    subs = substitutions,
246                    env = env,
247                    rt = NONE, (* ?? *)
248                    inputs = inputs,
249                    outputs = outputs
250                  };
251                GenLibraryUtil.head (outS, substitutions);
252              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));              List.app ppDecl (GenTysAndOps.gen (env, CollectInfo.collect prog));
253              outputSrc (outS, env, spec, prog, strand, substitutions,              outputSrc (outS, env, spec, prog, strand, substitutions,
254                fn () => (                fn () => (
255                  GenInputs.genInputsStruct (env, inputs) @                  GenInputs.genInputsStruct (env, inputs) @
256    (* FIXME: generate input functions for library
257                  GenInputs.genExecInputFuns (env, prog) @                  GenInputs.genExecInputFuns (env, prog) @
258                  OutputUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));                  GenOutputsUtil.genRegisterOutputOpts (env, OutputUtil.gatherOutputs prog)));
259              GenExecUtil.execFoot (outS, substitutions);  *)[]));
260                GenLibraryUtil.foot (outS, substitutions);
261            (* generate main function after closing off the namespace *)            (* generate main function after closing off the namespace *)
262              ppDecl (verbFrag (spec, Fragments.parallelMain, Fragments.sequentialMain, substitutions));              ppDecl (verbFrag (spec, Fragments.parallelMain, Fragments.sequentialMain, substitutions));
263              Out.closeOut outS;              Out.closeOut outS;
264              (* compile and link *)
265              compile (spec, baseName);              compile (spec, baseName);
266              RunCC.linkExec (baseName, ldFlags spec)              RunCC.linkLib (baseName, ldFlags spec)
           end  
   
     fun library (spec : TargetSpec.t, prog) = let  
           val IR.Program{  
                   props, target, consts, inputs, constInit,  
                   globals, globalInit, strand, create, update  
                 } = prog  
           val {outDir, outBase, exec, double, debug, ...} = spec  
           val env = mkEnv spec  
           in  
             raise Fail "FIXME"  
267            end            end
268    
269    end    end

Legend:
Removed from v.3974  
changed lines
  Added in v.3990

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