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 4162, Wed Jul 6 07:04:28 2016 UTC revision 4163, Thu Jul 7 09:45:19 2016 UTC
# Line 55  Line 55 
55                    dim = TU.monoDim dim,                    dim = TU.monoDim dim,
56                    shape = TU.monoShape shape                    shape = TU.monoShape shape
57                  }                  }
58              | Ty.T_Fun(tys1, ty2) => STy.T_Fun(List.map cvtTy tys1, cvtTy ty2)              | Ty.T_Fun(tys1, ty2) => raise Fail "unexpected T_Fun in Simplify"
59              | Ty.T_Error => raise Fail "unexpected T_Error in Simplify"              | Ty.T_Error => raise Fail "unexpected T_Error in Simplify"
60            (* end case *))            (* end case *))
61    
# Line 74  Line 74 
74      fun newTemp (ty as STy.T_Image _) = SimpleVar.new ("img", SimpleVar.LocalVar, ty)      fun newTemp (ty as STy.T_Image _) = SimpleVar.new ("img", SimpleVar.LocalVar, ty)
75        | newTemp ty = SimpleVar.new ("_t", SimpleVar.LocalVar, ty)        | newTemp ty = SimpleVar.new ("_t", SimpleVar.LocalVar, ty)
76    
77      (* a property to map AST function variables to SimpleAST functions *)
78        local
79          fun cvt x = let
80                val Ty.T_Fun(paramTys, resTy) = Var.monoTypeOf x
81                in
82                  SimpleFunc.new (Var.nameOf x, cvtTy resTy, List.map cvtTy paramTys)
83                end
84        in
85        val {getFn = cvtFunc, ...} = Var.newProp cvt
86        end
87    
88    (* a property to map AST variables to SimpleAST variables *)    (* a property to map AST variables to SimpleAST variables *)
89      local      local
90        fun cvt x = SimpleVar.new (Var.nameOf x, Var.kindOf x, cvtTy(Var.monoTypeOf x))        fun cvt x = SimpleVar.new (Var.nameOf x, Var.kindOf x, cvtTy(Var.monoTypeOf x))
# Line 238  Line 249 
249                    val (stms, xs) = simplifyExpsToVars (errStrm, args, stms)                    val (stms, xs) = simplifyExpsToVars (errStrm, args, stms)
250                    in                    in
251                      case Var.kindOf f                      case Var.kindOf f
252                       of Var.FunVar => (stms, S.E_Apply(cvtVar f, xs, cvtTy ty))                       of Var.FunVar => (stms, S.E_Apply(SimpleFunc.use(cvtFunc f), xs))
253                        | _ => raise Fail "bogus application"                        | _ => raise Fail "bogus application"
254                      (* end case *)                      (* end case *)
255                    end                    end
# Line 479  Line 490 
490                    (* end case *)                    (* end case *)
491                  end                  end
492              | simplifyGlobalDcl (AST.D_Func(f, params, body)) = let              | simplifyGlobalDcl (AST.D_Func(f, params, body)) = let
493                  val f' = cvtVar f                  val f' = cvtFunc f
494                  val params' = cvtVars params                  val params' = cvtVars params
495                  val body' = simplifyAndPruneBlock errStrm body                  val body' = simplifyAndPruneBlock errStrm body
496                  in                  in

Legend:
Removed from v.4162  
changed lines
  Added in v.4163

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