SCM Repository
View of /trunk/src/compiler/high-il/high-il.sml
Parent Directory
|
Revision Log
Revision 282 -
(download)
(annotate)
Fri Aug 13 19:20:23 2010 UTC (10 years, 5 months ago) by jhr
File size: 8984 byte(s)
Fri Aug 13 19:20:23 2010 UTC (10 years, 5 months ago) by jhr
File size: 8984 byte(s)
Made the IL generator more general to handle MidIL features
(* 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 datatype ty = BoolTy | StringTy | IntTy | TensorTy of int list fun samety (ty1 : ty, ty2) = (ty1 = ty2) fun hashty BoolTy = 0w1 | hashty StringTy = 0w2 | hashty IntTy = 0w3 | hashty (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd fun tyToString BoolTy = "bool" | tyToString StringTy = "string" | tyToString IntTy = "int" | tyToString (TensorTy dd) = String.concat[ "tensor[", String.concatWith "," (List.map Int.toString dd), "]" ] fun samestring (s1 : string, s2) = (s1 = s2) val hashstring = HashString.hashString fun stringToString s = String.concat["\"", s, "\""] 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 | Dot of ty | Cross | Norm of ty | Scale of ty | InvScale of ty | CL | PrincipleEvec of ty | Subscript of ty | Max | Min | Sin | Cos | Pow | Not | 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 | Transform of ImageInfo.info | 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 (Dot _) = 2 | arity Cross = 2 | arity (Norm _) = 1 | arity (Scale _) = 2 | arity (InvScale _) = 2 | arity CL = 1 | arity (PrincipleEvec _) = 2 | arity (Subscript _) = 2 | arity Max = 2 | arity Min = 2 | arity Sin = 1 | arity Cos = 1 | arity Pow = 2 | arity Not = 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 (Transform _) = 1 | 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 (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 (Subscript(a0), Subscript(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 (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 (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0) | 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 (Dot(a0)) = 0w41 + hashty a0 | hash Cross = 0w43 | hash (Norm(a0)) = 0w47 + hashty a0 | hash (Scale(a0)) = 0w53 + hashty a0 | hash (InvScale(a0)) = 0w59 + hashty a0 | hash CL = 0w61 | hash (PrincipleEvec(a0)) = 0w67 + hashty a0 | hash (Subscript(a0)) = 0w71 + hashty a0 | hash Max = 0w73 | hash Min = 0w79 | hash Sin = 0w83 | hash Cos = 0w89 | hash Pow = 0w97 | hash Not = 0w101 | hash IntToReal = 0w103 | hash TruncToInt = 0w107 | hash RoundToInt = 0w109 | hash CeilToInt = 0w113 | hash FloorToInt = 0w127 | hash (Kernel(a0)) = 0w131 + Kernel.hash a0 | hash (LoadImage(a0)) = 0w137 + ImageInfo.hash a0 | hash Convolve = 0w139 | hash Inside = 0w149 | hash (Field(a0)) = 0w151 + FieldDef.hash a0 | hash AddField = 0w157 | hash ScaleField = 0w163 | hash NegField = 0w167 | hash DiffField = 0w173 | hash Probe = 0w179 | hash (Transform(a0)) = 0w181 + ImageInfo.hash a0 | 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 (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 (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"] | toString Max = "Max" | toString Min = "Min" | toString Sin = "Sin" | toString Cos = "Cos" | toString Pow = "Pow" | toString Not = "Not" | 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 (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"] | toString (Input(a0)) = concat["Input<", stringToString a0, ">"] | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"] end structure HighIL = SSAFn(HighOps)
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |