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

SCM Repository

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

Annotation of /branches/charisee/src/compiler/high-to-mid/handleEin.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3260 - (view) (download)

1 : cchiw 2845 (* Expands probe ein
2 :     *
3 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure handleEin = struct
8 :    
9 :     local
10 :    
11 :     structure E = Ein
12 :     structure DstIL = MidIL
13 :     structure DstOp = MidOps
14 :     structure P=Printer
15 :     structure T=TransformEin
16 :     structure MidToS=MidToString
17 : cchiw 3166 structure DstV = DstIL.Var
18 : cchiw 2845 in
19 :    
20 : cchiw 3166 val testinitial=0
21 : cchiw 3259 val testing=0
22 : cchiw 2845 fun testp n=(case testing
23 :     of 0=> 1
24 :     | _ =>(print(String.concat n);1)
25 :     (*end case*))
26 : cchiw 3166 fun test0 n=(case testinitial
27 : cchiw 3203 of 0=>testp n
28 : cchiw 3166 | _ => (print(String.concat n);1))
29 : cchiw 3260 fun toStringBind e= MidToString.toStringBind e
30 : cchiw 2845
31 : cchiw 3203 fun expandEinOp bind00=let
32 :    
33 : cchiw 3033 val star="************"
34 : cchiw 3260 val _ =test0[star,"\n Original EinApp",star,"\n\n","start get test",toStringBind bind00]
35 : cchiw 3203 val (y,einapp as DstIL.EINAPP(Ein.EIN{params, index, body},args))=bind00
36 : cchiw 3166
37 : cchiw 3033
38 :     (* ************* Sweep for 0's'*********** *)
39 : cchiw 3203 val bodysweep=sweepEin.sweep body
40 : cchiw 3033 val ein1=Ein.EIN{params=params, index=index, body=bodysweep}
41 : cchiw 3203 val _=testp["Post Sweep\n",P.printbody bodysweep,"\n"]
42 : cchiw 3033
43 :    
44 : cchiw 3203 (* ************** distribute and push Summation*********** *)
45 :     val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))
46 : cchiw 3260 val _ =testp["\n\n summation \n\n =>", toStringBind bind3]
47 : cchiw 3033
48 : cchiw 3166 (* **************** split phase ************* *)
49 : cchiw 3203 val (newbies5)= Split.splitEinApp bind3
50 :     val _ =testp["\n\n Returning \n\n =>",
51 : cchiw 3260 String.concatWith",\n\t"(List.map toStringBind newbies5)]
52 : cchiw 3203
53 :    
54 : cchiw 3166 (* ************** ProbeEIN *********** *)
55 : cchiw 3203 (*val code=List.map (fn e=>ProbeEin.expandEinOp e) (newbies5)*)
56 : cchiw 3033
57 : cchiw 3189 (*gives probeEIN the set. Could split into a sepearate step*)
58 : cchiw 3174 val fieldset= einSet.EinSet.empty
59 :     fun iter([],_)=[]
60 :     | iter(e1::es,fieldset)= let
61 :     val (e2,fieldset) = ProbeEin.expandEinOp(e1,fieldset)
62 :     in [e2]@(iter(es,fieldset))
63 :     end
64 :     val code=iter(newbies5, fieldset)
65 : cchiw 3189 (*val _ =print(String.concat[
66 :     "\n",star,"Number of pieces now: ",Int.toString (List.length(code))])
67 :     *)
68 : cchiw 3033 val flatcode= List.foldr op@ [] code
69 : cchiw 3048 (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)
70 : cchiw 3166
71 : cchiw 3033 in
72 :     List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode
73 :     end
74 :    
75 : cchiw 2845 end; (* local *)
76 :    
77 :     end (* local *)

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