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 3443, Thu Nov 19 23:24:18 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 testinitial=0
# Line 26  Line 26 
26      fun test0 n=(case testinitial      fun test0 n=(case testinitial
27          of 0=>testp n          of 0=>testp n
28          | _ => (print(String.concat n);1))          | _ => (print(String.concat n);1))
29      fun toStringBind e= MidToString.toStringBind e      fun toStringBind e= MidToS.toStringBind e
30      fun useCount (HighIL.V{useCnt, ...}) = !useCnt      fun useCount (HighIL.V{useCnt, ...}) = !useCnt
31      fun expandEinOp (srcy,bind00)=let      fun expandEinOp (srcy,bind00)=let
32            val _= raise Fail"development branch- do not use"
33          val star="************"          val star="************"
34            val _= ("\n Start"^star)
35          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]
36          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
37    
38    
39          (* ************* Sweep for 0's'*********** *)          (* ************* Sweep for 0's'*********** *)
40            val _ =testp["Pre Sweep\n",P.printbody body,"\n"]
41          val bodysweep=sweepEin.sweep body          val bodysweep=sweepEin.sweep body
42          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}
43          val _=testp["Post Sweep\n",P.printbody bodysweep,"\n"]          val _=testp["Post Sweep\n",P.printbody bodysweep,"\n"]
# Line 45  Line 47 
47          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))
48          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]
49    
50         (* **************** lift no split ************* *)
51            (*
52            val (einapp1,e2)=L.testLift  bind3
53            val newbies5=e2@[einapp1]
54            val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))
55    
56            *)
57        (* **************** lift and split************* *)
58        (*
59             val (einapp1,e2)=L.testLift  bind3
60            val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))
61            val (newbies5)=Split.limitSplit(bind3,[],200)
62        *)
63    
64          (* **************** split phase ************* *)          (* **************** split phase ************* *)
65    
66          val (newbies5)= Split.splitEinApp bind3          val (newbies5)= Split.splitEinApp bind3
         val _ =test0["\n\n Returning \n\n =>",  
             String.concatWith",\n\t"(List.map toStringBind newbies5)]  
67    
68    
          (* ************** ProbeEIN *********** *)  
         (*val code=List.map (fn e=>ProbeEin.expandEinOp e) (newbies5)*)  
69    
70            (**************** printing result ***************)
71            val _ =testp["\n\n Returning \n\n =>",
72            String.concatWith",\n\t"(List.map toStringBind newbies5)]
73            val n =length(newbies5)
74            val _ = if (n > 10) then testp["\n **** SPLIT Length",Int.toString(n)] else 1
75             (* ************** ProbeEIN *********** *)
76          (*gives probeEIN the set. Could split into a sepearate step*)          (*gives probeEIN the set. Could split into a sepearate step*)
77          val fieldset= einSet.EinSet.empty          val fieldset= einSet.EinSet.empty
78          val isField = ref 0          val isField = ref 0
# Line 70  Line 89 
89          val code=iter(newbies5, fieldset)          val code=iter(newbies5, fieldset)
90    
91          val n= List.length(code)          val n= List.length(code)
92            val _ =testp[HighIL.Var.name srcy ," Pieces",Int.toString (n),"\n"]
93    (*
94            val _ = if (n>5)            val _ = if (n>5)
95           then  (String.concat["\n\n",star,":Name:",HighIL.Var.name srcy ,            then  print(String.concat["\n",star,":Name:",HighIL.Var.name srcy ,
96              ":VarCount(",Int.toString(useCount srcy),")",              ":VarCount(",Int.toString(useCount srcy),")","Pieces now: ",Int.toString (n),
                 "\n\t",star,"Pieces now: ",Int.toString (n),  
97              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),
98              " Replaced_Fields:",Int.toString(!isFieldR)              " Replaced_Fields:",Int.toString(!isFieldR)])
99                 ,toStringBind bind3])              else print ""
100              else  ""  *)
   
101          val flatcode= List.foldr op@ [] code          val flatcode= List.foldr op@ [] code
         (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)  
102    
103    
104            (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)
105            val _=(star^"end")
106          in          in
107              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode
108          end          end

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

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