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

SCM Repository

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

Diff of /branches/vis12/src/compiler/c-target/c-target.sml

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

revision 2076, Sun Nov 4 22:10:56 2012 UTC revision 2077, Mon Nov 5 11:51:35 2012 UTC
# Line 212  Line 212 
212                    nAxes = ref(SOME ~1),                    nAxes = ref(SOME ~1),
213                    initially = ref(CL.D_Comment["missing initially"])                    initially = ref(CL.D_Comment["missing initially"])
214                  })                  })
 (* FIXME: for standalone exes, the defaults should be set in the inputs struct;  
  * not sure how to handle library inputs yet.  
  *)  
 (* DEPRECATED  
       (* register the code that is used to set defaults for input variables *)  
         fun inputs (Prog{tgt, inputs, topDecls, ...}, env, blk) = let  
               val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy tgt))  
               val globTy = CL.T_Ptr(CL.T_Named(N.globalTy tgt))  
               val body = CL.mkBlock(  
                     CL.mkDeclInit(globTy, "glob", CL.mkIndirect(CL.mkVar "wrld", "globals")) ::  
                     CL.unBlock (Tr.block (env, blk)))  
               val inputsFn = CL.D_Func(  
                     ["static"], CL.voidTy, N.initDefaults,  
                     [CL.PARAM([], worldTy, "wrld")],  
                     body)  
               in  
                 inputs := GenInputs.gatherInputs blk;  
                 topDecls := inputsFn :: !topDecls  
               end  
 *)  
215        (* gather the inputs *)        (* gather the inputs *)
216          fun inputs (Prog{inputs, ...}, env, blk) = inputs := GenInputs.gatherInputs blk          fun inputs (Prog{inputs, ...}, env, blk) = inputs := GenInputs.gatherInputs blk
217        (* register the global initialization part of a program *)        (* register the global initialization part of a program *)
# Line 458  Line 438 
438                end                end
439    
440          fun outputLibSrc (baseName, Prog{          fun outputLibSrc (baseName, Prog{
441                  tgt, inputs, globals, topDecls, strands, nAxes, initially, ...                  tgt, hasDie, hasNew, hasCom, hasReduce,
442                    inputs, globals, topDecls, strands, nAxes, initially, ...
443                }) = let                }) = let
444                (* does the program require barrier synchronization to implement BSP semantics? *)
445                  val needsBarrier = hasCom orelse hasReduce
446                val [strand as Strand{name, tyName, state, output, ...}] = AtomTable.listItems strands                val [strand as Strand{name, tyName, state, output, ...}] = AtomTable.listItems strands
447                val outputs = GenOutput.gen (tgt, !nAxes) [output]                val outputs = GenOutput.gen (tgt, !nAxes) [output]
448                val substitutions = mkSubs (tgt, strand)                val substitutions = mkSubs (tgt, strand)
# Line 485  Line 468 
468                  ppDecl (CL.verbatim [InitFrag.text] substitutions);                  ppDecl (CL.verbatim [InitFrag.text] substitutions);
469                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);
470                  ppDecl (!initially);                  ppDecl (!initially);
471                    ppDecl (CL.verbatim [
472                        if not(#parallel tgt) then SeqRunFrag.text
473                        else if needsBarrier then ParRunFrag.text
474                        else ParRunFragNoBar.text
475                      ] substitutions);
476    (*
477                  ppDecl (verbFrag (tgt, ParRunFrag.text, SeqRunFrag.text, substitutions));                  ppDecl (verbFrag (tgt, ParRunFrag.text, SeqRunFrag.text, substitutions));
478    *)
479                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);
480                  PrintAsC.close ppStrm;                  PrintAsC.close ppStrm;
481                  TextIO.closeOut outS                  TextIO.closeOut outS
# Line 513  Line 503 
503                end                end
504    
505          fun genExecSrc (baseName, prog) = let          fun genExecSrc (baseName, prog) = let
506                val Prog{tgt, inputs, globals, topDecls, strands, nAxes, initially, ...} = prog                val Prog{
507                          tgt, hasDie, hasNew, hasCom, hasReduce,
508                          inputs, globals, topDecls, strands, nAxes, initially, ...
509                        } = prog
510                (* does the program require barrier synchronization to implement BSP semantics? *)
511                  val needsBarrier = hasCom orelse hasReduce
512                val [strand as Strand{name, tyName, state, output, ...}] = AtomTable.listItems strands                val [strand as Strand{name, tyName, state, output, ...}] = AtomTable.listItems strands
513                val outputs = GenOutput.gen (tgt, !nAxes) [output]                val outputs = GenOutput.gen (tgt, !nAxes) [output]
514                val substitutions =                val substitutions =
# Line 541  Line 536 
536                  ppDecl (CL.verbatim [InitFrag.text] substitutions);                  ppDecl (CL.verbatim [InitFrag.text] substitutions);
537                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);
538                  ppDecl (!initially);                  ppDecl (!initially);
539                    ppDecl (CL.verbatim [
540                        if not(#parallel tgt) then SeqRunFrag.text
541                        else if needsBarrier then ParRunFrag.text
542                        else ParRunFragNoBar.text
543                      ] substitutions);
544    (*
545                  ppDecl (verbFrag (tgt, ParRunFrag.text, SeqRunFrag.text, substitutions));                  ppDecl (verbFrag (tgt, ParRunFrag.text, SeqRunFrag.text, substitutions));
546    *)
547                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);
548                  ppDecl (verbFrag (tgt, ParMainFrag.text, SeqMainFrag.text, substitutions));                  ppDecl (verbFrag (tgt, ParMainFrag.text, SeqMainFrag.text, substitutions));
549                  PrintAsC.close ppStrm;                  PrintAsC.close ppStrm;

Legend:
Removed from v.2076  
changed lines
  Added in v.2077

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