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

SCM Repository

[diderot] Diff of /branches/charisee_dev/src/compiler/high-to-mid/handleEin.sml
ViewVC logotype

Diff of /branches/charisee_dev/src/compiler/high-to-mid/handleEin.sml

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

revision 3304, Fri Oct 16 18:51:09 2015 UTC revision 3489, Tue Dec 8 20:49:31 2015 UTC
# Line 1  Line 1 
1  (* Expands probe ein  (* Expands probe ein
2   *   *
3   * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)   * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4     *
5     * COPYRIGHT (c) 2015 The University of Chicago
6   * All rights reserved.   * All rights reserved.
7   *)   *)
8    
# Line 10  Line 12 
12    
13      structure E = Ein      structure E = Ein
14      structure DstIL = MidIL      structure DstIL = MidIL
     structure DstOp = MidOps  
15      structure P=Printer      structure P=Printer
     structure T=TransformEin  
16      structure MidToS=MidToString      structure MidToS=MidToString
17      structure DstV  = DstIL.Var      structure L=LiftEin
18      in      in
19    
20      val testinitial=0      val liftflag=true
21        val splitflag=true
22        val splitlimit=SOME 2650
23    
24        val testinitial=1
25      val testing=0      val testing=0
26      fun testp n=(case testing      fun testp n=(case testing
27          of 0=> 1          of 0=> 1
# Line 26  Line 30 
30      fun test0 n=(case testinitial      fun test0 n=(case testinitial
31          of 0=>testp n          of 0=>testp n
32          | _ => (print(String.concat n);1))          | _ => (print(String.concat n);1))
33      fun toStringBind e= MidToString.toStringBind e      fun toStringBind e= MidToS.toStringBind e
34      fun useCount (HighIL.V{useCnt, ...}) = !useCnt      fun useCount (HighIL.V{useCnt, ...}) = !useCnt
35      fun expandEinOp (srcy,bind00)=let      fun expandEinOp (srcy,bind00)=let
36            (*val _= raise Fail"development branch- do not use"*)
37    
38          val star="************"          val star="************"
39            val _= ("\n Start"^star)
40          val _ =test0[star,"\n Original EinApp",star,"\n\n","start get test",toStringBind bind00]          val _ =test0[star,"\n Original EinApp",star,"\n\n","start get test",toStringBind bind00]
41          val (y,einapp as DstIL.EINAPP(Ein.EIN{params, index, body},args))=bind00          val (y,einapp as DstIL.EINAPP(Ein.EIN{params, index, body},args))=bind00
42    
43    
44          (* ************* Sweep for 0's'*********** *)          (* ************* Sweep for 0's'*********** *)
45            val _ =testp["Pre Sweep\n",P.printbody body,"\n"]
46          val bodysweep=sweepEin.sweep body          val bodysweep=sweepEin.sweep body
47          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}
48          val _=testp["Post Sweep\n",P.printbody bodysweep,"\n"]          val _=testp["Post Sweep\n",P.printbody bodysweep,"\n"]
# Line 45  Line 52 
52          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))
53          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]
54    
55            (* **************** lift - split ************* *)
56            val newbies5=  (case (splitflag,liftflag,splitlimit)
57                of (true,false,NONE) => Split.splitEinApp bind3
58          (* **************** split phase ************* *)          (* **************** split phase ************* *)
59          val (newbies5)= Split.splitEinApp bind3              | (true,false,SOME limit) =>let
60          val _ =test0["\n\n Returning \n\n =>",                  val _ =print (String.concat["\nSPLit with limit",Int.toString(limit)])
61                    in Split.limitSplit(bind3,limit) end
62                | (true,true,SOME limit) =>  let
63                    (* **************** lift and split Limit ************* *)
64                    val (einapp1,e2)=L.testLift  bind3
65                    val _ =print (String.concat["\nSPLit with limit",Int.toString(limit),"\n **** lift Length:",Int.toString(length(e2))])
66                    val newbies4=Split.limitSplit(einapp1,limit)
67                    in (e2@newbies4) end
68                | (true,true, NONE) => let
69                    (* **************** lift and split All ************* *)
70                    val (einapp1,e2)=L.testLift  bind3
71                    val _ =  testp["\n **** lift Length"^(Int.toString(length(e2)))]
72                    val newbies4=Split.splitEinApp einapp1
73                    in (e2@newbies4) end
74                | (false,true,_) => let
75                    val (einapp1,e2)=L.testLift  bind3
76                    val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))
77                    in (e2@[einapp1]) end
78                |  (false,false,_)=>Split.splitEinApp bind3
79            (* end case *))
80            val _ =print"************** TASH"
81            (**************** printing result ***************)
82            val _ =testp["\n\n Returning \n\n =>",
83              String.concatWith",\n\t"(List.map toStringBind newbies5)]              String.concatWith",\n\t"(List.map toStringBind newbies5)]
84            val n =length(newbies5)
85            val _ = if (n > 10) then print(String.concat["\n **** SPLIT Length",Int.toString(n)]) else print ""
86           (* ************** ProbeEIN *********** *)           (* ************** ProbeEIN *********** *)
         (*val code=List.map (fn e=>ProbeEin.expandEinOp e) (newbies5)*)  
   
87          (*gives probeEIN the set. Could split into a sepearate step*)          (*gives probeEIN the set. Could split into a sepearate step*)
88          val fieldset= einSet.EinSet.empty          val fieldset= einSet.EinSet.empty
89          val isField = ref 0          val isField = ref 0
# Line 70  Line 100 
100          val code=iter(newbies5, fieldset)          val code=iter(newbies5, fieldset)
101    
102          val n= List.length(code)          val n= List.length(code)
103            val _ =testp[HighIL.Var.name srcy ," Pieces",Int.toString (n),"\n"]
104    (*
105            val _ = if (n>5)            val _ = if (n>5)
106           then  (String.concat["\n\n",star,":Name:",HighIL.Var.name srcy ,            then  print(String.concat["\n",star,":Name:",HighIL.Var.name srcy ,
107              ":VarCount(",Int.toString(useCount srcy),")",              ":VarCount(",Int.toString(useCount srcy),")","Pieces now: ",Int.toString (n),
                 "\n\t",star,"Pieces now: ",Int.toString (n),  
108              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),
109              " Replaced_Fields:",Int.toString(!isFieldR)              " Replaced_Fields:",Int.toString(!isFieldR)])
110                 ,toStringBind bind3])              else print ""
111              else  ""  *)
   
112          val flatcode= List.foldr op@ [] code          val flatcode= List.foldr op@ [] code
         (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)  
113    
114    
115            (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)
116            val _=(star^"end")
117          in          in
118              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode
119          end          end

Legend:
Removed from v.3304  
changed lines
  Added in v.3489

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