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

SCM Repository

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

Diff of /branches/vis15/src/compiler/high-opt/normalize.sml

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

revision 4138, Fri Jul 1 14:46:08 2016 UTC revision 4220, Sat Jul 16 16:07:04 2016 UTC
# Line 55  Line 55 
55    * Orders EIN, normalizes it, then cleans the summation    * Orders EIN, normalizes it, then cleans the summation
56    *)    *)
57      fun doNormalize e' = let      fun doNormalize e' = let
58  val _ =print(String.concat["\n\n\n do normalize:", EinPP.toString(e')])  (* DEBUG val _ =print(String.concat["\n\n\n do normalize:", EinPP.toString(e')]) *)
59            val ordered = Reorder.transform e'            val ordered = Reorder.transform e'
60            in            val rtn = case NormalizeEin.transform ordered
             case NormalizeEin.transform ordered  
61               of NONE => ordered               of NONE => ordered
62  | SOME e => (print(String.concat["\n transform :=>", EinPP.toString(e)]) ; EinSums.clean e)                | SOME e => EinSums.clean e
63              (* end case *)              (* end case *)
64    (* DEBUG  val _ =print(String.concat["\n post sum normalize:", EinPP.toString(rtn)]) *)
65              in
66                rtn
67            end            end
68    
69      fun nameCnt e = String.concat[V.toString e, "(", Int.toString(useCount e), ")"]      fun nameCnt e = String.concat[V.toString e, "(", Int.toString(useCount e), ")"]
# Line 79  Line 81 
81              | _ => let              | _ => let
82                  val rtnArgs = done @ newArgs                  val rtnArgs = done @ newArgs
83                  val (c, subst) = Apply.apply(orig, place, newE)                  val (c, subst) = Apply.apply(orig, place, newE)
84  val _ =print(String.concat["\n\n\n after substition:", EinPP.toString(subst)])                  (* DEBUG  val _ =print(String.concat["\n\n\n after substition:", EinPP.toString(subst)]) *)
85                  in                  in
86                    if c                    if c
87                      then (true, subst, place + length newArgs, rtnArgs)                      then (true, subst, place + length newArgs, rtnArgs)
# Line 99  Line 101 
101     * Keeps track of the place of the argument in substitution.     * Keeps track of the place of the argument in substitution.
102     *)     *)
103      fun doRHS (lhs, IR.EINAPP(ein, args)) = let      fun doRHS (lhs, IR.EINAPP(ein, args)) = let
104  val _ =print(String.concat["\n\n\n doRHS:", EinPP.toString(ein)])            (* DEBUG  val _ =print(String.concat["\n\n\n doRHS:", EinPP.toString(ein)])*)
105            fun rewrite (false, _, _, [], _) = NONE            fun rewrite (false, _, _, [], _) = NONE
106              | rewrite (true, orig, _, [], args') =              | rewrite (true, orig, _, [], args') =
107                  SOME[(lhs, IR.EINAPP(doNormalize orig, args'))]                  SOME[(lhs, IR.EINAPP(doNormalize orig, args'))]
# Line 131  Line 133 
133    
134      val transform = Promote.transform o Rewrite.transform      val transform = Promote.transform o Rewrite.transform
135    
136  (*DEBUG*  (*DEBUG**
137  fun transform prog = let  fun transform prog = let
138        val prog = Rewrite.transform prog        val prog = Rewrite.transform prog
139        val _ = HighPP.output(Log.logFile(), "AFTER REWRITE", prog)        val _ = HighPP.output(Log.logFile(), "AFTER REWRITE", prog)
# Line 140  Line 142 
142        in        in
143          prog          prog
144        end        end
145  *DEBUG*)  **DEBUG*)
146    
147    end    end

Legend:
Removed from v.4138  
changed lines
  Added in v.4220

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