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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/tree-ir/tree-types.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/tree-ir/tree-types.sml

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

revision 3860, Sat May 14 18:05:08 2016 UTC revision 3861, Sun May 15 14:33:03 2016 UTC
# Line 41  Line 41 
41      fun iVecTy 1 = IntTy      fun iVecTy 1 = IntTy
42        | iVecTy n = SeqTy(IntTy, SOME n)        | iVecTy n = SeqTy(IntTy, SOME n)
43    
44        fun layoutToString {wid, padded, pieces} = "<layout>"
45    
46    (* return the vector types that comprise the pieces of a vec_layout *)    (* return the vector types that comprise the pieces of a vec_layout *)
47      fun piecesOf ({wid, pieces, ...} : vec_layout) = let      fun piecesOf (layout : vec_layout) = let
48            fun toVecs (_, []) = raise Fail "no pieces"            fun toVecs (_, []) = raise Fail(concat["piecesOf(", layoutToString layout, ")"])
49              | toVecs (wid, [w]) = [VecTy(wid, w)]              | toVecs (wid, [w]) = [VecTy(wid, w)]
50              | toVecs (wid, w::ws) = VecTy(w, w) :: toVecs(wid-w, ws)              | toVecs (wid, w::ws) = VecTy(w, w) :: toVecs(wid-w, ws)
51            in            in
52              toVecs (wid, pieces)              toVecs (#wid layout, #pieces layout)
53              end
54    
55      (* return the n'th component of a vector layout as a vector type. *)
56        fun nthVec (layout : vec_layout, n) = let
57              fun get (_, _, []) =
58                    raise Fail(concat["nthVec(", layoutToString layout, ", ", Int.toString n, ")"])
59                | get (0, wid, w::_) = VecTy(wid, w)
60                | get (n, wid, w::ws) = get (n-1, wid-w, ws)
61              in
62                get (n, #wid layout, #pieces layout)
63            end            end
64    
65    (* is a vector padded? *)    (* is a vector padded? *)

Legend:
Removed from v.3860  
changed lines
  Added in v.3861

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