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

SCM Repository

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

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

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

revision 2837, Wed Nov 19 23:42:17 2014 UTC revision 2838, Tue Nov 25 03:40:24 2014 UTC
# Line 22  Line 22 
22      structure DstOp = MidOps      structure DstOp = MidOps
23      structure Probe = ProbeEin      structure Probe = ProbeEin
24      structure P     = Printer      structure P     = Printer
     structure shift = ShiftEin  
     structure split = SplitEin  
25      structure E=Ein      structure E=Ein
26      structure mk=mkOperators      structure mk=mkOperators
27         structure X=checkEin
28     structure Var = MidIL.Var
29     structure HVar = HighIL.Var
30     structure split =Split
31       structure cleanP=cleanParams
32     structure test=testcases
33     datatype peanut=    O of  SrcOp.rator | E of Ein.ein |Nope     datatype peanut=    O of  SrcOp.rator | E of Ein.ein |Nope
34    
35      val testing =1      val testing =1
# Line 155  Line 158 
158    
159                        val s = Kernel.support h                        val s = Kernel.support h
160                        val dim=ImageInfo.dim  v                        val dim=ImageInfo.dim  v
161                            val _ =print("\n Inside<"^Int.toString dim)
162                        val(_,x,code)=Probe.WorldToImagespace(dim,v,pos,img)                        val(_,x,code)=Probe.WorldToImagespace(dim,v,pos,img)
163                         val _ =print">\n"
164    
165    
166                      in code@[                      in code@[
167                          (result, DstIL.OP(DstOp.Inside(v, s), [x, img]))                          (result, DstIL.OP(DstOp.Inside(v, s), [x, img]))
# Line 209  Line 215 
215                | SrcOp.Clamp ty => assign (DstOp.Clamp(cvtTy ty))                | SrcOp.Clamp ty => assign (DstOp.Clamp(cvtTy ty))
216                | SrcOp.Lerp ty => assign (DstOp.Lerp(cvtTy ty))                | SrcOp.Lerp ty => assign (DstOp.Lerp(cvtTy ty))
217                | SrcOp.Sqrt=>assign DstOp.Sqrt                | SrcOp.Sqrt=>assign DstOp.Sqrt
218                  | SrcOp.Normalize ty=> assign (DstOp.Normalize(arity ty))
219                | SrcOp.PrincipleEvec ty => assign (DstOp.PrincipleEvec(cvtTy ty))                | SrcOp.PrincipleEvec ty => assign (DstOp.PrincipleEvec(cvtTy ty))
220    
221                | SrcOp.Zero ty => assign (DstOp.Zero(cvtTy ty))                | SrcOp.Zero ty => assign (DstOp.Zero(cvtTy ty))
# Line 224  Line 230 
230                | SrcOp.CeilToInt => cvtToInt (DstOp.Ceiling 1)                | SrcOp.CeilToInt => cvtToInt (DstOp.Ceiling 1)
231                | SrcOp.FloorToInt => cvtToInt (DstOp.Floor 1)                | SrcOp.FloorToInt => cvtToInt (DstOp.Floor 1)
232                | SrcOp.Kernel h => assign (DstOp.Kernel h)                | SrcOp.Kernel h => assign (DstOp.Kernel h)
233                | SrcOp.LoadImage info =>                | SrcOp.LoadImage info =>  assign (DstOp.LoadImage info)
234                      (*[(y, DstIL.OP(DstOp.LoadImage info, []))]*)                | SrcOp.Inside _ =>(case args
                     (*Hard coded change here, cleared arguements*)  
                     assign (DstOp.LoadImage info)  
               | SrcOp.Inside _ => let  
                     val _ =List.map (fn e=>print(SrcIL.Var.name e)) args  
                      in (*raise Fail("bogus operator " ^ SrcOp.toString rator) end*)  
   
                 (case args  
235                     of [pos, fld] => expandInside(env, y, pos, fld)                     of [pos, fld] => expandInside(env, y, pos, fld)
236                    (* end case *))                    (* end case *))
                 end  
237              (* fields are used in the Inside and Probe operations, but are otherwise ignored *)              (* fields are used in the Inside and Probe operations, but are otherwise ignored *)
238                | SrcOp.Input(ty, s, desc) => assign (DstOp.Input(cvtTy ty, s, desc))                | SrcOp.Input(ty, s, desc) => assign (DstOp.Input(cvtTy ty, s, desc))
239                | SrcOp.InputWithDefault(ty, s, desc) =>                | SrcOp.InputWithDefault(ty, s, desc) =>
# Line 246  Line 244 
244  handle ex => (print(concat["error converting ", SrcOp.toString rator, "\n"]); raise ex)  handle ex => (print(concat["error converting ", SrcOp.toString rator, "\n"]); raise ex)
245    
246    
247  (*Expand then split *)  
248  fun setEinAp e=let      val star="\n***************************************************************\n"
249      val (y,rator,args)=e      fun flat xs = List.foldr op@ [] xs
250      val _ = testp["\n \t \t ",split.printA e]      fun iterProbe(y3,einapp3)=let
251            val expcode= Probe.expandEinOp(y3,einapp3)
252      in      in
253          (y, DstIL.EINAPP(rator,  args))              expcode
254      end      end
255    
256    
257    fun expandEinOp (env, y, rator, args) = let    fun expandEinOp (env, y, rator, args) = let
258      val einargs=Env.renameList(env, args)      val einargs=Env.renameList(env, args)
259            val einapp=(y,DstIL.EINAPP(rator,einargs))
260            val (einapp2,newbies)= split.gettest(einapp)
261            val code=List.map (fn e=>iterProbe e) (newbies@[einapp2])
262            val _ = testp[star]
263            (*val _=test.test()*)
264            in
265                flat code
266            end
267    
     val _ = testp[ "\n ----------------------------------------------- \n  New One \n",    split.printAA(y,rator,args)," \n"]  
     val ((rator',args'),expcode)= Probe.expandEinOp(rator,args,einargs)  
   
     val _ = testp["\n Before Split--\n",split.printA(y,rator',args'),"\n"]  
     val (change,newbie)=split.splitein(y,rator',args')  
   
     in (case (change,newbie)  
         of (0,[(_,e,a)]) => let  
             val _ =testp["\n No Splits \n  ",split.printA(y,e,a)]  
             in  expcode@[(y, DstIL.EINAPP(e,  a))] end  
         | _=>  expcode@(List.map setEinAp newbie)  
         (*end case*))  
268    
     end  
269    
270    (* expand a SrcIL assignment to a list of DstIL assignments *)    (* expand a SrcIL assignment to a list of DstIL assignments *)
271      fun expand (env, (y, rhs)) = let      fun expand (env, (y, rhs)) = let

Legend:
Removed from v.2837  
changed lines
  Added in v.2838

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