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

SCM Repository

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

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

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

revision 511, Tue Feb 8 17:01:43 2011 UTC revision 1116, Thu May 5 04:49:02 2011 UTC
# Line 30  Line 30 
30        | Mul of ty        | Mul of ty
31        | Div of ty        | Div of ty
32        | Neg of ty        | Neg of ty
33          | Abs of ty
34        | LT of ty        | LT of ty
35        | LTE of ty        | LTE of ty
36        | EQ of ty        | EQ of ty
# Line 39  Line 40 
40        | Not        | Not
41        | Max        | Max
42        | Min        | Min
43        | Sin        | Lerp of ty
       | Cos  
       | Pow  
44        | Dot of int        | Dot of int
45          | MulVecMat of int * int
46          | MulMatVec of int * int
47          | MulMatMat of int * int * int
48        | Cross        | Cross
49        | Select of ty * int        | Select of ty * int
50        | Norm of int        | Norm of ty
51        | Scale of int        | Normalize of int
52        | InvScale of int        | Scale of ty
53        | CL        | CL
54        | PrincipleEvec of ty        | PrincipleEvec of ty
55          | Identity of int
56          | Zero of ty
57          | Trace of int
58        | Subscript of ty        | Subscript of ty
59          | Ceiling of int
60        | Floor of int        | Floor of int
61          | Round of int
62          | Trunc of int
63        | IntToReal        | IntToReal
64        | TruncToInt of int        | RealToInt of int
       | RoundToInt of int  
       | CeilToInt of int  
       | FloorToInt of int  
65        | ImageAddress of ImageInfo.info        | ImageAddress of ImageInfo.info
66        | LoadVoxels of RawTypes.ty * int        | LoadVoxels of ImageInfo.info * int
67        | PosToImgSpace of ImageInfo.info        | PosToImgSpace of ImageInfo.info
68        | GradToWorldSpace of ImageInfo.info        | TensorToWorldSpace of ImageInfo.info * ty
69        | LoadImage of ImageInfo.info        | LoadImage of ImageInfo.info
70        | Inside of ImageInfo.info        | Inside of ImageInfo.info * int
71        | Input of ty * string        | Input of ty * string
72        | InputWithDefault of ty * string        | InputWithDefault of ty * string
73    
# Line 71  Line 76 
76        | arity (Mul _) = 2        | arity (Mul _) = 2
77        | arity (Div _) = 2        | arity (Div _) = 2
78        | arity (Neg _) = 1        | arity (Neg _) = 1
79          | arity (Abs _) = 1
80        | arity (LT _) = 2        | arity (LT _) = 2
81        | arity (LTE _) = 2        | arity (LTE _) = 2
82        | arity (EQ _) = 2        | arity (EQ _) = 2
# Line 80  Line 86 
86        | arity Not = 1        | arity Not = 1
87        | arity Max = 2        | arity Max = 2
88        | arity Min = 2        | arity Min = 2
89        | arity Sin = 1        | arity (Lerp _) = 3
       | arity Cos = 1  
       | arity Pow = 2  
90        | arity (Dot _) = 2        | arity (Dot _) = 2
91          | arity (MulVecMat _) = 2
92          | arity (MulMatVec _) = 2
93          | arity (MulMatMat _) = 2
94        | arity Cross = 2        | arity Cross = 2
95        | arity (Select _) = 1        | arity (Select _) = 1
96        | arity (Norm _) = 1        | arity (Norm _) = 1
97          | arity (Normalize _) = 1
98        | arity (Scale _) = 2        | arity (Scale _) = 2
       | arity (InvScale _) = 2  
99        | arity CL = 1        | arity CL = 1
100        | arity (PrincipleEvec _) = 2        | arity (PrincipleEvec _) = 2
101          | arity (Identity _) = 0
102          | arity (Zero _) = 0
103          | arity (Trace _) = 1
104        | arity (Subscript _) = 2        | arity (Subscript _) = 2
105          | arity (Ceiling _) = 1
106        | arity (Floor _) = 1        | arity (Floor _) = 1
107          | arity (Round _) = 1
108          | arity (Trunc _) = 1
109        | arity IntToReal = 1        | arity IntToReal = 1
110        | arity (TruncToInt _) = 1        | arity (RealToInt _) = 1
111        | arity (RoundToInt _) = 1        | arity (ImageAddress _) = 1
       | arity (CeilToInt _) = 1  
       | arity (FloorToInt _) = 1  
       | arity (ImageAddress _) = 0  
112        | arity (LoadVoxels _) = 1        | arity (LoadVoxels _) = 1
113        | arity (PosToImgSpace _) = 1        | arity (PosToImgSpace _) = 2
114        | arity (GradToWorldSpace _) = 1        | arity (TensorToWorldSpace _) = 2
115        | arity (LoadImage _) = 0        | arity (LoadImage _) = 1
116        | arity (Inside _) = 1        | arity (Inside _) = 2
117        | arity (Input _) = 0        | arity (Input _) = 0
118        | arity (InputWithDefault _) = 1        | arity (InputWithDefault _) = 1
119    
# Line 112  Line 122 
122        | same (Mul(a0), Mul(b0)) = samety(a0, b0)        | same (Mul(a0), Mul(b0)) = samety(a0, b0)
123        | same (Div(a0), Div(b0)) = samety(a0, b0)        | same (Div(a0), Div(b0)) = samety(a0, b0)
124        | same (Neg(a0), Neg(b0)) = samety(a0, b0)        | same (Neg(a0), Neg(b0)) = samety(a0, b0)
125          | same (Abs(a0), Abs(b0)) = samety(a0, b0)
126        | same (LT(a0), LT(b0)) = samety(a0, b0)        | same (LT(a0), LT(b0)) = samety(a0, b0)
127        | same (LTE(a0), LTE(b0)) = samety(a0, b0)        | same (LTE(a0), LTE(b0)) = samety(a0, b0)
128        | same (EQ(a0), EQ(b0)) = samety(a0, b0)        | same (EQ(a0), EQ(b0)) = samety(a0, b0)
# Line 121  Line 132 
132        | same (Not, Not) = true        | same (Not, Not) = true
133        | same (Max, Max) = true        | same (Max, Max) = true
134        | same (Min, Min) = true        | same (Min, Min) = true
135        | same (Sin, Sin) = true        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
       | same (Cos, Cos) = true  
       | same (Pow, Pow) = true  
136        | same (Dot(a0), Dot(b0)) = sameint(a0, b0)        | same (Dot(a0), Dot(b0)) = sameint(a0, b0)
137          | same (MulVecMat(a0,a1), MulVecMat(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
138          | same (MulMatVec(a0,a1), MulMatVec(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
139          | same (MulMatMat(a0,a1,a2), MulMatMat(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)
140        | same (Cross, Cross) = true        | same (Cross, Cross) = true
141        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
142        | same (Norm(a0), Norm(b0)) = sameint(a0, b0)        | same (Norm(a0), Norm(b0)) = samety(a0, b0)
143        | same (Scale(a0), Scale(b0)) = sameint(a0, b0)        | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0)
144        | same (InvScale(a0), InvScale(b0)) = sameint(a0, b0)        | same (Scale(a0), Scale(b0)) = samety(a0, b0)
145        | same (CL, CL) = true        | same (CL, CL) = true
146        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)
147          | same (Identity(a0), Identity(b0)) = sameint(a0, b0)
148          | same (Zero(a0), Zero(b0)) = samety(a0, b0)
149          | same (Trace(a0), Trace(b0)) = sameint(a0, b0)
150        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
151          | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)
152        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)
153          | same (Round(a0), Round(b0)) = sameint(a0, b0)
154          | same (Trunc(a0), Trunc(b0)) = sameint(a0, b0)
155        | same (IntToReal, IntToReal) = true        | same (IntToReal, IntToReal) = true
156        | same (TruncToInt(a0), TruncToInt(b0)) = sameint(a0, b0)        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)
       | same (RoundToInt(a0), RoundToInt(b0)) = sameint(a0, b0)  
       | same (CeilToInt(a0), CeilToInt(b0)) = sameint(a0, b0)  
       | same (FloorToInt(a0), FloorToInt(b0)) = sameint(a0, b0)  
157        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)
158        | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = RawTypes.same(a0, b0) andalso sameint(a1, b1)        | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
159        | same (PosToImgSpace(a0), PosToImgSpace(b0)) = ImageInfo.same(a0, b0)        | same (PosToImgSpace(a0), PosToImgSpace(b0)) = ImageInfo.same(a0, b0)
160        | same (GradToWorldSpace(a0), GradToWorldSpace(b0)) = ImageInfo.same(a0, b0)        | same (TensorToWorldSpace(a0,a1), TensorToWorldSpace(b0,b1)) = ImageInfo.same(a0, b0) andalso samety(a1, b1)
161        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
162        | same (Inside(a0), Inside(b0)) = ImageInfo.same(a0, b0)        | same (Inside(a0,a1), Inside(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
163        | 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)
164        | 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)
165        | same _ = false        | same _ = false
# Line 154  Line 169 
169        | hash (Mul(a0)) = 0w7 + hashty a0        | hash (Mul(a0)) = 0w7 + hashty a0
170        | hash (Div(a0)) = 0w11 + hashty a0        | hash (Div(a0)) = 0w11 + hashty a0
171        | hash (Neg(a0)) = 0w13 + hashty a0        | hash (Neg(a0)) = 0w13 + hashty a0
172        | hash (LT(a0)) = 0w17 + hashty a0        | hash (Abs(a0)) = 0w17 + hashty a0
173        | hash (LTE(a0)) = 0w19 + hashty a0        | hash (LT(a0)) = 0w19 + hashty a0
174        | hash (EQ(a0)) = 0w23 + hashty a0        | hash (LTE(a0)) = 0w23 + hashty a0
175        | hash (NEQ(a0)) = 0w29 + hashty a0        | hash (EQ(a0)) = 0w29 + hashty a0
176        | hash (GT(a0)) = 0w31 + hashty a0        | hash (NEQ(a0)) = 0w31 + hashty a0
177        | hash (GTE(a0)) = 0w37 + hashty a0        | hash (GT(a0)) = 0w37 + hashty a0
178        | hash Not = 0w41        | hash (GTE(a0)) = 0w41 + hashty a0
179        | hash Max = 0w43        | hash Not = 0w43
180        | hash Min = 0w47        | hash Max = 0w47
181        | hash Sin = 0w53        | hash Min = 0w53
182        | hash Cos = 0w59        | hash (Lerp(a0)) = 0w59 + hashty a0
183        | hash Pow = 0w61        | hash (Dot(a0)) = 0w61 + hashint a0
184        | hash (Dot(a0)) = 0w67 + hashint a0        | hash (MulVecMat(a0,a1)) = 0w67 + hashint a0 + hashint a1
185        | hash Cross = 0w71        | hash (MulMatVec(a0,a1)) = 0w71 + hashint a0 + hashint a1
186        | hash (Select(a0,a1)) = 0w73 + hashty a0 + hashint a1        | hash (MulMatMat(a0,a1,a2)) = 0w73 + hashint a0 + hashint a1 + hashint a2
187        | hash (Norm(a0)) = 0w79 + hashint a0        | hash Cross = 0w79
188        | hash (Scale(a0)) = 0w83 + hashint a0        | hash (Select(a0,a1)) = 0w83 + hashty a0 + hashint a1
189        | hash (InvScale(a0)) = 0w89 + hashint a0        | hash (Norm(a0)) = 0w89 + hashty a0
190        | hash CL = 0w97        | hash (Normalize(a0)) = 0w97 + hashint a0
191        | hash (PrincipleEvec(a0)) = 0w101 + hashty a0        | hash (Scale(a0)) = 0w101 + hashty a0
192        | hash (Subscript(a0)) = 0w103 + hashty a0        | hash CL = 0w103
193        | hash (Floor(a0)) = 0w107 + hashint a0        | hash (PrincipleEvec(a0)) = 0w107 + hashty a0
194        | hash IntToReal = 0w109        | hash (Identity(a0)) = 0w109 + hashint a0
195        | hash (TruncToInt(a0)) = 0w113 + hashint a0        | hash (Zero(a0)) = 0w113 + hashty a0
196        | hash (RoundToInt(a0)) = 0w127 + hashint a0        | hash (Trace(a0)) = 0w127 + hashint a0
197        | hash (CeilToInt(a0)) = 0w131 + hashint a0        | hash (Subscript(a0)) = 0w131 + hashty a0
198        | hash (FloorToInt(a0)) = 0w137 + hashint a0        | hash (Ceiling(a0)) = 0w137 + hashint a0
199        | hash (ImageAddress(a0)) = 0w139 + ImageInfo.hash a0        | hash (Floor(a0)) = 0w139 + hashint a0
200        | hash (LoadVoxels(a0,a1)) = 0w149 + RawTypes.hash a0 + hashint a1        | hash (Round(a0)) = 0w149 + hashint a0
201        | hash (PosToImgSpace(a0)) = 0w151 + ImageInfo.hash a0        | hash (Trunc(a0)) = 0w151 + hashint a0
202        | hash (GradToWorldSpace(a0)) = 0w157 + ImageInfo.hash a0        | hash IntToReal = 0w157
203        | hash (LoadImage(a0)) = 0w163 + ImageInfo.hash a0        | hash (RealToInt(a0)) = 0w163 + hashint a0
204        | hash (Inside(a0)) = 0w167 + ImageInfo.hash a0        | hash (ImageAddress(a0)) = 0w167 + ImageInfo.hash a0
205        | hash (Input(a0,a1)) = 0w173 + hashty a0 + hashstring a1        | hash (LoadVoxels(a0,a1)) = 0w173 + ImageInfo.hash a0 + hashint a1
206        | hash (InputWithDefault(a0,a1)) = 0w179 + hashty a0 + hashstring a1        | hash (PosToImgSpace(a0)) = 0w179 + ImageInfo.hash a0
207          | hash (TensorToWorldSpace(a0,a1)) = 0w181 + ImageInfo.hash a0 + hashty a1
208          | hash (LoadImage(a0)) = 0w191 + ImageInfo.hash a0
209          | hash (Inside(a0,a1)) = 0w193 + ImageInfo.hash a0 + hashint a1
210          | hash (Input(a0,a1)) = 0w197 + hashty a0 + hashstring a1
211          | hash (InputWithDefault(a0,a1)) = 0w199 + hashty a0 + hashstring a1
212    
213      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
214        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
215        | toString (Mul(a0)) = concat["Mul<", tyToString a0, ">"]        | toString (Mul(a0)) = concat["Mul<", tyToString a0, ">"]
216        | toString (Div(a0)) = concat["Div<", tyToString a0, ">"]        | toString (Div(a0)) = concat["Div<", tyToString a0, ">"]
217        | toString (Neg(a0)) = concat["Neg<", tyToString a0, ">"]        | toString (Neg(a0)) = concat["Neg<", tyToString a0, ">"]
218          | toString (Abs(a0)) = concat["Abs<", tyToString a0, ">"]
219        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]
220        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]
221        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]
# Line 204  Line 225 
225        | toString Not = "Not"        | toString Not = "Not"
226        | toString Max = "Max"        | toString Max = "Max"
227        | toString Min = "Min"        | toString Min = "Min"
228        | toString Sin = "Sin"        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
       | toString Cos = "Cos"  
       | toString Pow = "Pow"  
229        | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]        | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]
230          | toString (MulVecMat(a0,a1)) = concat["MulVecMat<", intToString a0, ",", intToString a1, ">"]
231          | toString (MulMatVec(a0,a1)) = concat["MulMatVec<", intToString a0, ",", intToString a1, ">"]
232          | toString (MulMatMat(a0,a1,a2)) = concat["MulMatMat<", intToString a0, ",", intToString a1, ",", intToString a2, ">"]
233        | toString Cross = "Cross"        | toString Cross = "Cross"
234        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
235        | toString (Norm(a0)) = concat["Norm<", intToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]
236        | toString (Scale(a0)) = concat["Scale<", intToString a0, ">"]        | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"]
237        | toString (InvScale(a0)) = concat["InvScale<", intToString a0, ">"]        | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"]
238        | toString CL = "CL"        | toString CL = "CL"
239        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]
240          | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]
241          | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
242          | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"]
243        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
244          | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]
245        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]
246          | toString (Round(a0)) = concat["Round<", intToString a0, ">"]
247          | toString (Trunc(a0)) = concat["Trunc<", intToString a0, ">"]
248        | toString IntToReal = "IntToReal"        | toString IntToReal = "IntToReal"
249        | toString (TruncToInt(a0)) = concat["TruncToInt<", intToString a0, ">"]        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]
       | toString (RoundToInt(a0)) = concat["RoundToInt<", intToString a0, ">"]  
       | toString (CeilToInt(a0)) = concat["CeilToInt<", intToString a0, ">"]  
       | toString (FloorToInt(a0)) = concat["FloorToInt<", intToString a0, ">"]  
250        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]
251        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", RawTypes.toString a0, ",", intToString a1, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]
252        | toString (PosToImgSpace(a0)) = concat["PosToImgSpace<", ImageInfo.toString a0, ">"]        | toString (PosToImgSpace(a0)) = concat["PosToImgSpace<", ImageInfo.toString a0, ">"]
253        | toString (GradToWorldSpace(a0)) = concat["GradToWorldSpace<", ImageInfo.toString a0, ">"]        | toString (TensorToWorldSpace(a0,a1)) = concat["TensorToWorldSpace<", ImageInfo.toString a0, ",", tyToString a1, ">"]
254        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
255        | toString (Inside(a0)) = concat["Inside<", ImageInfo.toString a0, ">"]        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]
256        | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"]        | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"]
257        | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"]        | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"]
258    
# Line 236  Line 261 
261  structure LowIL = SSAFn(  structure LowIL = SSAFn(
262    structure Ty = LowILTypes    structure Ty = LowILTypes
263    structure Op = LowOps)    structure Op = LowOps)
264    
265    structure LowILCensus = CensusFn(LowIL)
266    

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

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