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

SCM Repository

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

Diff of /trunk/src/compiler/high-to-mid/test.sml

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

revision 373, Sun Oct 3 15:27:04 2010 UTC revision 374, Sun Oct 3 18:56:32 2010 UTC
# Line 16  Line 16 
16    
17      structure PP = SSAPPFn(DstIL)      structure PP = SSAPPFn(DstIL)
18    
19        local
20          structure VSet = DstIL.Var.Set
21        in
22          fun checkCode (result, code, pos) = let
23                fun checkVar bvs x = if VSet.member(bvs, x)
24                      then ()
25                      else print(concat["variable ", DstIL.Var.toString x, " used before definition\n"])
26                fun chkAssign ((y, rhs), bvs) = (
27                      case rhs
28                       of DstIL.VAR x => checkVar bvs x
29                        | DstIL.LIT _ => ()
30                        | DstIL.OP(_, xs) => List.app (checkVar bvs) xs
31                        | DstIL.CONS xs => List.app (checkVar bvs) xs
32                      (* end case *);
33                      VSet.add (bvs, y))
34                val bvs = List.foldl chkAssign (VSet.singleton pos) code
35                in
36                  checkVar bvs result
37                end
38        end
39    
40      fun expand fld = let      fun expand fld = let
41            val code = Probe.expand (DstIL.Var.new "result", fld, DstIL.Var.new "pos")            val result = DstIL.Var.new "result"
42              val pos = DstIL.Var.new "pos"
43              val code = Probe.expand (result, fld, pos)
44            in            in
45              print(concat["expand (", FD.toString fld, "):\n"]);              print(concat["expand (", FD.toString fld, "):\n"]);
46              List.app (fn s => print("\t" ^ PP.assignToString s ^ "\n")) code              List.app (fn s => print("\t" ^ PP.assignToString s ^ "\n")) code;
47                checkCode (result, code, pos)
48            end            end
49    
50    (* fake 2D image info *)    (* fake 2D image info *)

Legend:
Removed from v.373  
changed lines
  Added in v.374

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