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 4150, Sat Jul 2 14:14:23 2016 UTC revision 4151, Sat Jul 2 17:42:55 2016 UTC
# Line 12  Line 12 
12    struct    struct
13    
14    (* the layout of a vector onto target-supported vectors. *)    (* the layout of a vector onto target-supported vectors. *)
15      type vec_layout = {      type vec_layout = VectorLayout.t
         wid : int,              (* total width of the vector *)  
         padded : bool,          (* true if sum of pieces > wid; pad will be in last piece *)  
         pieces : int list       (* list of pieces; these will all be supported vector widths *)  
       }  
16    
17      datatype t      datatype t
18        = BoolTy | StringTy | IntTy        = BoolTy | StringTy | IntTy
# Line 42  Line 38 
38      fun iVecTy 1 = IntTy      fun iVecTy 1 = IntTy
39        | iVecTy n = SeqTy(IntTy, SOME n)        | iVecTy n = SeqTy(IntTy, SOME n)
40    
     fun layoutToString {wid, padded, pieces} = String.concat [  
             Int.toString wid, "{", String.concatWithMap "," Int.toString pieces, "}"  
           ]  
   
41    (* return the vector types that comprise the pieces of a vec_layout *)    (* return the vector types that comprise the pieces of a vec_layout *)
42      fun piecesOf (layout : vec_layout) = let      fun piecesOf (layout : vec_layout) = let
43            fun toVecs (_, []) = raise Fail(concat["piecesOf(", layoutToString layout, ")"])            fun toVecs (_, []) = raise Fail(concat["piecesOf(", VectorLayout.toString layout, ")"])
44              | toVecs (wid, [w]) = [VecTy(wid, w)]              | toVecs (wid, [w]) = [VecTy(wid, w)]
45              | toVecs (wid, w::ws) = VecTy(w, w) :: toVecs(wid-w, ws)              | toVecs (wid, w::ws) = VecTy(w, w) :: toVecs(wid-w, ws)
46            in            in
# Line 58  Line 50 
50    (* return the unpadded width of the n'th component of a vector layout *)    (* return the unpadded width of the n'th component of a vector layout *)
51      fun nthWidth (layout : vec_layout, n) = let      fun nthWidth (layout : vec_layout, n) = let
52            fun get (_, _, []) =            fun get (_, _, []) =
53                  raise Fail(concat["nthWidth(", layoutToString layout, ", ", Int.toString n, ")"])                  raise Fail(concat["nthWidth(", VectorLayout.toString layout, ", ", Int.toString n, ")"])
54              | get (0, wid, _) = wid              | get (0, wid, _) = wid
55              | get (n, wid, w::ws) = get (n-1, wid-w, ws)              | get (n, wid, w::ws) = get (n-1, wid-w, ws)
56            in            in
# Line 67  Line 59 
59    
60    (* return the n'th component of a vector layout as a vector type. *)    (* return the n'th component of a vector layout as a vector type. *)
61      fun nthVec (layout : vec_layout, n) = let      fun nthVec (layout : vec_layout, n) = let
62            fun get (_, _, []) =            fun get (_, _, []) = raise Fail(concat[
63                  raise Fail(concat["nthVec(", layoutToString layout, ", ", Int.toString n, ")"])                    "nthVec(", VectorLayout.toString layout, ", ", Int.toString n, ")"
64                    ])
65              | get (0, wid, w::_) = VecTy(wid, w)              | get (0, wid, w::_) = VecTy(wid, w)
66              | get (n, wid, w::ws) = get (n-1, wid-w, ws)              | get (n, wid, w::ws) = get (n-1, wid-w, ws)
67            in            in

Legend:
Removed from v.4150  
changed lines
  Added in v.4151

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