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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/simplify/simplify.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/simplify/simplify.sml

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

revision 3444, Fri Nov 20 01:11:12 2015 UTC revision 3445, Fri Nov 20 15:47:57 2015 UTC
# Line 16  Line 16 
16    
17      structure TU = TypeUtil      structure TU = TypeUtil
18      structure S = Simple      structure S = Simple
19        structure STy = SimpleTypes
20        structure Ty = Types
21      structure VMap = Var.Map      structure VMap = Var.Map
22      structure InP = Inputs      structure InP = Inputs
23    
24      val cvtTy = SimpleTypes.simplify    (* convert a Types.ty to a SimpleTypes.ty *)
25        fun cvtTy ty = (case ty
26               of Ty.T_Var(Ty.TV{bind, ...}) => (case !bind
27                     of NONE => raise Fail "unresolved type variable"
28                      | SOME ty => cvtTy ty
29                    (* end case *))
30                | Ty.T_Bool => STy.T_Bool
31                | Ty.T_Int => STy.T_Int
32                | Ty.T_String => STy.T_String
33                | Ty.T_Sequence(ty, NONE) => STy.T_Sequence(cvtTy ty, NONE)
34                | Ty.T_Sequence(ty, dim) => STy.T_Sequence(cvtTy ty, SOME(TU.monoDim dim))
35                | Ty.T_Named id => STy.T_Named id
36                | Ty.T_Kernel n => STy.T_Kernel(TU.monoDiff n)
37                | Ty.T_Tensor shape => STy.T_Tensor(TU.monoShape shape)
38                | Ty.T_Image{dim, shape} => STy.T_Image{
39                      dim = TU.monoDim dim,
40                      shape = TU.monoShape shape
41                    }
42                | Ty.T_Field{diff, dim, shape} => STy.T_Field{
43                      diff = TU.monoDiff diff,
44                      dim = TU.monoDim dim,
45                      shape = TU.monoShape shape
46                    }
47                | Ty.T_Fun(tys1, ty2) => STy.T_Fun(List.map cvtTy tys1, simplify ty2)
48              (* end case *))
49    
50      fun newTemp ty = SimpleVar.new ("_t", SimpleVar.LocalVar, ty)      fun newTemp ty = SimpleVar.new ("_t", SimpleVar.LocalVar, ty)
51    
# Line 54  Line 80 
80      datatype 'a ctl_flow_info      datatype 'a ctl_flow_info
81        = EXIT                    (* stm sequence always exits; no pruning so far *)        = EXIT                    (* stm sequence always exits; no pruning so far *)
82        | PRUNE of 'a             (* stm sequence always exits at last stm in argument, which        | PRUNE of 'a             (* stm sequence always exits at last stm in argument, which
83                                   * is either a block of stm list *)                                   * is either a block or stm list *)
84        | CONT                    (* stm sequence falls through *)        | CONT                    (* stm sequence falls through *)
85        | EDIT of 'a              (* pruned code that has non-exiting paths *)        | EDIT of 'a              (* pruned code that has non-exiting paths *)
86    

Legend:
Removed from v.3444  
changed lines
  Added in v.3445

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