SCM Repository
View of /trunk/src/compiler/high-il/high-il.sml
Parent Directory
|
Revision Log
Revision 400 -
(download)
(annotate)
Thu Oct 14 21:06:49 2010 UTC (11 years, 8 months ago) by jhr
File size: 9062 byte(s)
Thu Oct 14 21:06:49 2010 UTC (11 years, 8 months ago) by jhr
File size: 9062 byte(s)
Slice support in HighIL
(* high-il.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * High-level version of the Diderot IL. * * Note: this file is generated from gen/high-il.spec and gen/high-il.in. *) structure HighOps = struct type ty = HighILTypes.ty val samety = HighILTypes.same val hashty = HighILTypes.hash val tyToString = HighILTypes.toString (* required helper functions for the string type *) fun samestring (s1 : string, s2) = (s1 = s2) val hashstring = HashString.hashString fun stringToString s = String.concat["\"", s, "\""] (* required helper functions for the mask tyoe *) type mask = bool list val samemask : (mask * mask -> bool) = (op =) fun hashmask m = List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1) (Word.fromInt(List.length m)) m fun maskToString m = String.concat(List.map (fn true => "_" | false => ":") m) datatype rator = Add of ty | Sub of ty | Mul of ty | Div of ty | Neg of ty | LT of ty | LTE of ty | EQ of ty | NEQ of ty | GT of ty | GTE of ty | Max | Min | Sin | Cos | Pow | Not | Dot of ty | Cross | Norm of ty | Scale of ty | InvScale of ty | CL | PrincipleEvec of ty | Slice of ty * mask | Subscript of ty | IntToReal | TruncToInt | RoundToInt | CeilToInt | FloorToInt | Kernel of Kernel.kernel | LoadImage of ImageInfo.info | Convolve | Inside | Field of FieldDef.field_def | AddField | ScaleField | NegField | DiffField | Probe | Input of string | InputWithDefault of string fun arity (Add _) = 2 | arity (Sub _) = 2 | arity (Mul _) = 2 | arity (Div _) = 2 | arity (Neg _) = 1 | arity (LT _) = 2 | arity (LTE _) = 2 | arity (EQ _) = 2 | arity (NEQ _) = 2 | arity (GT _) = 2 | arity (GTE _) = 2 | arity Max = 2 | arity Min = 2 | arity Sin = 1 | arity Cos = 1 | arity Pow = 2 | arity Not = 1 | arity (Dot _) = 2 | arity Cross = 2 | arity (Norm _) = 1 | arity (Scale _) = 2 | arity (InvScale _) = 2 | arity CL = 1 | arity (PrincipleEvec _) = 2 | arity (Slice _) = 1 | arity (Subscript _) = ~1 | arity IntToReal = 1 | arity TruncToInt = 1 | arity RoundToInt = 1 | arity CeilToInt = 1 | arity FloorToInt = 1 | arity (Kernel _) = 0 | arity (LoadImage _) = 0 | arity Convolve = 2 | arity Inside = 2 | arity (Field _) = 0 | arity AddField = 2 | arity ScaleField = 2 | arity NegField = 1 | arity DiffField = 1 | arity Probe = 2 | arity (Input _) = 0 | arity (InputWithDefault _) = 1 fun same (Add(a0), Add(b0)) = samety(a0, b0) | same (Sub(a0), Sub(b0)) = samety(a0, b0) | same (Mul(a0), Mul(b0)) = samety(a0, b0) | same (Div(a0), Div(b0)) = samety(a0, b0) | same (Neg(a0), Neg(b0)) = samety(a0, b0) | same (LT(a0), LT(b0)) = samety(a0, b0) | same (LTE(a0), LTE(b0)) = samety(a0, b0) | same (EQ(a0), EQ(b0)) = samety(a0, b0) | same (NEQ(a0), NEQ(b0)) = samety(a0, b0) | same (GT(a0), GT(b0)) = samety(a0, b0) | same (GTE(a0), GTE(b0)) = samety(a0, b0) | same (Max, Max) = true | same (Min, Min) = true | same (Sin, Sin) = true | same (Cos, Cos) = true | same (Pow, Pow) = true | same (Not, Not) = true | same (Dot(a0), Dot(b0)) = samety(a0, b0) | same (Cross, Cross) = true | 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 (Slice(a0,a1), Slice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1) | same (Subscript(a0), Subscript(b0)) = samety(a0, b0) | same (IntToReal, IntToReal) = true | same (TruncToInt, TruncToInt) = true | same (RoundToInt, RoundToInt) = true | same (CeilToInt, CeilToInt) = true | same (FloorToInt, FloorToInt) = true | same (Kernel(a0), Kernel(b0)) = Kernel.same(a0, b0) | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0) | same (Convolve, Convolve) = true | same (Inside, Inside) = true | same (Field(a0), Field(b0)) = FieldDef.same(a0, b0) | same (AddField, AddField) = true | same (ScaleField, ScaleField) = true | same (NegField, NegField) = true | same (DiffField, DiffField) = true | same (Probe, Probe) = true | same (Input(a0), Input(b0)) = samestring(a0, b0) | same (InputWithDefault(a0), InputWithDefault(b0)) = samestring(a0, b0) | same _ = false fun hash (Add(a0)) = 0w3 + hashty a0 | hash (Sub(a0)) = 0w5 + hashty a0 | hash (Mul(a0)) = 0w7 + hashty a0 | hash (Div(a0)) = 0w11 + hashty a0 | hash (Neg(a0)) = 0w13 + hashty a0 | hash (LT(a0)) = 0w17 + hashty a0 | hash (LTE(a0)) = 0w19 + hashty a0 | hash (EQ(a0)) = 0w23 + hashty a0 | hash (NEQ(a0)) = 0w29 + hashty a0 | hash (GT(a0)) = 0w31 + hashty a0 | hash (GTE(a0)) = 0w37 + hashty a0 | hash Max = 0w41 | hash Min = 0w43 | hash Sin = 0w47 | hash Cos = 0w53 | hash Pow = 0w59 | hash Not = 0w61 | hash (Dot(a0)) = 0w67 + hashty a0 | hash Cross = 0w71 | hash (Norm(a0)) = 0w73 + hashty a0 | hash (Scale(a0)) = 0w79 + hashty a0 | hash (InvScale(a0)) = 0w83 + hashty a0 | hash CL = 0w89 | hash (PrincipleEvec(a0)) = 0w97 + hashty a0 | hash (Slice(a0,a1)) = 0w101 + hashty a0 + hashmask a1 | hash (Subscript(a0)) = 0w103 + hashty a0 | hash IntToReal = 0w107 | hash TruncToInt = 0w109 | hash RoundToInt = 0w113 | hash CeilToInt = 0w127 | hash FloorToInt = 0w131 | hash (Kernel(a0)) = 0w137 + Kernel.hash a0 | hash (LoadImage(a0)) = 0w139 + ImageInfo.hash a0 | hash Convolve = 0w149 | hash Inside = 0w151 | hash (Field(a0)) = 0w157 + FieldDef.hash a0 | hash AddField = 0w163 | hash ScaleField = 0w167 | hash NegField = 0w173 | hash DiffField = 0w179 | hash Probe = 0w181 | hash (Input(a0)) = 0w191 + hashstring a0 | hash (InputWithDefault(a0)) = 0w193 + hashstring a0 fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"] | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"] | toString (Mul(a0)) = concat["Mul<", tyToString a0, ">"] | toString (Div(a0)) = concat["Div<", tyToString a0, ">"] | toString (Neg(a0)) = concat["Neg<", tyToString a0, ">"] | toString (LT(a0)) = concat["LT<", tyToString a0, ">"] | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"] | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"] | toString (NEQ(a0)) = concat["NEQ<", tyToString a0, ">"] | toString (GT(a0)) = concat["GT<", tyToString a0, ">"] | toString (GTE(a0)) = concat["GTE<", tyToString a0, ">"] | toString Max = "Max" | toString Min = "Min" | toString Sin = "Sin" | toString Cos = "Cos" | toString Pow = "Pow" | toString Not = "Not" | toString (Dot(a0)) = concat["Dot<", tyToString a0, ">"] | toString Cross = "Cross" | 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 (Slice(a0,a1)) = concat["Slice<", tyToString a0, ",", maskToString a1, ">"] | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"] | toString IntToReal = "IntToReal" | toString TruncToInt = "TruncToInt" | toString RoundToInt = "RoundToInt" | toString CeilToInt = "CeilToInt" | toString FloorToInt = "FloorToInt" | toString (Kernel(a0)) = concat["Kernel<", Kernel.toString a0, ">"] | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"] | toString Convolve = "Convolve" | toString Inside = "Inside" | toString (Field(a0)) = concat["Field<", FieldDef.toString a0, ">"] | toString AddField = "AddField" | toString ScaleField = "ScaleField" | toString NegField = "NegField" | toString DiffField = "DiffField" | toString Probe = "Probe" | toString (Input(a0)) = concat["Input<", stringToString a0, ">"] | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"] end structure HighIL = SSAFn( structure Ty = HighILTypes structure Op = HighOps)
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |