SCM Repository
View of /branches/pure-cfg/src/compiler/low-il/low-il.sml
Parent Directory
|
Revision Log
Revision 983 -
(download)
(annotate)
Tue Apr 26 16:58:46 2011 UTC (9 years, 10 months ago) by jhr
File size: 11306 byte(s)
Tue Apr 26 16:58:46 2011 UTC (9 years, 10 months ago) by jhr
File size: 11306 byte(s)
Added partial support for mapping tensors from image space back to world space. Still need runtime system support for Hessians (see include/Diderot/inline-image.h)
(* low-il.in * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu) * All rights reserved. * * Lower-level version of the Diderot IL input file. * *) structure LowOps = struct type ty = LowILTypes.ty val samety = LowILTypes.same val hashty = LowILTypes.hash val tyToString = LowILTypes.toString fun sameint (i1 : int, i2) = (i1 = i2) fun hashint i = Word.fromInt i fun intToString i = Int.toString i 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 | Abs of ty | LT of ty | LTE of ty | EQ of ty | NEQ of ty | GT of ty | GTE of ty | Not | Max | Min | Lerp of ty | Dot of int | MulVecMat of int * int | MulMatVec of int * int | MulMatMat of int * int * int | Cross | Select of ty * int | Norm of ty | Normalize of int | Scale of ty | CL | PrincipleEvec of ty | Identity of int | Zero of ty | Trace of int | Subscript of ty | Ceiling of int | Floor of int | Round of int | Trunc of int | IntToReal | RealToInt of int | ImageAddress of ImageInfo.info | LoadVoxels of ImageInfo.info * int | PosToImgSpace of ImageInfo.info | TensorToWorldSpace of ImageInfo.info * ty | LoadImage of ImageInfo.info | Inside of ImageInfo.info * int | Input of ty * string | InputWithDefault of ty * string fun arity (Add _) = 2 | arity (Sub _) = 2 | arity (Mul _) = 2 | arity (Div _) = 2 | arity (Neg _) = 1 | arity (Abs _) = 1 | arity (LT _) = 2 | arity (LTE _) = 2 | arity (EQ _) = 2 | arity (NEQ _) = 2 | arity (GT _) = 2 | arity (GTE _) = 2 | arity Not = 1 | arity Max = 2 | arity Min = 2 | arity (Lerp _) = 3 | arity (Dot _) = 2 | arity (MulVecMat _) = 2 | arity (MulMatVec _) = 2 | arity (MulMatMat _) = 2 | arity Cross = 2 | arity (Select _) = 1 | arity (Norm _) = 1 | arity (Normalize _) = 1 | arity (Scale _) = 2 | arity CL = 1 | arity (PrincipleEvec _) = 2 | arity (Identity _) = 0 | arity (Zero _) = 0 | arity (Trace _) = 1 | arity (Subscript _) = 2 | arity (Ceiling _) = 1 | arity (Floor _) = 1 | arity (Round _) = 1 | arity (Trunc _) = 1 | arity IntToReal = 1 | arity (RealToInt _) = 1 | arity (ImageAddress _) = 1 | arity (LoadVoxels _) = 1 | arity (PosToImgSpace _) = 2 | arity (TensorToWorldSpace _) = 2 | arity (LoadImage _) = 1 | arity (Inside _) = 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 (Abs(a0), Abs(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 (Not, Not) = true | same (Max, Max) = true | same (Min, Min) = true | same (Lerp(a0), Lerp(b0)) = samety(a0, b0) | same (Dot(a0), Dot(b0)) = sameint(a0, b0) | same (MulVecMat(a0,a1), MulVecMat(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1) | same (MulMatVec(a0,a1), MulMatVec(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1) | same (MulMatMat(a0,a1,a2), MulMatMat(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2) | same (Cross, Cross) = true | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1) | same (Norm(a0), Norm(b0)) = samety(a0, b0) | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0) | same (Scale(a0), Scale(b0)) = samety(a0, b0) | same (CL, CL) = true | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0) | same (Identity(a0), Identity(b0)) = sameint(a0, b0) | same (Zero(a0), Zero(b0)) = samety(a0, b0) | same (Trace(a0), Trace(b0)) = sameint(a0, b0) | same (Subscript(a0), Subscript(b0)) = samety(a0, b0) | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0) | same (Floor(a0), Floor(b0)) = sameint(a0, b0) | same (Round(a0), Round(b0)) = sameint(a0, b0) | same (Trunc(a0), Trunc(b0)) = sameint(a0, b0) | same (IntToReal, IntToReal) = true | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0) | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0) | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) | same (PosToImgSpace(a0), PosToImgSpace(b0)) = ImageInfo.same(a0, b0) | same (TensorToWorldSpace(a0,a1), TensorToWorldSpace(b0,b1)) = ImageInfo.same(a0, b0) andalso samety(a1, b1) | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0) | same (Inside(a0,a1), Inside(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) | same (Input(a0,a1), Input(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1) | same (InputWithDefault(a0,a1), InputWithDefault(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1) | 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 (Abs(a0)) = 0w17 + hashty a0 | hash (LT(a0)) = 0w19 + hashty a0 | hash (LTE(a0)) = 0w23 + hashty a0 | hash (EQ(a0)) = 0w29 + hashty a0 | hash (NEQ(a0)) = 0w31 + hashty a0 | hash (GT(a0)) = 0w37 + hashty a0 | hash (GTE(a0)) = 0w41 + hashty a0 | hash Not = 0w43 | hash Max = 0w47 | hash Min = 0w53 | hash (Lerp(a0)) = 0w59 + hashty a0 | hash (Dot(a0)) = 0w61 + hashint a0 | hash (MulVecMat(a0,a1)) = 0w67 + hashint a0 + hashint a1 | hash (MulMatVec(a0,a1)) = 0w71 + hashint a0 + hashint a1 | hash (MulMatMat(a0,a1,a2)) = 0w73 + hashint a0 + hashint a1 + hashint a2 | hash Cross = 0w79 | hash (Select(a0,a1)) = 0w83 + hashty a0 + hashint a1 | hash (Norm(a0)) = 0w89 + hashty a0 | hash (Normalize(a0)) = 0w97 + hashint a0 | hash (Scale(a0)) = 0w101 + hashty a0 | hash CL = 0w103 | hash (PrincipleEvec(a0)) = 0w107 + hashty a0 | hash (Identity(a0)) = 0w109 + hashint a0 | hash (Zero(a0)) = 0w113 + hashty a0 | hash (Trace(a0)) = 0w127 + hashint a0 | hash (Subscript(a0)) = 0w131 + hashty a0 | hash (Ceiling(a0)) = 0w137 + hashint a0 | hash (Floor(a0)) = 0w139 + hashint a0 | hash (Round(a0)) = 0w149 + hashint a0 | hash (Trunc(a0)) = 0w151 + hashint a0 | hash IntToReal = 0w157 | hash (RealToInt(a0)) = 0w163 + hashint a0 | hash (ImageAddress(a0)) = 0w167 + ImageInfo.hash a0 | hash (LoadVoxels(a0,a1)) = 0w173 + ImageInfo.hash a0 + hashint a1 | hash (PosToImgSpace(a0)) = 0w179 + ImageInfo.hash a0 | hash (TensorToWorldSpace(a0,a1)) = 0w181 + ImageInfo.hash a0 + hashty a1 | hash (LoadImage(a0)) = 0w191 + ImageInfo.hash a0 | hash (Inside(a0,a1)) = 0w193 + ImageInfo.hash a0 + hashint a1 | hash (Input(a0,a1)) = 0w197 + hashty a0 + hashstring a1 | hash (InputWithDefault(a0,a1)) = 0w199 + hashty a0 + hashstring a1 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 (Abs(a0)) = concat["Abs<", 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 Not = "Not" | toString Max = "Max" | toString Min = "Min" | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"] | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"] | toString (MulVecMat(a0,a1)) = concat["MulVecMat<", intToString a0, ",", intToString a1, ">"] | toString (MulMatVec(a0,a1)) = concat["MulMatVec<", intToString a0, ",", intToString a1, ">"] | toString (MulMatMat(a0,a1,a2)) = concat["MulMatMat<", intToString a0, ",", intToString a1, ",", intToString a2, ">"] | toString Cross = "Cross" | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"] | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"] | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"] | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"] | toString CL = "CL" | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"] | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"] | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"] | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"] | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"] | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"] | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"] | toString (Round(a0)) = concat["Round<", intToString a0, ">"] | toString (Trunc(a0)) = concat["Trunc<", intToString a0, ">"] | toString IntToReal = "IntToReal" | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"] | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"] | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"] | toString (PosToImgSpace(a0)) = concat["PosToImgSpace<", ImageInfo.toString a0, ">"] | toString (TensorToWorldSpace(a0,a1)) = concat["TensorToWorldSpace<", ImageInfo.toString a0, ",", tyToString a1, ">"] | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"] | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"] | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"] | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"] end structure LowIL = SSAFn( structure Ty = LowILTypes structure Op = LowOps) structure LowILCensus = CensusFn(LowIL)
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |