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

SCM Repository

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

Diff of /branches/charisee/src/compiler/high-il/normalize.sml

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

revision 2524, Fri Jan 17 20:17:12 2014 UTC revision 2525, Tue Jan 21 19:14:22 2014 UTC
# Line 23  Line 23 
23      structure App=App      structure App=App
24    
25    
   
26  (********** Counters for statistics **********)  (********** Counters for statistics **********)
27      val cntInsideScale          = ST.newCounter "high-opt:inside-scale"      val cntInsideScale          = ST.newCounter "high-opt:inside-scale"
28      val cntInsideOffset         = ST.newCounter "high-opt:inside-offset"      val cntInsideOffset         = ST.newCounter "high-opt:inside-offset"
# Line 76  Line 75 
75    
76  fun isEin x = (case V.binding x  fun isEin x = (case V.binding x
77          of IL.VB_RHS(IL.EINAPP (e,arg))=>SOME(IL.EINAPP (e,arg))          of IL.VB_RHS(IL.EINAPP (e,arg))=>SOME(IL.EINAPP (e,arg))
78            | IL.VB_RHS(IL.VAR x') => isEin x'
79          |_=>NONE          |_=>NONE
80      (* end case *))      (* end case *))
81    
# Line 108  Line 108 
108      end)      end)
109    
110    
111    fun printX(IL.ASSGN (x, IL.OP(opss,args)))= let
112    
113    val a= print(String.concat(["\n",V.toString  x,"==",Op.toString opss," : "]))
114    in print (String.concatWith "," (List.map V.toString args)) end
115    | printX(IL.ASSGN(x,IL.LIT _))= print(String.concat["\n :",V.toString  x,"==...Lit"])
116    | printX(IL.ASSGN(x,IL.CONS (_, varl)))= let
117    val y= List.map (fn e1=> V.toString e1) varl
118    in print(String.concat[ "\n",(V.toString  x),"==",(String.concatWith "," y)]) end
119    | printX(IL.ASSGN (x, _))=print(String.concat["\n",V.toString  x,"==","CONS"])
120    
121    
122    
123  fun check params _=1  fun check params _=1
124    
125  fun doRHS (lhs, IL.EINAPP (ein, args))=(let  fun doRHS (lhs, IL.EINAPP (ein, args))=(let
126      val x= print (String.concat[" ---Current: ", P.printerE(ein)])      val x= print (String.concat[V.toString  lhs,"=="," ---Current: ", P.printerE(ein)])
127        val g= print (String.concatWith "," (List.map V.toString args))
128    
129      fun rewrite(0,_,_, [], _)= (print "No Subst ";NONE)      fun rewrite(0,_,_, [], _)= (print "No Subst ";NONE)
130          | rewrite(_,orig,_, [], done)= let          | rewrite(_,orig,_, [], done)= let
# Line 133  Line 144 
144                  val g=print(String.concat["checking argument:", Int.toString(place), "number of params",Int.toString(length(params)),"\n"])                  val g=print(String.concat["checking argument:", Int.toString(place), "number of params",Int.toString(length(params)),"\n"])
145                  val t=List.nth(params, place)                  val t=List.nth(params, place)
146                  in (case t                  in (case t
147                      of Ein.TEN 0=> (rewrite(change,orig, place+1, es, done@[e]))                      of Ein.TEN(0,_)=> (rewrite(change,orig, place+1, es, done@[e]))
148                      | _=> let                      | _=> let
149                          val m= print(String.concat["\n Apply at ", Int.toString(place),":--",P.printerE(e2),                          val m= print(String.concat["\n Apply at ", Int.toString(place),":--",P.printerE(e2),
150                          "\n"])                          "\n"])

Legend:
Removed from v.2524  
changed lines
  Added in v.2525

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