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

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/gen/high-il.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/gen/high-il.sml

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

revision 186, Thu Jul 29 04:26:57 2010 UTC revision 197, Mon Aug 2 20:51:47 2010 UTC
# Line 11  Line 11 
11  structure HighOps =  structure HighOps =
12    struct    struct
13    
14      type ty = BoolTy | StringTy | IntTy | TensorTy of int list      datatype ty = BoolTy | StringTy | IntTy | TensorTy of int list
15    
16      fun sameTy (ty1 : ty, ty2) = (ty1 = ty2)      fun samety (ty1 : ty, ty2) = (ty1 = ty2)
17        fun hashty BoolTy = 0w1
18          | hashty StringTy = 0w2
19          | hashty IntTy = 0w3
20          | hashty (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd
21        fun tyToString BoolTy = "bool"
22          | tyToString StringTy = "string"
23          | tyToString IntTy = "int"
24          | tyToString (TensorTy dd) = String.concat[
25                "tensor[", String.concatWith "," (List.map Int.toString dd), "]"
26              ]
27    
28      datatype rator      datatype rator
29        = Add of ty        = Add of ty
# Line 46  Line 56 
56        | RoundToInt        | RoundToInt
57        | CeilToInt        | CeilToInt
58        | FloorToInt        | FloorToInt
59          | Kernel of Kernel.kernel
60        | LoadImage of ImageInfo.info        | LoadImage of ImageInfo.info
61          | Convolve
62        | Inside        | Inside
63        | Field of FieldDef.field_def        | Field of FieldDef.field_def
64          | AddField
65          | ScaleField
66          | NegField
67          | DiffField
68        | Probe        | Probe
69        | Transform of ImageInfo.info        | Transform of ImageInfo.info
70    
# Line 82  Line 98 
98        | arity RoundToInt = 1        | arity RoundToInt = 1
99        | arity CeilToInt = 1        | arity CeilToInt = 1
100        | arity FloorToInt = 1        | arity FloorToInt = 1
101          | arity (Kernel _) = 0
102        | arity (LoadImage _) = 1        | arity (LoadImage _) = 1
103          | arity Convolve = 2
104        | arity Inside = 2        | arity Inside = 2
105        | arity (Field _) = 0        | arity (Field _) = 0
106          | arity AddField = 2
107          | arity ScaleField = 2
108          | arity NegField = 1
109          | arity DiffField = 1
110        | arity Probe = 2        | arity Probe = 2
111        | arity (Transform _) = 1        | arity (Transform _) = 1
112    
# Line 118  Line 140 
140        | same (RoundToInt, RoundToInt) = true        | same (RoundToInt, RoundToInt) = true
141        | same (CeilToInt, CeilToInt) = true        | same (CeilToInt, CeilToInt) = true
142        | same (FloorToInt, FloorToInt) = true        | same (FloorToInt, FloorToInt) = true
143          | same (Kernel a, Kernel b) = Kernel.same(a, b)
144        | same (LoadImage a, LoadImage b) = ImageInfo.same(a, b)        | same (LoadImage a, LoadImage b) = ImageInfo.same(a, b)
145          | same (Convolve, Convolve) = true
146        | same (Inside, Inside) = true        | same (Inside, Inside) = true
147        | same (Field a, Field b) = FieldDef.same(a, b)        | same (Field a, Field b) = FieldDef.same(a, b)
148          | same (AddField, AddField) = true
149          | same (ScaleField, ScaleField) = true
150          | same (NegField, NegField) = true
151          | same (DiffField, DiffField) = true
152        | same (Probe, Probe) = true        | same (Probe, Probe) = true
153        | same (Transform a, Transform b) = ImageInfo.same(a, b)        | same (Transform a, Transform b) = ImageInfo.same(a, b)
154        | same _ = false        | same _ = false
# Line 155  Line 183 
183        | hash RoundToInt = 0w109        | hash RoundToInt = 0w109
184        | hash CeilToInt = 0w113        | hash CeilToInt = 0w113
185        | hash FloorToInt = 0w127        | hash FloorToInt = 0w127
186        | hash (LoadImage a) = 0w131 + ImageInfo.hash a        | hash (Kernel a) = 0w131 + Kernel.hash a
187        | hash Inside = 0w137        | hash (LoadImage a) = 0w137 + ImageInfo.hash a
188        | hash (Field a) = 0w139 + FieldDef.hash a        | hash Convolve = 0w139
189        | hash Probe = 0w149        | hash Inside = 0w149
190        | hash (Transform a) = 0w151 + ImageInfo.hash a        | hash (Field a) = 0w151 + FieldDef.hash a
191          | hash AddField = 0w157
192          | hash ScaleField = 0w163
193          | hash NegField = 0w167
194          | hash DiffField = 0w173
195          | hash Probe = 0w179
196          | hash (Transform a) = 0w181 + ImageInfo.hash a
197    
198      fun toString (Add a) = concat["Add(", tyToString a, ")"]      fun toString (Add a) = concat["Add(", tyToString a, ")"]
199        | toString (Sub a) = concat["Sub(", tyToString a, ")"]        | toString (Sub a) = concat["Sub(", tyToString a, ")"]
# Line 191  Line 225 
225        | toString RoundToInt = "RoundToInt"        | toString RoundToInt = "RoundToInt"
226        | toString CeilToInt = "CeilToInt"        | toString CeilToInt = "CeilToInt"
227        | toString FloorToInt = "FloorToInt"        | toString FloorToInt = "FloorToInt"
228          | toString (Kernel a) = concat["Kernel(", Kernel.toString a, ")"]
229        | toString (LoadImage a) = concat["LoadImage(", ImageInfo.toString a, ")"]        | toString (LoadImage a) = concat["LoadImage(", ImageInfo.toString a, ")"]
230          | toString Convolve = "Convolve"
231        | toString Inside = "Inside"        | toString Inside = "Inside"
232        | toString (Field a) = concat["Field(", FieldDef.toString a, ")"]        | toString (Field a) = concat["Field(", FieldDef.toString a, ")"]
233          | toString AddField = "AddField"
234          | toString ScaleField = "ScaleField"
235          | toString NegField = "NegField"
236          | toString DiffField = "DiffField"
237        | toString Probe = "Probe"        | toString Probe = "Probe"
238        | toString (Transform a) = concat["Transform(", ImageInfo.toString a, ")"]        | toString (Transform a) = concat["Transform(", ImageInfo.toString a, ")"]
239    
240    end    end
241    
242  structure HighIL = SSAFn(HighOps)  structure HighIL = SSAFn(HighOps)
  hash (Add a) = 0w587 + hash ty  a  
       | hash (Add a) = 0w593 + hash ty  a  
       | hash (Add a) = 0w599 + hash ty  a  
       | hash (Add a) = 0w601 + hash ty  a  
       | hash (Add a) = 0w607 + hash ty  a  
       | hash (Add a) = 0w613 + hash ty  a  
       | hash (Add a) = 0w617 + hash ty  a  
       | hash (Add a) = 0w619 + hash ty  a  
       | hash (Add a) = 0w631 + hash ty  a  
       | hash (Add a) = 0w641 + hash ty  a  
       | hash (Add a) = 0w643 + hash ty  a  
       | hash (Add a) = 0w647 + hash ty  a  
       | hash (Add a) = 0w653 + hash ty  a  
       | hash (Add a) = 0w659 + hash ty  a  
       | hash (Add a) = 0w661 + hash ty  a  
       | hash (Add a) = 0w673 + hash ty  a  
       | hash (Add a) = 0w677 + hash ty  a  
       | hash (Add a) = 0w683 + hash ty  a  
       | hash (Add a) = 0w691 + hash ty  a  
       | hash (Add a) = 0w701 + hash ty  a  
       | hash (Add a) = 0w709 + hash ty  a  
       | hash (Add a) = 0w719 + hash ty  a  
       | hash (Add a) = 0w727 + hash ty  a  
       | hash (Add a) = 0w733 + hash ty  a  
       | hash (Add a) = 0w739 + hash ty  a  
       | hash (Add a) = 0w743 + hash ty  a  
       | hash (Add a) = 0w751 + hash ty  a  
       | hash (Add a) = 0w757 + hash ty  a  
       | hash (Add a) = 0w761 + hash ty  a  
       | hash (Add a) = 0w769 + hash ty  a  
       | hash (Add a) = 0w773 + hash ty  a  
       | hash (Add a) = 0w787 + hash ty  a  
       | hash (Add a) = 0w797 + hash ty  a  
       | hash (Add a) = 0w809 + hash ty  a  
       | hash (Add a) = 0w811 + hash ty  a  
       | hash (Add a) = 0w821 + hash ty  a  
       | hash (Add a) = 0w823 + hash ty  a  
       | hash (Add a) = 0w827 + hash ty  a  
       | hash (Add a) = 0w829 + hash ty  a  
       | hash (Add a) = 0w839 + hash ty  a  
       | hash (Add a) = 0w853 + hash ty  a  
       | hash (Add a) = 0w857 + hash ty  a  
       | hash (Add a) = 0w859 + hash ty  a  
       | hash (Add a) = 0w863 + hash ty  a  
       | hash (Add a) = 0w877 + hash ty  a  
       | hash (Add a) = 0w881 + hash ty  a  
       | hash (Add a) = 0w883 + hash ty  a  
       | hash (Add a) = 0w887 + hash ty  a  
       | hash (Add a) = 0w907 + hash ty  a  
       | hash (Add a) = 0w911 + hash ty  a  
       | hash (Add a) = 0w919 + hash ty  a  
       | hash (Add a) = 0w929 + hash ty  a  
       | hash (Add a) = 0w937 + hash ty  a  
       | hash (Add a) = 0w941 + hash ty  a  
       | hash (Add a) = 0w947 + hash ty  a  
       | hash (Add a) = 0w953 + hash ty  a  
       | hash (Add a) = 0w967 + hash ty  a  
       | hash (Add a) = 0w971 + hash ty  a  
       | hash (Add a) = 0w977 + hash ty  a  
       | hash (Add a) = 0w983 + hash ty  a  
       | hash (Add a) = 0w991 + hash ty  a  
       | hash (Add a) = 0w997 + hash ty  a  
       | hash (Add a) = 0w1009 + hash ty  a  
       | hash (Add a) = 0w1013 + hash ty  a  
       | hash (Add a) = 0w1019 + hash ty  a  
       | hash (Add a) = 0w1021 + hash ty  a  
       | hash (Add a) = 0w1031 + hash ty  a  
       | hash (Add a) = 0w1033 + hash ty  a  
       | hash (Add a) = 0w1039 + hash ty  a  
       | hash (Add a) = 0w1049 + hash ty  a  
       | hash (Add a) = 0w1051 + hash ty  a  
       | hash (Add a) = 0w1061 + hash ty  a  
       | hash (Add a) = 0w1063 + hash ty  a  
       | hash (Add a) = 0w1069 + hash ty  a  
       | hash (Add a) = 0w1087 + hash ty  a  
       | hash (Add a) = 0w1091 + hash ty  a  
       | hash (Add a) = 0w1093 + hash ty  a  
       | hash (Add a) = 0w1097 + hash ty  a  
       | hash (Add a) = 0w1103 + hash ty  a  
       | hash (Add a) = 0w1109 + hash ty  a  
       | hash (Add a) = 0w1117 + hash ty  a  
       | hash (Add a) = 0w1123 + hash ty  a  
       | hash (Add a) = 0w1129 + hash ty  a  
       | hash (Add a) = 0w1151 + hash ty  a  
       | hash (Add a) = 0w1153 + hash ty  a  
       | hash (Add a) = 0w1163 + hash ty  a  
       | hash (Add a) = 0w1171 + hash ty  a  
       | hash (Add a) = 0w1181 + hash ty  a  
       | hash (Add a) = 0w1187 + hash ty  a  
       | hash (Add a) = 0w1193 + hash ty  a  
       | hash (Add a) = 0w1201 + hash ty  a  
       | hash (Add a) = 0w1213 + hash ty  a  
       | hash (Add a) = 0w1217 + hash ty  a  
       | hash (Add a) = 0w1223 + hash ty  a  
       | hash  

Legend:
Removed from v.186  
changed lines
  Added in v.197

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