Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] View of /branches/charisee/src/compiler/gen/il/mid-il.spec
 [diderot] / branches / charisee / src / compiler / gen / il / mid-il.spec

# View of /branches/charisee/src/compiler/gen/il/mid-il.spec

Tue Jan 5 00:01:44 2016 UTC (3 years, 6 months ago) by cchiw
File size: 3100 byte(s)
`code cleanup`
```# specification of operators for MidIL version of the IR.  Each line (other than comments)
# specifies an operator using five fields, which are separated by ":".  The fields are
#	name
#	argument type		(optional)
#       result arity
#	arity
#	comment			(optional)
#
# Operations with effects are denoted by a "!" as the first character of the line.
#
# type-indexed arithmetic operations
ISub : : 1 : 2 :
IMul : : 1 : 2 :
IDiv : : 1 : 2 :
INeg : : 1 : 1 :
Abs : ty : 1 : 1 :
LT : ty : 1 : 2 :
LTE : ty : 1 : 2 :
EQ : ty : 1 : 2 :
NEQ : ty : 1 : 2 :
GT : ty : 1 : 2 :
GTE : ty : 1 : 2 :
Not : : 1 : 1 : boolean negation
Max : : 1 : 2 :
Min : : 1 : 2 :
# Clamp<ty>(lo, hi, x) -- clamps x to the range lo..hi
Clamp : ty : 1 : 3 : clamp argument to range
# Lerp<ty>(a, b, t) -- computes a + t*(b-a)
Lerp : ty : 1 : 3 : linear interpolation between 0 and 1
#
Sqrt : : 1 : 1 : returns the sqrt(used to replace norm)]
### vector operations
# Norm<ty>(x) -- returns the norm of the tensor x, which has type ty
#In high-to-mid replaces op with EIN op. Implemented as summation over modulate
#Norm : ty : 1 : 1 :
#Normalize<n>(v)   -- returns the unit vector in direction u; n is the length ov u
Normalize : int : 1 : 1 :
PrincipleEvec : ty : 1 : 2 : principle eigenvector; ty is result vector type
EigenVecs2x2 : : 1 : 1 : Eigen vectors and values for 2x2 matrix
EigenVecs3x3 : : 1 : 1 : Eigen vectors and values for 3x3 matrix
EigenVals2x2 : : 1 : 1 : Eigen values for 2x2 matrix
EigenVals3x3 : : 1 : 1 : Eigen values for 3x3 matrix
# Zero<ty>() -- zero tensor
Zero : ty : 1 : 0 : identity matrix
# operations on sequences
# Select<ty,i>(u)  -- select ith element of tuple; ty is tuple type
Select : ty * int : 1 : 1 :
# Index<ty,i>(u)  -- select ith element of sequence; ty is sequence type
Index : ty * int : 1 : 1 :
# Subscript<ty>(u,i) -- select ith element of sequence; ty is type of sequence
Subscript : ty : 1 : 2 :
#
# compute integral parts of reals
Ceiling : int : 1 : 1 : compute real ceiling of a vector
Floor : int : 1 : 1 : compute real floor of a vector
Round : int : 1 : 1 : compute real rounding to nearest integral real of a vector
Trunc : int : 1 : 1 : compute real truncation to integral real of a vector
#
### conversions; the real to int forms are vector ops
IntToReal : : 1 : 1 :
RealToInt : int : 1 : 1 : cast real vector to int vector
#
### image/kernel operations
Kernel     : Kernel.kernel * int  : 1 : 0 : Kernel<h, k>, where h is the kernel and k is level of differentiation
Transform : ImageInfo.info : 1 : 1 : Pulls transformation matrix from image.
Translate : ImageInfo.info : 1 : 1 : Pulls translation vector from image.
# Inside<I,s>(u,V) -- tests to see if image-space position u is inside the volume
# occupied by the image V.  I is the image info and s is the border width
Inside : ImageInfo.info * int : 1 : 2 :
#