Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

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

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

Thu May 5 04:49:02 2011 UTC (8 years, 4 months ago) by jhr
Original Path: trunk/src/compiler/IL/gen/mid-il.spec
File size: 3811 byte(s)
more merging of pure-cfg changes back into trunk
# specification of operators for MidIL version of the IR.  Each line (other than comments)
# specifies an operator using four fields, which are separated by ":".  The fields are
#	name
#	argument type		(optional)
#	arity
#	comment			(optional)
#
# type-indexed arithmetic operations
Add : ty : 2 :
Sub : ty : 2 :
Mul : ty : 2 :
Div : ty : 2 :
Neg : ty : 1 :
Abs : ty : 1 :
LT : ty : 2 :
LTE : ty : 2 :
EQ : ty : 2 :
NEQ : ty : 2 :
GT : ty : 2 :
GTE : ty : 2 :
Not : : 1 : boolean negation
Max : : 2 :
Min : : 2 :
# Lerp<ty>(a, b, t) -- computes a + t*(b-a)
Lerp : ty : 3 : linear interpolation between 0 and 1
#
### vector operations
# Dot<n>(u, v)	-- computes dot product of u and v; n specifies u and v's arity
Dot : int : 2 :
# MulVecMat<m,n>(v, M) -- computes v*M, where M is an mxn-matrix and v is an m-vector
MulVecMat : int * int : 2 : vector times matrix multiplication
# MulMatVec<m,n>(M, v) -- computes M*v, where M is an mxn-matrix and v is a n-vector
MulMatVec : int * int : 2 : matrix times vector multiplication (type is matrix type)
# MulMatMat<m,n,p>(M, N) -- computes M*N, where M is an mxn-matrix and N is an nxp-matrix
MulMatMat : int * int * int : 2 : matrix times matrix multiplication
# Cross(u, v)	-- computes cross product of u and v
Cross : : 2 :
# Select<ty,i>(u)  -- select ith element of vector u; ty specifies u's type (IVec or Vec)
Select : ty * int : 1 :
# Norm<ty>(x) -- returns the norm of the tensor x, which has type ty
Norm : ty : 1 :
# Normalize<n>(v)   -- returns the unit vector in direction u; n is the length ov u
Normalize : int : 1 :
# Scale<ty>(s,u) -- multiply scalar s time tensor u; ty specifies u's type
Scale : ty : 2 : scalar*tensor multiplication
CL : : 1 : linear anisotropy measures
PrincipleEvec : ty : 2 : principle eigenvector; ty is result vector type
# Identity<n>() -- nxn identity matrix
Identity : int : 0 : identity matrix
# Zero<ty>() -- zero tensor
Zero : ty : 0 : identity matrix
# Trace<n>(m) -- computes trace of nxn matrix m
Trace : int : 1 : compute trace of matrix
Subscript : ty : 2 :
#
# compute integral parts of reals
Ceiling : int : 1 : compute real ceiling of a vector
Floor : int : 1 : compute real floor of a vector
Round : int : 1 : compute real rounding to nearest integral real of a vector
Trunc : int : 1 : compute real truncation to integral real of a vector
#
### conversions; the real to int forms are vector ops
IntToReal : : 1 :
RealToInt : int : 1 : cast real vector to int vector
#
### image/kernel operations
# VoxelAddress<I,offset>(V, i, j, ...) -- compute the address of the voxel data indexed by i, j, ...
# for non-scalar images, the offset specifies which sample and I specifies the stride.
VoxelAddress : ImageInfo.info * int : * : compute the address of a voxel
LoadVoxels : ImageInfo.info * int : 1 : load a vector of voxel values from an address
# PosToImgSpace<I>(V,u) -- transforms the world-space position u into the image-space specified by V.
PosToImgSpace : ImageInfo.info : 2 : transform a world-space position to image-space
# TensorToWorldSpace<I,ty>(V,u) -- transforms the image-space tensor u to from V's image space to world space
TensorToWorldSpace : ImageInfo.info * ty : 2 : transform an image-space gradient to world-space
# EvalKernel<i,h,k>(u) -- computes (D^k h)(u), where i is the size of vector u.
EvalKernel : int * Kernel.kernel * int : 1 : apply a kernel function to a scalar or vector of arguments