SCM Repository
Annotation of /trunk/src/compiler/high-il/high-il-types.sml
Parent Directory
|
Revision Log
Revision 403 - (view) (download)
1 : | jhr | 393 | (* high-il-types.sml |
2 : | * | ||
3 : | * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) | ||
4 : | * All rights reserved. | ||
5 : | *) | ||
6 : | |||
7 : | structure HighILTypes = | ||
8 : | struct | ||
9 : | |||
10 : | jhr | 394 | datatype ty |
11 : | = BoolTy | StringTy | IntTy | ||
12 : | | TensorTy of int list | ||
13 : | | KernelTy | ImageTy | FieldTy | ||
14 : | jhr | 393 | |
15 : | jhr | 403 | val realTy = TensorTy[] |
16 : | val vec3Ty = TensorTy[3] | ||
17 : | |||
18 : | jhr | 393 | fun same (ty1 : ty, ty2) = (ty1 = ty2) |
19 : | |||
20 : | fun hash BoolTy = 0w1 | ||
21 : | | hash StringTy = 0w2 | ||
22 : | | hash IntTy = 0w3 | ||
23 : | | hash (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd | ||
24 : | jhr | 395 | | hash KernelTy = 0w5 |
25 : | | hash ImageTy = 0w6 | ||
26 : | | hash FieldTy = 0w7 | ||
27 : | jhr | 393 | |
28 : | fun toString BoolTy = "bool" | ||
29 : | | toString StringTy = "string" | ||
30 : | | toString IntTy = "int" | ||
31 : | | toString (TensorTy[]) = "real" | ||
32 : | | toString (TensorTy dd) = String.concat[ | ||
33 : | "tensor[", String.concatWith "," (List.map Int.toString dd), "]" | ||
34 : | ] | ||
35 : | jhr | 395 | | toString KernelTy = "kernel" |
36 : | | toString ImageTy = "image" | ||
37 : | | toString FieldTy = "field" | ||
38 : | jhr | 393 | |
39 : | end |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |