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/high-to-mid.sml
ViewVC logotype

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

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

revision 393, Thu Oct 14 15:45:01 2010 UTC revision 394, Thu Oct 14 16:30:29 2010 UTC
# Line 22  Line 22 
22    
23      type var_env = DstIL.var VTbl.hash_table      type var_env = DstIL.var VTbl.hash_table
24    
25        fun cvtTy SrcTy.BoolTy = DstTy.BoolTy
26          | cvtTy SrcTy.StringTy = DstTy.StringTy
27          | cvtTy SrcTy.IntTy = DstTy.intTy
28          | cvtTy (SrcTy.TensorTy[]) = DstTy.realTy
29          | cvtTy (SrcTy.TensorTy[d]) = DstTy.VecTy d
30          | cvtTy _ = raise Fail "unexpected higher-order tensor type"
31    
32      fun rename (env : var_env, x) = (case VTbl.find env x      fun rename (env : var_env, x) = (case VTbl.find env x
33             of SOME x' => x'             of SOME x' => x'
34              | NONE => let              | NONE => let
35                  val x' = DstIL.Var.new (SrcIL.Var.name x)                  val x' = DstIL.Var.new (SrcIL.Var.name x, cvtTy(SrcIL.Var.ty x))
36                  in                  in
37                    VTbl.insert env (x, x');                    VTbl.insert env (x, x');
38                    x'                    x'
# Line 41  Line 48 
48                    | _ => raise Fail "bogus field binding"                    | _ => raise Fail "bogus field binding"
49                  (* end case *))                  (* end case *))
50            fun expand (FieldDef.CONV(_, img, _)) = let            fun expand (FieldDef.CONV(_, img, _)) = let
51                  val imgPos = DstIL.Var.new "x"                  val imgPos = DstIL.Var.new ("x", DstTy.VecTy(ImageInfo.dim img))
52                  in [                  in [
53                    (imgPos, DstIL.OP(DstOp.Transform img, [pos])),                    (imgPos, DstIL.OP(DstOp.Transform img, [pos])),
54                    (result, DstIL.OP(DstOp.Inside img, [imgPos]))                    (result, DstIL.OP(DstOp.Inside img, [imgPos]))
# Line 62  Line 69 
69              Probe.expand (result, fld, pos)              Probe.expand (result, fld, pos)
70            end            end
71    
     fun cvtTy SrcTy.BoolTy = DstTy.BoolTy  
       | cvtTy SrcTy.StringTy = DstTy.StringTy  
       | cvtTy SrcTy.IntTy = DstTy.intTy  
       | cvtTy (SrcTy.TensorTy[]) = DstTy.realTy  
       | cvtTy (SrcTy.TensorTy[d]) = DstTy.VecTy d  
       | cvtTy _ = raise Fail "unexpected higher-order tensor type"  
   
72      fun arity (SrcTy.TensorTy[]) = 1      fun arity (SrcTy.TensorTy[]) = 1
73        | arity (SrcTy.TensorTy[d]) = d        | arity (SrcTy.TensorTy[d]) = d
74        | arity _ = raise Fail "arity"        | arity _ = raise Fail "arity"

Legend:
Removed from v.393  
changed lines
  Added in v.394

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