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 196, Mon Aug 2 19:10:49 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        | Inside        | Inside
62        | Field of FieldDef.field_def        | Field of FieldDef.field_def
63          | AddField
64          | ScaleField
65          | NegField
66          | DiffField
67        | Probe        | Probe
68        | Transform of ImageInfo.info        | Transform of ImageInfo.info
69    
# Line 82  Line 97 
97        | arity RoundToInt = 1        | arity RoundToInt = 1
98        | arity CeilToInt = 1        | arity CeilToInt = 1
99        | arity FloorToInt = 1        | arity FloorToInt = 1
100          | arity (Kernel _) = 0
101        | arity (LoadImage _) = 1        | arity (LoadImage _) = 1
102        | arity Inside = 2        | arity Inside = 2
103        | arity (Field _) = 0        | arity (Field _) = 0
104          | arity AddField = 2
105          | arity ScaleField = 2
106          | arity NegField = 1
107          | arity DiffField = 1
108        | arity Probe = 2        | arity Probe = 2
109        | arity (Transform _) = 1        | arity (Transform _) = 1
110    
# Line 118  Line 138 
138        | same (RoundToInt, RoundToInt) = true        | same (RoundToInt, RoundToInt) = true
139        | same (CeilToInt, CeilToInt) = true        | same (CeilToInt, CeilToInt) = true
140        | same (FloorToInt, FloorToInt) = true        | same (FloorToInt, FloorToInt) = true
141          | same (Kernel a, Kernel b) = Kernel.same(a, b)
142        | same (LoadImage a, LoadImage b) = ImageInfo.same(a, b)        | same (LoadImage a, LoadImage b) = ImageInfo.same(a, b)
143        | same (Inside, Inside) = true        | same (Inside, Inside) = true
144        | same (Field a, Field b) = FieldDef.same(a, b)        | same (Field a, Field b) = FieldDef.same(a, b)
145          | same (AddField, AddField) = true
146          | same (ScaleField, ScaleField) = true
147          | same (NegField, NegField) = true
148          | same (DiffField, DiffField) = true
149        | same (Probe, Probe) = true        | same (Probe, Probe) = true
150        | same (Transform a, Transform b) = ImageInfo.same(a, b)        | same (Transform a, Transform b) = ImageInfo.same(a, b)
151        | same _ = false        | same _ = false
# Line 155  Line 180 
180        | hash RoundToInt = 0w109        | hash RoundToInt = 0w109
181        | hash CeilToInt = 0w113        | hash CeilToInt = 0w113
182        | hash FloorToInt = 0w127        | hash FloorToInt = 0w127
183        | hash (LoadImage a) = 0w131 + ImageInfo.hash a        | hash (Kernel a) = 0w131 + Kernel.hash a
184        | hash Inside = 0w137        | hash (LoadImage a) = 0w137 + ImageInfo.hash a
185        | hash (Field a) = 0w139 + FieldDef.hash a        | hash Inside = 0w139
186        | hash Probe = 0w149        | hash (Field a) = 0w149 + FieldDef.hash a
187        | hash (Transform a) = 0w151 + ImageInfo.hash a        | hash AddField = 0w151
188          | hash ScaleField = 0w157
189          | hash NegField = 0w163
190          | hash DiffField = 0w167
191          | hash Probe = 0w173
192          | hash (Transform a) = 0w179 + ImageInfo.hash a
193    
194      fun toString (Add a) = concat["Add(", tyToString a, ")"]      fun toString (Add a) = concat["Add(", tyToString a, ")"]
195        | toString (Sub a) = concat["Sub(", tyToString a, ")"]        | toString (Sub a) = concat["Sub(", tyToString a, ")"]
# Line 191  Line 221 
221        | toString RoundToInt = "RoundToInt"        | toString RoundToInt = "RoundToInt"
222        | toString CeilToInt = "CeilToInt"        | toString CeilToInt = "CeilToInt"
223        | toString FloorToInt = "FloorToInt"        | toString FloorToInt = "FloorToInt"
224          | toString (Kernel a) = concat["Kernel(", Kernel.toString a, ")"]
225        | toString (LoadImage a) = concat["LoadImage(", ImageInfo.toString a, ")"]        | toString (LoadImage a) = concat["LoadImage(", ImageInfo.toString a, ")"]
226        | toString Inside = "Inside"        | toString Inside = "Inside"
227        | toString (Field a) = concat["Field(", FieldDef.toString a, ")"]        | toString (Field a) = concat["Field(", FieldDef.toString a, ")"]
228          | toString AddField = "AddField"
229          | toString ScaleField = "ScaleField"
230          | toString NegField = "NegField"
231          | toString DiffField = "DiffField"
232        | toString Probe = "Probe"        | toString Probe = "Probe"
233        | toString (Transform a) = concat["Transform(", ImageInfo.toString a, ")"]        | toString (Transform a) = concat["Transform(", ImageInfo.toString a, ")"]
234    
235    end    end
236    
237  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.196

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