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

SCM Repository

[diderot] Diff of /branches/staging/src/compiler/mid-il/mid-il.sml
ViewVC logotype

Diff of /branches/staging/src/compiler/mid-il/mid-il.sml

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

revision 287, Fri Aug 13 21:40:04 2010 UTC revision 392, Thu Oct 14 15:34:28 2010 UTC
# Line 11  Line 11 
11  structure MidOps =  structure MidOps =
12    struct    struct
13    
14      datatype ty = BoolTy | StringTy | IntTy | VecTy of int      type ty = MidILTypes.ty
15    
16      fun samety (ty1 : ty, ty2) = (ty1 = ty2)      val samety = MidILTypes.same
17      fun hashty BoolTy = 0w1      val hashty = MidILTypes.hash
18        | hashty StringTy = 0w2      val tyToString = MidILTypes.toString
19        | hashty IntTy = 0w3  
20        | hashty (VecTy d) = Word.fromInt d + 0w4      fun sameint (i1 : int, i2) = (i1 = i2)
21      fun tyToString BoolTy = "bool"      fun hashint i = Word.fromInt i
22        | tyToString StringTy = "string"      fun intToString i = Int.toString i
       | tyToString IntTy = "int"  
       | tyToString (VecTy 0) = "real"  
       | tyToString (VecTy d) = "vec" ^ Int.toString d  
23    
24      fun samestring (s1 : string, s2) = (s1 = s2)      fun samestring (s1 : string, s2) = (s1 = s2)
25      val hashstring = HashString.hashString      val hashstring = HashString.hashString
# Line 40  Line 37 
37        | NEQ of ty        | NEQ of ty
38        | GT of ty        | GT of ty
39        | GTE of ty        | GTE of ty
40        | Dot of ty        | Not
       | Cross  
       | Select of int  
       | Norm of ty  
       | Scale of ty  
       | InvScale of ty  
       | CL  
       | PrincipleEvec of ty  
       | Subscript of ty  
41        | Max        | Max
42        | Min        | Min
43        | Sin        | Sin
44        | Cos        | Cos
45        | Pow        | Pow
46        | Not        | Dot of int
47          | Cross
48          | Select of int * int
49          | Norm of int
50          | Scale of int
51          | InvScale of int
52          | CL
53          | PrincipleEvec of ty
54          | Subscript of ty
55          | Floor of int
56        | IntToReal        | IntToReal
57        | TruncToInt        | TruncToInt of int
58        | RoundToInt        | RoundToInt of int
59        | CeilToInt        | CeilToInt of int
60        | FloorToInt        | FloorToInt of int
61        | VoxelAddress of ImageInfo.info        | VoxelAddress of ImageInfo.info
62        | LoadVoxels of RawTypes.ty * int        | LoadVoxels of RawTypes.ty * int
63        | Transform of ImageInfo.info        | Transform of ImageInfo.info
64        | Kernel of Kernel.kernel        | EvalKernel of int * Kernel.kernel * int
       | DiffKernel of int  
       | EvalKernel  
65        | LoadImage of ImageInfo.info        | LoadImage of ImageInfo.info
66        | Inside        | Inside of ImageInfo.info
67        | Input of string        | Input of string
68        | InputWithDefault of string        | InputWithDefault of string
69    
# Line 82  Line 78 
78        | arity (NEQ _) = 2        | arity (NEQ _) = 2
79        | arity (GT _) = 2        | arity (GT _) = 2
80        | arity (GTE _) = 2        | arity (GTE _) = 2
81          | arity Not = 1
82          | arity Max = 2
83          | arity Min = 2
84          | arity Sin = 1
85          | arity Cos = 1
86          | arity Pow = 2
87        | arity (Dot _) = 2        | arity (Dot _) = 2
88        | arity Cross = 2        | arity Cross = 2
89        | arity (Select _) = 1        | arity (Select _) = 1
# Line 91  Line 93 
93        | arity CL = 1        | arity CL = 1
94        | arity (PrincipleEvec _) = 2        | arity (PrincipleEvec _) = 2
95        | arity (Subscript _) = 2        | arity (Subscript _) = 2
96        | arity Max = 2        | arity (Floor _) = 1
       | arity Min = 2  
       | arity Sin = 1  
       | arity Cos = 1  
       | arity Pow = 2  
       | arity Not = 1  
97        | arity IntToReal = 1        | arity IntToReal = 1
98        | arity TruncToInt = 1        | arity (TruncToInt _) = 1
99        | arity RoundToInt = 1        | arity (RoundToInt _) = 1
100        | arity CeilToInt = 1        | arity (CeilToInt _) = 1
101        | arity FloorToInt = 1        | arity (FloorToInt _) = 1
102        | arity (VoxelAddress _) = ~1        | arity (VoxelAddress _) = ~1
103        | arity (LoadVoxels _) = 1        | arity (LoadVoxels _) = 1
104        | arity (Transform _) = 1        | arity (Transform _) = 1
105        | arity (Kernel _) = 0        | arity (EvalKernel _) = 1
       | arity (DiffKernel _) = 1  
       | arity EvalKernel = 2  
106        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
107        | arity Inside = 2        | arity (Inside _) = 1
108        | arity (Input _) = 0        | arity (Input _) = 0
109        | arity (InputWithDefault _) = 1        | arity (InputWithDefault _) = 1
110    
# Line 124  Line 119 
119        | same (NEQ(a0), NEQ(b0)) = samety(a0, b0)        | same (NEQ(a0), NEQ(b0)) = samety(a0, b0)
120        | same (GT(a0), GT(b0)) = samety(a0, b0)        | same (GT(a0), GT(b0)) = samety(a0, b0)
121        | same (GTE(a0), GTE(b0)) = samety(a0, b0)        | same (GTE(a0), GTE(b0)) = samety(a0, b0)
122        | same (Dot(a0), Dot(b0)) = samety(a0, b0)        | same (Not, Not) = true
       | same (Cross, Cross) = true  
       | same (Select(a0), Select(b0)) = sameint(a0, b0)  
       | same (Norm(a0), Norm(b0)) = samety(a0, b0)  
       | same (Scale(a0), Scale(b0)) = samety(a0, b0)  
       | same (InvScale(a0), InvScale(b0)) = samety(a0, b0)  
       | same (CL, CL) = true  
       | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)  
       | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)  
123        | same (Max, Max) = true        | same (Max, Max) = true
124        | same (Min, Min) = true        | same (Min, Min) = true
125        | same (Sin, Sin) = true        | same (Sin, Sin) = true
126        | same (Cos, Cos) = true        | same (Cos, Cos) = true
127        | same (Pow, Pow) = true        | same (Pow, Pow) = true
128        | same (Not, Not) = true        | same (Dot(a0), Dot(b0)) = sameint(a0, b0)
129          | same (Cross, Cross) = true
130          | same (Select(a0,a1), Select(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
131          | same (Norm(a0), Norm(b0)) = sameint(a0, b0)
132          | same (Scale(a0), Scale(b0)) = sameint(a0, b0)
133          | same (InvScale(a0), InvScale(b0)) = sameint(a0, b0)
134          | same (CL, CL) = true
135          | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)
136          | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
137          | same (Floor(a0), Floor(b0)) = sameint(a0, b0)
138        | same (IntToReal, IntToReal) = true        | same (IntToReal, IntToReal) = true
139        | same (TruncToInt, TruncToInt) = true        | same (TruncToInt(a0), TruncToInt(b0)) = sameint(a0, b0)
140        | same (RoundToInt, RoundToInt) = true        | same (RoundToInt(a0), RoundToInt(b0)) = sameint(a0, b0)
141        | same (CeilToInt, CeilToInt) = true        | same (CeilToInt(a0), CeilToInt(b0)) = sameint(a0, b0)
142        | same (FloorToInt, FloorToInt) = true        | same (FloorToInt(a0), FloorToInt(b0)) = sameint(a0, b0)
143        | same (VoxelAddress(a0), VoxelAddress(b0)) = ImageInfo.same(a0, b0)        | same (VoxelAddress(a0), VoxelAddress(b0)) = ImageInfo.same(a0, b0)
144        | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = RawTypes.same(a0, b0) andalso sameint(a1, b1)        | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = RawTypes.same(a0, b0) andalso sameint(a1, b1)
145        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
146        | same (Kernel(a0), Kernel(b0)) = Kernel.same(a0, b0)        | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)
       | same (DiffKernel(a0), DiffKernel(b0)) = sameint(a0, b0)  
       | same (EvalKernel, EvalKernel) = true  
147        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
148        | same (Inside, Inside) = true        | same (Inside(a0), Inside(b0)) = ImageInfo.same(a0, b0)
149        | same (Input(a0), Input(b0)) = samestring(a0, b0)        | same (Input(a0), Input(b0)) = samestring(a0, b0)
150        | same (InputWithDefault(a0), InputWithDefault(b0)) = samestring(a0, b0)        | same (InputWithDefault(a0), InputWithDefault(b0)) = samestring(a0, b0)
151        | same _ = false        | same _ = false
# Line 167  Line 161 
161        | hash (NEQ(a0)) = 0w29 + hashty a0        | hash (NEQ(a0)) = 0w29 + hashty a0
162        | hash (GT(a0)) = 0w31 + hashty a0        | hash (GT(a0)) = 0w31 + hashty a0
163        | hash (GTE(a0)) = 0w37 + hashty a0        | hash (GTE(a0)) = 0w37 + hashty a0
164        | hash (Dot(a0)) = 0w41 + hashty a0        | hash Not = 0w41
165        | hash Cross = 0w43        | hash Max = 0w43
166        | hash (Select(a0)) = 0w47 + hashint a0        | hash Min = 0w47
167        | hash (Norm(a0)) = 0w53 + hashty a0        | hash Sin = 0w53
168        | hash (Scale(a0)) = 0w59 + hashty a0        | hash Cos = 0w59
169        | hash (InvScale(a0)) = 0w61 + hashty a0        | hash Pow = 0w61
170        | hash CL = 0w67        | hash (Dot(a0)) = 0w67 + hashint a0
171        | hash (PrincipleEvec(a0)) = 0w71 + hashty a0        | hash Cross = 0w71
172        | hash (Subscript(a0)) = 0w73 + hashty a0        | hash (Select(a0,a1)) = 0w73 + hashint a0 + hashint a1
173        | hash Max = 0w79        | hash (Norm(a0)) = 0w79 + hashint a0
174        | hash Min = 0w83        | hash (Scale(a0)) = 0w83 + hashint a0
175        | hash Sin = 0w89        | hash (InvScale(a0)) = 0w89 + hashint a0
176        | hash Cos = 0w97        | hash CL = 0w97
177        | hash Pow = 0w101        | hash (PrincipleEvec(a0)) = 0w101 + hashty a0
178        | hash Not = 0w103        | hash (Subscript(a0)) = 0w103 + hashty a0
179        | hash IntToReal = 0w107        | hash (Floor(a0)) = 0w107 + hashint a0
180        | hash TruncToInt = 0w109        | hash IntToReal = 0w109
181        | hash RoundToInt = 0w113        | hash (TruncToInt(a0)) = 0w113 + hashint a0
182        | hash CeilToInt = 0w127        | hash (RoundToInt(a0)) = 0w127 + hashint a0
183        | hash FloorToInt = 0w131        | hash (CeilToInt(a0)) = 0w131 + hashint a0
184        | hash (VoxelAddress(a0)) = 0w137 + ImageInfo.hash a0        | hash (FloorToInt(a0)) = 0w137 + hashint a0
185        | hash (LoadVoxels(a0,a1)) = 0w139 + RawTypes.hash a0 + hashint a1        | hash (VoxelAddress(a0)) = 0w139 + ImageInfo.hash a0
186        | hash (Transform(a0)) = 0w149 + ImageInfo.hash a0        | hash (LoadVoxels(a0,a1)) = 0w149 + RawTypes.hash a0 + hashint a1
187        | hash (Kernel(a0)) = 0w151 + Kernel.hash a0        | hash (Transform(a0)) = 0w151 + ImageInfo.hash a0
188        | hash (DiffKernel(a0)) = 0w157 + hashint a0        | hash (EvalKernel(a0,a1,a2)) = 0w157 + hashint a0 + Kernel.hash a1 + hashint a2
189        | hash EvalKernel = 0w163        | hash (LoadImage(a0)) = 0w163 + ImageInfo.hash a0
190        | hash (LoadImage(a0)) = 0w167 + ImageInfo.hash a0        | hash (Inside(a0)) = 0w167 + ImageInfo.hash a0
191        | hash Inside = 0w173        | hash (Input(a0)) = 0w173 + hashstring a0
192        | hash (Input(a0)) = 0w179 + hashstring a0        | hash (InputWithDefault(a0)) = 0w179 + hashstring a0
       | hash (InputWithDefault(a0)) = 0w181 + hashstring a0  
193    
194      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
195        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
# Line 209  Line 202 
202        | toString (NEQ(a0)) = concat["NEQ<", tyToString a0, ">"]        | toString (NEQ(a0)) = concat["NEQ<", tyToString a0, ">"]
203        | toString (GT(a0)) = concat["GT<", tyToString a0, ">"]        | toString (GT(a0)) = concat["GT<", tyToString a0, ">"]
204        | toString (GTE(a0)) = concat["GTE<", tyToString a0, ">"]        | toString (GTE(a0)) = concat["GTE<", tyToString a0, ">"]
205        | toString (Dot(a0)) = concat["Dot<", tyToString a0, ">"]        | toString Not = "Not"
       | toString Cross = "Cross"  
       | toString (Select(a0)) = concat["Select<", intToString a0, ">"]  
       | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]  
       | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"]  
       | toString (InvScale(a0)) = concat["InvScale<", tyToString a0, ">"]  
       | toString CL = "CL"  
       | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]  
       | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]  
206        | toString Max = "Max"        | toString Max = "Max"
207        | toString Min = "Min"        | toString Min = "Min"
208        | toString Sin = "Sin"        | toString Sin = "Sin"
209        | toString Cos = "Cos"        | toString Cos = "Cos"
210        | toString Pow = "Pow"        | toString Pow = "Pow"
211        | toString Not = "Not"        | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]
212          | toString Cross = "Cross"
213          | toString (Select(a0,a1)) = concat["Select<", intToString a0, ",", intToString a1, ">"]
214          | toString (Norm(a0)) = concat["Norm<", intToString a0, ">"]
215          | toString (Scale(a0)) = concat["Scale<", intToString a0, ">"]
216          | toString (InvScale(a0)) = concat["InvScale<", intToString a0, ">"]
217          | toString CL = "CL"
218          | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]
219          | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
220          | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]
221        | toString IntToReal = "IntToReal"        | toString IntToReal = "IntToReal"
222        | toString TruncToInt = "TruncToInt"        | toString (TruncToInt(a0)) = concat["TruncToInt<", intToString a0, ">"]
223        | toString RoundToInt = "RoundToInt"        | toString (RoundToInt(a0)) = concat["RoundToInt<", intToString a0, ">"]
224        | toString CeilToInt = "CeilToInt"        | toString (CeilToInt(a0)) = concat["CeilToInt<", intToString a0, ">"]
225        | toString FloorToInt = "FloorToInt"        | toString (FloorToInt(a0)) = concat["FloorToInt<", intToString a0, ">"]
226        | toString (VoxelAddress(a0)) = concat["VoxelAddress<", ImageInfo.toString a0, ">"]        | toString (VoxelAddress(a0)) = concat["VoxelAddress<", ImageInfo.toString a0, ">"]
227        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", RawTypes.toString a0",", intToString a0, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", RawTypes.toString a0, ",", intToString a1, ">"]
228        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
229        | toString (Kernel(a0)) = concat["Kernel<", Kernel.toString a0, ">"]        | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]
       | toString (DiffKernel(a0)) = concat["DiffKernel<", intToString a0, ">"]  
       | toString EvalKernel = "EvalKernel"  
230        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
231        | toString Inside = "Inside"        | toString (Inside(a0)) = concat["Inside<", ImageInfo.toString a0, ">"]
232        | toString (Input(a0)) = concat["Input<", stringToString a0, ">"]        | toString (Input(a0)) = concat["Input<", stringToString a0, ">"]
233        | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"]        | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"]
234    
235    end    end
236    
237  structure MidIL = SSAFn(MidOps)  structure MidIL = SSAFn(
238      structure Ty = MidILTypes
239      structure Op = MidOps)

Legend:
Removed from v.287  
changed lines
  Added in v.392

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