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

SCM Repository

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

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

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

revision 1115, Thu May 5 04:42:18 2011 UTC revision 1116, Thu May 5 04:49:02 2011 UTC
# Line 17  Line 17 
17      val hashty = HighILTypes.hash      val hashty = HighILTypes.hash
18      val tyToString = HighILTypes.toString      val tyToString = HighILTypes.toString
19    
20      (* required helper functions for the int type *)
21        fun sameint (i1 : int, i2) = (i1 = i2)
22        fun hashint i = Word.fromInt i
23        fun intToString i = Int.toString i
24    
25    (* required helper functions for the string type *)    (* required helper functions for the string type *)
26      fun samestring (s1 : string, s2) = (s1 = s2)      fun samestring (s1 : string, s2) = (s1 = s2)
27      val hashstring = HashString.hashString      val hashstring = HashString.hashString
# Line 37  Line 42 
42        | Mul of ty        | Mul of ty
43        | Div of ty        | Div of ty
44        | Neg of ty        | Neg of ty
45          | Abs of ty
46        | LT of ty        | LT of ty
47        | LTE of ty        | LTE of ty
48        | EQ of ty        | EQ of ty
49        | NEQ of ty        | NEQ of ty
50        | GT of ty        | GT of ty
51        | GTE of ty        | GTE of ty
52          | Power
53          | Not
54        | Max        | Max
55        | Min        | Min
56        | Sin        | Lerp of ty
       | Cos  
       | Pow  
       | Not  
57        | Dot of ty        | Dot of ty
58          | MulVecMat of ty
59          | MulMatVec of ty
60          | MulMatMat of ty * ty
61        | Cross        | Cross
62          | Outer of ty
63        | Norm of ty        | Norm of ty
64          | Normalize of ty
65        | Scale of ty        | Scale of ty
       | InvScale of ty  
66        | CL        | CL
67        | PrincipleEvec of ty        | PrincipleEvec of ty
68          | Identity of int
69          | Zero of ty
70          | Trace of ty
71        | Slice of ty * mask        | Slice of ty * mask
72        | Subscript of ty        | Subscript of ty
73        | IntToReal        | IntToReal
# Line 63  Line 75 
75        | RoundToInt        | RoundToInt
76        | CeilToInt        | CeilToInt
77        | FloorToInt        | FloorToInt
78        | Kernel of Kernel.kernel        | Kernel of Kernel.kernel * int
79        | LoadImage of ImageInfo.info        | LoadImage of ImageInfo.info
80        | Convolve        | Inside of int
81        | Inside of ty        | Field of int
82        | Field of FieldDef.field_def        | Probe of ty * ty
83        | AddField        | AddField
84          | SubField
85        | ScaleField        | ScaleField
86        | NegField        | NegField
87        | DiffField        | DiffField
       | Probe of ty * ty  
88        | Input of ty * string        | Input of ty * string
89        | InputWithDefault of ty * string        | InputWithDefault of ty * string
90    
# Line 81  Line 93 
93        | arity (Mul _) = 2        | arity (Mul _) = 2
94        | arity (Div _) = 2        | arity (Div _) = 2
95        | arity (Neg _) = 1        | arity (Neg _) = 1
96          | arity (Abs _) = 1
97        | arity (LT _) = 2        | arity (LT _) = 2
98        | arity (LTE _) = 2        | arity (LTE _) = 2
99        | arity (EQ _) = 2        | arity (EQ _) = 2
100        | arity (NEQ _) = 2        | arity (NEQ _) = 2
101        | arity (GT _) = 2        | arity (GT _) = 2
102        | arity (GTE _) = 2        | arity (GTE _) = 2
103          | arity Power = 2
104          | arity Not = 1
105        | arity Max = 2        | arity Max = 2
106        | arity Min = 2        | arity Min = 2
107        | arity Sin = 1        | arity (Lerp _) = 3
       | arity Cos = 1  
       | arity Pow = 2  
       | arity Not = 1  
108        | arity (Dot _) = 2        | arity (Dot _) = 2
109          | arity (MulVecMat _) = 2
110          | arity (MulMatVec _) = 2
111          | arity (MulMatMat _) = 2
112        | arity Cross = 2        | arity Cross = 2
113          | arity (Outer _) = 2
114        | arity (Norm _) = 1        | arity (Norm _) = 1
115          | arity (Normalize _) = 1
116        | arity (Scale _) = 2        | arity (Scale _) = 2
       | arity (InvScale _) = 2  
117        | arity CL = 1        | arity CL = 1
118        | arity (PrincipleEvec _) = 2        | arity (PrincipleEvec _) = 2
119          | arity (Identity _) = 0
120          | arity (Zero _) = 0
121          | arity (Trace _) = 1
122        | arity (Slice _) = 1        | arity (Slice _) = 1
123        | arity (Subscript _) = ~1        | arity (Subscript _) = ~1
124        | arity IntToReal = 1        | arity IntToReal = 1
# Line 108  Line 127 
127        | arity CeilToInt = 1        | arity CeilToInt = 1
128        | arity FloorToInt = 1        | arity FloorToInt = 1
129        | arity (Kernel _) = 0        | arity (Kernel _) = 0
130        | arity (LoadImage _) = 0        | arity (LoadImage _) = 1
       | arity Convolve = 2  
131        | arity (Inside _) = 2        | arity (Inside _) = 2
132        | arity (Field _) = 0        | arity (Field _) = 2
133          | arity (Probe _) = 2
134        | arity AddField = 2        | arity AddField = 2
135          | arity SubField = 2
136        | arity ScaleField = 2        | arity ScaleField = 2
137        | arity NegField = 1        | arity NegField = 1
138        | arity DiffField = 1        | arity DiffField = 1
       | arity (Probe _) = 2  
139        | arity (Input _) = 0        | arity (Input _) = 0
140        | arity (InputWithDefault _) = 1        | arity (InputWithDefault _) = 1
141    
# Line 125  Line 144 
144        | same (Mul(a0), Mul(b0)) = samety(a0, b0)        | same (Mul(a0), Mul(b0)) = samety(a0, b0)
145        | same (Div(a0), Div(b0)) = samety(a0, b0)        | same (Div(a0), Div(b0)) = samety(a0, b0)
146        | same (Neg(a0), Neg(b0)) = samety(a0, b0)        | same (Neg(a0), Neg(b0)) = samety(a0, b0)
147          | same (Abs(a0), Abs(b0)) = samety(a0, b0)
148        | same (LT(a0), LT(b0)) = samety(a0, b0)        | same (LT(a0), LT(b0)) = samety(a0, b0)
149        | same (LTE(a0), LTE(b0)) = samety(a0, b0)        | same (LTE(a0), LTE(b0)) = samety(a0, b0)
150        | same (EQ(a0), EQ(b0)) = samety(a0, b0)        | same (EQ(a0), EQ(b0)) = samety(a0, b0)
151        | same (NEQ(a0), NEQ(b0)) = samety(a0, b0)        | same (NEQ(a0), NEQ(b0)) = samety(a0, b0)
152        | same (GT(a0), GT(b0)) = samety(a0, b0)        | same (GT(a0), GT(b0)) = samety(a0, b0)
153        | same (GTE(a0), GTE(b0)) = samety(a0, b0)        | same (GTE(a0), GTE(b0)) = samety(a0, b0)
154          | same (Power, Power) = true
155          | same (Not, Not) = true
156        | same (Max, Max) = true        | same (Max, Max) = true
157        | same (Min, Min) = true        | same (Min, Min) = true
158        | same (Sin, Sin) = true        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
       | same (Cos, Cos) = true  
       | same (Pow, Pow) = true  
       | same (Not, Not) = true  
159        | same (Dot(a0), Dot(b0)) = samety(a0, b0)        | same (Dot(a0), Dot(b0)) = samety(a0, b0)
160          | same (MulVecMat(a0), MulVecMat(b0)) = samety(a0, b0)
161          | same (MulMatVec(a0), MulMatVec(b0)) = samety(a0, b0)
162          | same (MulMatMat(a0,a1), MulMatMat(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)
163        | same (Cross, Cross) = true        | same (Cross, Cross) = true
164          | same (Outer(a0), Outer(b0)) = samety(a0, b0)
165        | same (Norm(a0), Norm(b0)) = samety(a0, b0)        | same (Norm(a0), Norm(b0)) = samety(a0, b0)
166          | same (Normalize(a0), Normalize(b0)) = samety(a0, b0)
167        | same (Scale(a0), Scale(b0)) = samety(a0, b0)        | same (Scale(a0), Scale(b0)) = samety(a0, b0)
       | same (InvScale(a0), InvScale(b0)) = samety(a0, b0)  
168        | same (CL, CL) = true        | same (CL, CL) = true
169        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)
170          | same (Identity(a0), Identity(b0)) = sameint(a0, b0)
171          | same (Zero(a0), Zero(b0)) = samety(a0, b0)
172          | same (Trace(a0), Trace(b0)) = samety(a0, b0)
173        | same (Slice(a0,a1), Slice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1)        | same (Slice(a0,a1), Slice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1)
174        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
175        | same (IntToReal, IntToReal) = true        | same (IntToReal, IntToReal) = true
# Line 151  Line 177 
177        | same (RoundToInt, RoundToInt) = true        | same (RoundToInt, RoundToInt) = true
178        | same (CeilToInt, CeilToInt) = true        | same (CeilToInt, CeilToInt) = true
179        | same (FloorToInt, FloorToInt) = true        | same (FloorToInt, FloorToInt) = true
180        | same (Kernel(a0), Kernel(b0)) = Kernel.same(a0, b0)        | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)
181        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
182        | same (Convolve, Convolve) = true        | same (Inside(a0), Inside(b0)) = sameint(a0, b0)
183        | same (Inside(a0), Inside(b0)) = samety(a0, b0)        | same (Field(a0), Field(b0)) = sameint(a0, b0)
184        | same (Field(a0), Field(b0)) = FieldDef.same(a0, b0)        | same (Probe(a0,a1), Probe(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)
185        | same (AddField, AddField) = true        | same (AddField, AddField) = true
186          | same (SubField, SubField) = true
187        | same (ScaleField, ScaleField) = true        | same (ScaleField, ScaleField) = true
188        | same (NegField, NegField) = true        | same (NegField, NegField) = true
189        | same (DiffField, DiffField) = true        | same (DiffField, DiffField) = true
       | same (Probe(a0,a1), Probe(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)  
190        | same (Input(a0,a1), Input(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (Input(a0,a1), Input(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
191        | same (InputWithDefault(a0,a1), InputWithDefault(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (InputWithDefault(a0,a1), InputWithDefault(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
192        | same _ = false        | same _ = false
# Line 170  Line 196 
196        | hash (Mul(a0)) = 0w7 + hashty a0        | hash (Mul(a0)) = 0w7 + hashty a0
197        | hash (Div(a0)) = 0w11 + hashty a0        | hash (Div(a0)) = 0w11 + hashty a0
198        | hash (Neg(a0)) = 0w13 + hashty a0        | hash (Neg(a0)) = 0w13 + hashty a0
199        | hash (LT(a0)) = 0w17 + hashty a0        | hash (Abs(a0)) = 0w17 + hashty a0
200        | hash (LTE(a0)) = 0w19 + hashty a0        | hash (LT(a0)) = 0w19 + hashty a0
201        | hash (EQ(a0)) = 0w23 + hashty a0        | hash (LTE(a0)) = 0w23 + hashty a0
202        | hash (NEQ(a0)) = 0w29 + hashty a0        | hash (EQ(a0)) = 0w29 + hashty a0
203        | hash (GT(a0)) = 0w31 + hashty a0        | hash (NEQ(a0)) = 0w31 + hashty a0
204        | hash (GTE(a0)) = 0w37 + hashty a0        | hash (GT(a0)) = 0w37 + hashty a0
205        | hash Max = 0w41        | hash (GTE(a0)) = 0w41 + hashty a0
206        | hash Min = 0w43        | hash Power = 0w43
207        | hash Sin = 0w47        | hash Not = 0w47
208        | hash Cos = 0w53        | hash Max = 0w53
209        | hash Pow = 0w59        | hash Min = 0w59
210        | hash Not = 0w61        | hash (Lerp(a0)) = 0w61 + hashty a0
211        | hash (Dot(a0)) = 0w67 + hashty a0        | hash (Dot(a0)) = 0w67 + hashty a0
212        | hash Cross = 0w71        | hash (MulVecMat(a0)) = 0w71 + hashty a0
213        | hash (Norm(a0)) = 0w73 + hashty a0        | hash (MulMatVec(a0)) = 0w73 + hashty a0
214        | hash (Scale(a0)) = 0w79 + hashty a0        | hash (MulMatMat(a0,a1)) = 0w79 + hashty a0 + hashty a1
215        | hash (InvScale(a0)) = 0w83 + hashty a0        | hash Cross = 0w83
216        | hash CL = 0w89        | hash (Outer(a0)) = 0w89 + hashty a0
217        | hash (PrincipleEvec(a0)) = 0w97 + hashty a0        | hash (Norm(a0)) = 0w97 + hashty a0
218        | hash (Slice(a0,a1)) = 0w101 + hashty a0 + hashmask a1        | hash (Normalize(a0)) = 0w101 + hashty a0
219        | hash (Subscript(a0)) = 0w103 + hashty a0        | hash (Scale(a0)) = 0w103 + hashty a0
220        | hash IntToReal = 0w107        | hash CL = 0w107
221        | hash TruncToInt = 0w109        | hash (PrincipleEvec(a0)) = 0w109 + hashty a0
222        | hash RoundToInt = 0w113        | hash (Identity(a0)) = 0w113 + hashint a0
223        | hash CeilToInt = 0w127        | hash (Zero(a0)) = 0w127 + hashty a0
224        | hash FloorToInt = 0w131        | hash (Trace(a0)) = 0w131 + hashty a0
225        | hash (Kernel(a0)) = 0w137 + Kernel.hash a0        | hash (Slice(a0,a1)) = 0w137 + hashty a0 + hashmask a1
226        | hash (LoadImage(a0)) = 0w139 + ImageInfo.hash a0        | hash (Subscript(a0)) = 0w139 + hashty a0
227        | hash Convolve = 0w149        | hash IntToReal = 0w149
228        | hash (Inside(a0)) = 0w151 + hashty a0        | hash TruncToInt = 0w151
229        | hash (Field(a0)) = 0w157 + FieldDef.hash a0        | hash RoundToInt = 0w157
230        | hash AddField = 0w163        | hash CeilToInt = 0w163
231        | hash ScaleField = 0w167        | hash FloorToInt = 0w167
232        | hash NegField = 0w173        | hash (Kernel(a0,a1)) = 0w173 + Kernel.hash a0 + hashint a1
233        | hash DiffField = 0w179        | hash (LoadImage(a0)) = 0w179 + ImageInfo.hash a0
234        | hash (Probe(a0,a1)) = 0w181 + hashty a0 + hashty a1        | hash (Inside(a0)) = 0w181 + hashint a0
235        | hash (Input(a0,a1)) = 0w191 + hashty a0 + hashstring a1        | hash (Field(a0)) = 0w191 + hashint a0
236        | hash (InputWithDefault(a0,a1)) = 0w193 + hashty a0 + hashstring a1        | hash (Probe(a0,a1)) = 0w193 + hashty a0 + hashty a1
237          | hash AddField = 0w197
238          | hash SubField = 0w199
239          | hash ScaleField = 0w211
240          | hash NegField = 0w223
241          | hash DiffField = 0w227
242          | hash (Input(a0,a1)) = 0w229 + hashty a0 + hashstring a1
243          | hash (InputWithDefault(a0,a1)) = 0w233 + hashty a0 + hashstring a1
244    
245      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
246        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
247        | toString (Mul(a0)) = concat["Mul<", tyToString a0, ">"]        | toString (Mul(a0)) = concat["Mul<", tyToString a0, ">"]
248        | toString (Div(a0)) = concat["Div<", tyToString a0, ">"]        | toString (Div(a0)) = concat["Div<", tyToString a0, ">"]
249        | toString (Neg(a0)) = concat["Neg<", tyToString a0, ">"]        | toString (Neg(a0)) = concat["Neg<", tyToString a0, ">"]
250          | toString (Abs(a0)) = concat["Abs<", tyToString a0, ">"]
251        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]
252        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]
253        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]
254        | toString (NEQ(a0)) = concat["NEQ<", tyToString a0, ">"]        | toString (NEQ(a0)) = concat["NEQ<", tyToString a0, ">"]
255        | toString (GT(a0)) = concat["GT<", tyToString a0, ">"]        | toString (GT(a0)) = concat["GT<", tyToString a0, ">"]
256        | toString (GTE(a0)) = concat["GTE<", tyToString a0, ">"]        | toString (GTE(a0)) = concat["GTE<", tyToString a0, ">"]
257          | toString Power = "Power"
258          | toString Not = "Not"
259        | toString Max = "Max"        | toString Max = "Max"
260        | toString Min = "Min"        | toString Min = "Min"
261        | toString Sin = "Sin"        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
       | toString Cos = "Cos"  
       | toString Pow = "Pow"  
       | toString Not = "Not"  
262        | toString (Dot(a0)) = concat["Dot<", tyToString a0, ">"]        | toString (Dot(a0)) = concat["Dot<", tyToString a0, ">"]
263          | toString (MulVecMat(a0)) = concat["MulVecMat<", tyToString a0, ">"]
264          | toString (MulMatVec(a0)) = concat["MulMatVec<", tyToString a0, ">"]
265          | toString (MulMatMat(a0,a1)) = concat["MulMatMat<", tyToString a0, ",", tyToString a1, ">"]
266        | toString Cross = "Cross"        | toString Cross = "Cross"
267          | toString (Outer(a0)) = concat["Outer<", tyToString a0, ">"]
268        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]
269          | toString (Normalize(a0)) = concat["Normalize<", tyToString a0, ">"]
270        | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"]        | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"]
       | toString (InvScale(a0)) = concat["InvScale<", tyToString a0, ">"]  
271        | toString CL = "CL"        | toString CL = "CL"
272        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]
273          | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]
274          | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
275          | toString (Trace(a0)) = concat["Trace<", tyToString a0, ">"]
276        | toString (Slice(a0,a1)) = concat["Slice<", tyToString a0, ",", maskToString a1, ">"]        | toString (Slice(a0,a1)) = concat["Slice<", tyToString a0, ",", maskToString a1, ">"]
277        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
278        | toString IntToReal = "IntToReal"        | toString IntToReal = "IntToReal"
# Line 240  Line 280 
280        | toString RoundToInt = "RoundToInt"        | toString RoundToInt = "RoundToInt"
281        | toString CeilToInt = "CeilToInt"        | toString CeilToInt = "CeilToInt"
282        | toString FloorToInt = "FloorToInt"        | toString FloorToInt = "FloorToInt"
283        | toString (Kernel(a0)) = concat["Kernel<", Kernel.toString a0, ">"]        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
284        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
285        | toString Convolve = "Convolve"        | toString (Inside(a0)) = concat["Inside<", intToString a0, ">"]
286        | toString (Inside(a0)) = concat["Inside<", tyToString a0, ">"]        | toString (Field(a0)) = concat["Field<", intToString a0, ">"]
287        | toString (Field(a0)) = concat["Field<", FieldDef.toString a0, ">"]        | toString (Probe(a0,a1)) = concat["Probe<", tyToString a0, ",", tyToString a1, ">"]
288        | toString AddField = "AddField"        | toString AddField = "AddField"
289          | toString SubField = "SubField"
290        | toString ScaleField = "ScaleField"        | toString ScaleField = "ScaleField"
291        | toString NegField = "NegField"        | toString NegField = "NegField"
292        | toString DiffField = "DiffField"        | toString DiffField = "DiffField"
       | toString (Probe(a0,a1)) = concat["Probe<", tyToString a0, ",", tyToString a1, ">"]  
293        | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"]        | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"]
294        | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"]        | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"]
295    
# Line 258  Line 298 
298  structure HighIL = SSAFn(  structure HighIL = SSAFn(
299    structure Ty = HighILTypes    structure Ty = HighILTypes
300    structure Op = HighOps)    structure Op = HighOps)
301    
302    structure HighILCensus = CensusFn(HighIL)
303    

Legend:
Removed from v.1115  
changed lines
  Added in v.1116

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