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 95, Wed May 13 00:49:12 1998 UTC revision 102, Thu May 14 05:53:10 1998 UTC
# Line 11  Line 11 
11        structure Convert = Convert(MachSpec)        structure Convert = Convert(MachSpec)
12        structure CPStrans = CPStrans(MachSpec)        structure CPStrans = CPStrans(MachSpec)
13        structure CPSopt = CPSopt(MachSpec)        structure CPSopt = CPSopt(MachSpec)
14        structure NewClosure = NClosure(MachSpec)        structure Closure = Closure(MachSpec)
15        structure Spill = Spill(MachSpec)        structure Spill = Spill(MachSpec)
16        structure CpsSplit = CpsSplitFun (MachSpec)        structure CpsSplit = CpsSplitFun (MachSpec)
17  in  in
# Line 33  Line 33 
33  val convert   = phase "Compiler 060 convert" Convert.convert  val convert   = phase "Compiler 060 convert" Convert.convert
34  val cpstrans  = phase "Compiler 065 cpstrans" CPStrans.cpstrans  val cpstrans  = phase "Compiler 065 cpstrans" CPStrans.cpstrans
35  val cpsopt    = phase "Compiler 070 cpsopt" CPSopt.reduce  val cpsopt    = phase "Compiler 070 cpsopt" CPSopt.reduce
36  val closure   = phase "Compiler 080 closure"  NewClosure.closeCPS  val litsplit  = phase "Compiler 075 litsplit" Literals.litsplit
37    val lit2cps   = phase "Compiler 076 lit2cps" Literals.lit2cps
38    val closure   = phase "Compiler 080 closure"  Closure.closeCPS
39  val globalfix = phase "Compiler 090 globalfix" GlobalFix.globalfix  val globalfix = phase "Compiler 090 globalfix" GlobalFix.globalfix
40  val spill     = if MachSpec.spillAreaSz < 500 * MachSpec.valueSize  val spill     = if MachSpec.spillAreaSz < 500 * MachSpec.valueSize
41                  then phase "Compiler 100 spill" Spill.spill                  then phase "Compiler 100 spill" Spill.spill
# Line 41  Line 43 
43  val limit     = phase "Compiler 110 limit" Limit.nolimit  val limit     = phase "Compiler 110 limit" Limit.nolimit
44  val codegen   = phase "Compiler 120 cpsgen" Gen.codegen  val codegen   = phase "Compiler 120 cpsgen" Gen.codegen
45    
46    val closureD  = phase "Compiler 081 closureD"  Closure.closeCPS
47    val globalfixD= phase "Compiler 091 globalfixD" GlobalFix.globalfix
48    val spillD    = if MachSpec.spillAreaSz < 500 * MachSpec.valueSize
49                    then phase "Compiler 101 spillD" Spill.spill
50                    else fn x => x
51    val limitD    = phase "Compiler 110 limitD" Limit.nolimit
52    val codegenD  = phase "Compiler 121 cpsgenD" Gen.codegen
53    
54  (** pretty printing for the FLINT and CPS code *)  (** pretty printing for the FLINT and CPS code *)
55  val (prF, prC) =  val (prF, prC) =
56    let fun prGen (flag,printE) s e =    let fun prGen (flag,printE) s e =
57          if !flag then (say ("\n\n[After " ^ s ^ " ...]\n\n"); printE e; e)          if !flag then (say ("\n[After " ^ s ^ " ...]\n\n"); printE e;
58                           say "\n"; e)
59          else e          else e
60     in (prGen (CGC.printFlint, PPFlint.printProg),     in (prGen (CGC.printFlint, PPFlint.printProg),
61         prGen (CGC.printit, PPCps.printcps0))         prGen (CGC.printit, PPCps.printcps0))
# Line 78  Line 88 
88          check (ChkFlint.checkTop, PPFlint.printFundec,          check (ChkFlint.checkTop, PPFlint.printFundec,
89                 "FLINT") (CGC.checkFlint, b, s)                 "FLINT") (CGC.checkFlint, b, s)
90    
91        val _ = (chkF (false,"1") o prF "Translation") flint        val _ = (chkF (false,"1") o prF "Translation/Normalization") flint
92        val flint = (chkF (false,"2") o prF "Lcontract" o lcontract) flint        val flint = (chkF (false,"2") o prF "Lcontract" o lcontract) flint
93        val flint =        val flint =
94          if !CGC.specialize then          if !CGC.specialize then
# Line 87  Line 97 
97    
98        val flint = (chkF (false, "4") o prF "Wrapping" o wrapping) flint        val flint = (chkF (false, "4") o prF "Wrapping" o wrapping) flint
99        val flint = (chkF (true, "5") o prF "Reify" o reify) flint        val flint = (chkF (true, "5") o prF "Reify" o reify) flint
100        val function = convert flint  
101        val (nc0, ncn) =        val (nc0, ncn, dseg) =
102          let val _ = prC "convert" function          let val function = convert flint
103                val _ = prC "convert" function
104              val function = (prC "cpstrans" o cpstrans) function              val function = (prC "cpstrans" o cpstrans) function
105              local exception ZZZ              val function =
106              in                if !CGC.cpsopt then cpsopt (function,NONE,false)
107              val table : FLINT.lty Intmap.intmap = Intmap.new(32, ZZZ)                else function
             end  
             val (function,table) =  
               if !CGC.cpsopt then cpsopt (function,table,NONE,false)  
               else (function,table)  
108              val _ = prC "cpsopt" function              val _ = prC "cpsopt" function
109    
110                val (function, dlit) = litsplit function
111                val data = lit2cps dlit
112                val _ = prC "cpsopt-code" function
113                val _ = prC "cpsopt-data" data
114    
115              fun gen fx =              fun gen fx =
116                let val fx = (prC "closure" o closure) fx                let val fx = (prC "closure" o closure) fx
117                    val carg = globalfix fx                    val carg = globalfix fx
# Line 108  Line 120 
120                 in codegen (carg, limit, err);                 in codegen (carg, limit, err);
121                    collect ()                    collect ()
122                end                end
123    
124                fun gdata dd =
125                  let val x = Control.CG.printit
126                      val y = !x
127                      val _ = (x := false)
128                      val fx = (prC "closure" o closureD) dd
129                      val carg = globalfixD fx
130                      val carg = spillD carg
131                      val (carg, limit) = limitD carg
132                   in codegenD (carg, limit, err);
133                      (collect ()) before (x := y)
134                  end
135           in case CpsSplit.cpsSplit function           in case CpsSplit.cpsSplit function
136               of (fun0 :: funn) => (gen fun0, map gen funn)               of (fun0 :: funn) => (gen fun0, map gen funn, gdata data)
137                | [] => bug "unexpected case on gen in flintcomp"                | [] => bug "unexpected case on gen in flintcomp"
138          end          end
139     in {c0=nc0, cn=ncn , name=ref (SOME src)}     in {c0=nc0, cn=ncn, data=dseg, name=ref (SOME src)}
140    end (* function flintcomp *)    end (* function flintcomp *)
141    
142  val flintcomp = phase "Compiler 050 flintcomp" flintcomp  val flintcomp = phase "Compiler 050 flintcomp" flintcomp

Legend:
Removed from v.95  
changed lines
  Added in v.102

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