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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml

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

revision 1521, Mon Oct 10 14:19:33 2011 UTC revision 1522, Mon Oct 10 15:34:37 2011 UTC
# Line 32  Line 32 
32    (* translate TreeIL types to shadow types *)    (* translate TreeIL types to shadow types *)
33      fun shadowTy ty = (case ty      fun shadowTy ty = (case ty
34             of Ty.BoolTy => CL.T_Named "cl_bool"             of Ty.BoolTy => CL.T_Named "cl_bool"
35              | Ty.StringTy => raise Fail "unexpected string type"              | Ty.IntTy => CL.T_Named(RN.shadowIntTy ())
             | Ty.IVecTy 1 => CL.T_Named(RN.shadowIntTy ())  
             | Ty.IVecTy n => raise Fail "unexpected int vector type"  
36              | Ty.TensorTy[] => CL.T_Named(RN.shadowRealTy ())              | Ty.TensorTy[] => CL.T_Named(RN.shadowRealTy ())
37              | Ty.TensorTy[n] => CL.T_Named(RN.shadowVecTy n)              | Ty.TensorTy[n] => CL.T_Named(RN.shadowVecTy n)
38              | Ty.TensorTy[n, m] => CL.T_Named(RN.shadowMatTy(n,m))              | Ty.TensorTy[n, m] => CL.T_Named(RN.shadowMatTy(n,m))
# Line 47  Line 45 
45   *)   *)
46     (* translate TreeIL types to shadow types *)     (* translate TreeIL types to shadow types *)
47      fun convertToShadow (ty, name) = (case ty      fun convertToShadow (ty, name) = (case ty
48             of Ty.IVecTy 1 => CL.mkAssign(             of Ty.IntTy => CL.mkAssign(
49                  CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, name),                  CL.mkSelect(CL.mkVar RN.shadowGlaobalsName, name),
50                  CL.mkIndirect(CL.mkVar RN.globalsVarName, name))                  CL.mkIndirect(CL.mkVar RN.globalsVarName, name))
51              | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n, [              | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n, [
# Line 70  Line 68 
68    
69     (* generate code to convert strand TreeIL types to shadow types *)     (* generate code to convert strand TreeIL types to shadow types *)
70      fun convertStrandToShadow (ty, name, selfIn, selfOut) = (case ty      fun convertStrandToShadow (ty, name, selfIn, selfOut) = (case ty
71             of Ty.IVecTy 1 => CL.mkAssign(             of Ty.IntTy => CL.mkAssign(
72                  CL.mkIndirect(CL.mkVar selfIn, name),                  CL.mkIndirect(CL.mkVar selfIn, name),
73                  CL.mkIndirect(CL.mkVar selfOut, name))                  CL.mkIndirect(CL.mkVar selfOut, name))
74              | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n, [              | Ty.TensorTy[n]=> CL.mkCall(RN.convertToShadowVec n, [
# Line 422  Line 420 
420                      val (ty, x) = output                      val (ty, x) = output
421                      val outState = CL.mkIndirect(CL.mkVar "self", x)                      val outState = CL.mkIndirect(CL.mkVar "self", x)
422                      val prArgs = (case ty                      val prArgs = (case ty
423                             of Ty.IVecTy 1 => [CL.mkStr(!N.gIntFormat ^ "\n"), outState]                             of Ty.IntTy => [CL.mkStr(!N.gIntFormat ^ "\n"), outState]
424                              | Ty.IVecTy d => let                              | Ty.SeqTy(Ty.IntTy, d) => let
425                                  fun sel i = CL.mkApply(                                  fun sel i = CL.mkApply(
426                                            "VSUB",                                            "VSUB",
427                                            [outState, CL.mkInt(IntInf.fromInt i)])                                            [outState, CL.mkInt(IntInf.fromInt i)])

Legend:
Removed from v.1521  
changed lines
  Added in v.1522

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