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

SCM Repository

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

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

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

revision 391, Thu Oct 14 13:18:24 2010 UTC revision 435, Tue Oct 19 13:14:20 2010 UTC
# Line 1  Line 1 
1  (* mid-il.sml  (* mid-il.sml
2   *   *
3   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4   * All rights reserved.   * All rights reserved.
5   *   *
6   * Middle-level version of the Diderot IL.   * Middle-level version of the Diderot IL.
# Line 45  Line 45 
45        | Pow        | Pow
46        | Dot of int        | Dot of int
47        | Cross        | Cross
48        | Select of int * int        | Select of ty * int
49        | Norm of int        | Norm of int
50        | Scale of int        | Scale of int
51        | InvScale of int        | InvScale of int
# Line 64  Line 64 
64        | EvalKernel of int * Kernel.kernel * int        | EvalKernel of int * Kernel.kernel * int
65        | LoadImage of ImageInfo.info        | LoadImage of ImageInfo.info
66        | Inside of ImageInfo.info        | Inside of ImageInfo.info
67        | Input of string        | Input of ty * string
68        | InputWithDefault of string        | InputWithDefault of ty * string
69    
70      fun arity (Add _) = 2      fun arity (Add _) = 2
71        | arity (Sub _) = 2        | arity (Sub _) = 2
# Line 127  Line 127 
127        | same (Pow, Pow) = true        | same (Pow, Pow) = true
128        | same (Dot(a0), Dot(b0)) = sameint(a0, b0)        | same (Dot(a0), Dot(b0)) = sameint(a0, b0)
129        | same (Cross, Cross) = true        | same (Cross, Cross) = true
130        | same (Select(a0,a1), Select(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
131        | same (Norm(a0), Norm(b0)) = sameint(a0, b0)        | same (Norm(a0), Norm(b0)) = sameint(a0, b0)
132        | same (Scale(a0), Scale(b0)) = sameint(a0, b0)        | same (Scale(a0), Scale(b0)) = sameint(a0, b0)
133        | same (InvScale(a0), InvScale(b0)) = sameint(a0, b0)        | same (InvScale(a0), InvScale(b0)) = sameint(a0, b0)
# Line 146  Line 146 
146        | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)        | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)
147        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
148        | same (Inside(a0), Inside(b0)) = ImageInfo.same(a0, b0)        | same (Inside(a0), Inside(b0)) = ImageInfo.same(a0, b0)
149        | same (Input(a0), Input(b0)) = samestring(a0, b0)        | same (Input(a0,a1), Input(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
150        | same (InputWithDefault(a0), InputWithDefault(b0)) = samestring(a0, b0)        | same (InputWithDefault(a0,a1), InputWithDefault(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
151        | same _ = false        | same _ = false
152    
153      fun hash (Add(a0)) = 0w3 + hashty a0      fun hash (Add(a0)) = 0w3 + hashty a0
# Line 169  Line 169 
169        | hash Pow = 0w61        | hash Pow = 0w61
170        | hash (Dot(a0)) = 0w67 + hashint a0        | hash (Dot(a0)) = 0w67 + hashint a0
171        | hash Cross = 0w71        | hash Cross = 0w71
172        | hash (Select(a0,a1)) = 0w73 + hashint a0 + hashint a1        | hash (Select(a0,a1)) = 0w73 + hashty a0 + hashint a1
173        | hash (Norm(a0)) = 0w79 + hashint a0        | hash (Norm(a0)) = 0w79 + hashint a0
174        | hash (Scale(a0)) = 0w83 + hashint a0        | hash (Scale(a0)) = 0w83 + hashint a0
175        | hash (InvScale(a0)) = 0w89 + hashint a0        | hash (InvScale(a0)) = 0w89 + hashint a0
# Line 188  Line 188 
188        | hash (EvalKernel(a0,a1,a2)) = 0w157 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (EvalKernel(a0,a1,a2)) = 0w157 + hashint a0 + Kernel.hash a1 + hashint a2
189        | hash (LoadImage(a0)) = 0w163 + ImageInfo.hash a0        | hash (LoadImage(a0)) = 0w163 + ImageInfo.hash a0
190        | hash (Inside(a0)) = 0w167 + ImageInfo.hash a0        | hash (Inside(a0)) = 0w167 + ImageInfo.hash a0
191        | hash (Input(a0)) = 0w173 + hashstring a0        | hash (Input(a0,a1)) = 0w173 + hashty a0 + hashstring a1
192        | hash (InputWithDefault(a0)) = 0w179 + hashstring a0        | hash (InputWithDefault(a0,a1)) = 0w179 + hashty a0 + hashstring a1
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 210  Line 210 
210        | toString Pow = "Pow"        | toString Pow = "Pow"
211        | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]        | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]
212        | toString Cross = "Cross"        | toString Cross = "Cross"
213        | toString (Select(a0,a1)) = concat["Select<", intToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
214        | toString (Norm(a0)) = concat["Norm<", intToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", intToString a0, ">"]
215        | toString (Scale(a0)) = concat["Scale<", intToString a0, ">"]        | toString (Scale(a0)) = concat["Scale<", intToString a0, ">"]
216        | toString (InvScale(a0)) = concat["InvScale<", intToString a0, ">"]        | toString (InvScale(a0)) = concat["InvScale<", intToString a0, ">"]
# Line 229  Line 229 
229        | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]        | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]
230        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
231        | toString (Inside(a0)) = concat["Inside<", ImageInfo.toString a0, ">"]        | toString (Inside(a0)) = concat["Inside<", ImageInfo.toString a0, ">"]
232        | toString (Input(a0)) = concat["Input<", stringToString a0, ">"]        | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"]
233        | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"]        | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"]
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.391  
changed lines
  Added in v.435

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