Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/FLINT/main/flintcomp.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/main/flintcomp.sml

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

revision 158, Mon Oct 12 02:41:33 1998 UTC revision 162, Tue Oct 27 22:16:21 1998 UTC
# Line 14  Line 14 
14        structure Closure = Closure(MachSpec)        structure Closure = Closure(MachSpec)
15        structure Spill = Spill(MachSpec)        structure Spill = Spill(MachSpec)
16        structure CpsSplit = CpsSplitFun (MachSpec)        structure CpsSplit = CpsSplitFun (MachSpec)
17          structure CTRL = Control.FLINT
18  in  in
19    
20  val architecture = Gen.MachSpec.architecture  val architecture = Gen.MachSpec.architecture
# Line 22  Line 23 
23    
24  fun phase x = Stats.doPhase (Stats.makePhase x)  fun phase x = Stats.doPhase (Stats.makePhase x)
25    
26  (*  val lcontract = phase "Compiler 052 lcontract" LContract.lcontract  *)  val lcontract = phase "Compiler 052 lcontract" LContract.lcontract
27  val fcontract = phase "Compiler 052 fcontract" FContract.contract  val fcontract = phase "Compiler 052 fcontract" FContract.contract
28  val specialize= phase "Compiler 053 specialize" Specialize.specialize  val specialize= phase "Compiler 053 specialize" Specialize.specialize
29  val wrapping  = phase "Compiler 054 wrapping" Wrapping.wrapping  val wrapping  = phase "Compiler 054 wrapping" Wrapping.wrapping
# Line 56  Line 57 
57          if !flag then (say ("\n[After " ^ s ^ " ...]\n\n"); printE e;          if !flag then (say ("\n[After " ^ s ^ " ...]\n\n"); printE e;
58                         say "\n"; e)                         say "\n"; e)
59          else e          else e
60     in (prGen (Control.FLINT.print, PPFlint.printProg),     in (prGen (CTRL.print, PPFlint.printProg),
61         prGen (Control.CG.printit, PPCps.printcps0))         prGen (Control.CG.printit, PPCps.printcps0))
62    end    end
63    
# Line 85  Line 86 
86           e)           e)
87        fun chkF (b, s) =        fun chkF (b, s) =
88          check (ChkFlint.checkTop, PPFlint.printFundec,          check (ChkFlint.checkTop, PPFlint.printFundec,
89                 "FLINT") (Control.FLINT.check, b, s)                 "FLINT") (CTRL.check, b, s)
90    
91        val _ = (chkF (false,"1") o prF "Translation/Normalization") flint        (* f:FLINT.prog   flint codee
92        val flint = (chkF (false,"2") o prF "Fcontract" o fcontract) flint         * r:boot         whether it has gone through reify yet
93           * l:string       last phase through which it went *)
94        val flint =        fun runphase (p as "fcontract",(f,r,l)) = (fcontract f, r, p)
95          if !Control.FLINT.specialize then          | runphase (p as "lcontract",(f,r,l)) = (lcontract f, r, p)
96             (chkF (false,"3") o prF "Specialization" o specialize) flint          | runphase (p as "fixfix",(f,r,l)) = (fixfix f, r, p)
97          else flint          | runphase (p as "wrap",(f,false,l)) = (wrapping f, false, p)
98        val flint = (chkF (false,"2") o prF "Fcontract" o fcontract) flint          | runphase (p as "specialize",(f,false,l)) = (specialize f, false, p)
99            | runphase (p as "reify",(f,false,l)) = (reify f, true, p)
100    
101            (* pseudo FLINT phases *)
102            | runphase ("id",(f,r,l)) = (f,r,l)
103            | runphase (p as "print",(f,r,l)) =
104              (say("\n[ After "^l^"... ]\n"); PPFlint.printFundec f; (f,r,l))
105            | runphase ("check",(f,r,l)) =
106              (check (ChkFlint.checkTop, PPFlint.printFundec, "FLINT")
107                     (ref true, r, l) f; (f,r,l))
108            | runphase (p as ("reify"|"specialize"|"wrap"),(f,true,l)) =
109              (say("\n"^p^"cannot be used after reify!\n"); (f,true,l))
110            | runphase (p,(f,r,l)) =
111              (say("\n!! Unknown FLINT phase '"^p^"' !!\n"); (f,r,l))
112    
113          fun print (f,r,l) = (prF l f; (f, r, l))
114          fun check (f,r,l) = (chkF (r, l) f; (f, r, l))
115    
116          (* the "id" phases is just added to do the print/check at the entrance *)
117          val (flint,true,_) = foldl (check o print o runphase)
118                                     (flint,false,"flintnm")
119                                     ("id" :: !CTRL.phases)
120    
121    (*        val _ = (chkF (false,"1") o prF "Translation/Normalization") flint *)
122    (*        val flint = (chkF (false,"2") o prF "Fcontract" o fcontract) flint *)
123    
124    (*        val flint = *)
125    (*          if !Control.FLINT.specialize then *)
126    (*             (chkF (false,"3") o prF "Specialization" o specialize) flint *)
127    (*          else flint *)
128    (*        val flint = (chkF (false,"2") o prF "Fcontract" o fcontract) flint *)
129    
130  (*        val flint = (chkF (false,"6") o prF "FixFix" o fixfix) flint *)  (*        val flint = (chkF (false,"6") o prF "FixFix" o fixfix) flint *)
131        val flint = (chkF (false,"2") o prF "Fcontract" o fcontract) flint  (*        val flint = (chkF (false,"2") o prF "Fcontract" o fcontract) flint *)
132    
133        val flint = (chkF (false, "4") o prF "Wrapping" o wrapping) flint  (*        val flint = (chkF (false, "4") o prF "Wrapping" o wrapping) flint *)
134        val flint = (chkF (true, "5") o prF "Reify" o reify) flint  (*        val flint = (chkF (true, "5") o prF "Reify" o reify) flint *)
135    
136        val flint = (chkF (true,"2") o prF "Fcontract" o fcontract) flint  (*        val flint = (chkF (true,"2") o prF "Fcontract" o fcontract) flint *)
137    
138        val (nc0, ncn, dseg) =        val (nc0, ncn, dseg) =
139          let val function = convert flint          let val function = convert flint
140              val _ = prC "convert" function              val _ = prC "convert" function
141              val function = (prC "cpstrans" o cpstrans) function              val function = (prC "cpstrans" o cpstrans) function
142              val function =              val function = cpsopt (function,NONE,false)
               if !Control.CG.cpsopt then cpsopt (function,NONE,false)  
               else function  
143              val _ = prC "cpsopt" function              val _ = prC "cpsopt" function
144    
145              val (function, dlit) = litsplit function              val (function, dlit) = litsplit function

Legend:
Removed from v.158  
changed lines
  Added in v.162

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