147 |
| (Op.CeilToInt d, [a]) => bind (lhs, T.Expr.ceilToInt(exp a)) |
| (Op.CeilToInt d, [a]) => bind (lhs, T.Expr.ceilToInt(exp a)) |
148 |
| (Op.FloorToInt d, [a]) => bind (lhs, T.Expr.floorToInt(exp a)) |
| (Op.FloorToInt d, [a]) => bind (lhs, T.Expr.floorToInt(exp a)) |
149 |
| (Op.ImageAddress, [a]) => bind (lhs, T.Expr.imageAddr(exp a)) |
| (Op.ImageAddress, [a]) => bind (lhs, T.Expr.imageAddr(exp a)) |
150 |
(* |
| (Op.LoadVoxels(rTy, n), [a]) => [] (* FIXME *) |
151 |
| (Op.LoadVoxels(rTy, n), [a]) => |
| (Op.PosToImgSpace d, [v, x]) => [] (* FIXME *) |
152 |
| (Op.PosToImgSpace d, [v, x]) => |
| (Op.GradToWorldSpace d, [v, x]) => [] (* FIXME *) |
153 |
| (Op.GradToWorldSpace d, [v, x]) => |
| (Op.LoadImage info, [a]) => [] (* FIXME *) |
154 |
| (Op.LoadImage info, [a]) => |
| (Op.Inside d, [v, x]) => [] (* FIXME *) |
155 |
| (Op.Inside d, [v, x]) => |
| (Op.Input(ty, name), []) => [] (* FIXME *) |
156 |
| (Op.Input(ty, name), []) => |
| (Op.InputWithDefault(ty, name), [a]) => [] (* FIXME *) |
157 |
| (Op.InputWithDefault(ty, name), [a]) => |
| _ => raise Fail(concat[ |
158 |
*) |
"incorrect number of arguments for ", Op.toString rator |
159 |
| _ => raise Fail "incorrect number of arguments" |
]) |
160 |
(* end case *)) |
(* end case *)) |
161 |
in |
in |
162 |
f |
f |
224 |
doNode (vtbl, fn _ => raise Fail "bogus ifCont at JOIN node", [], CFG.entry cfg) |
doNode (vtbl, fn _ => raise Fail "bogus ifCont at JOIN node", [], CFG.entry cfg) |
225 |
end |
end |
226 |
|
|
227 |
|
(* generate the global-variable declarations and initialization code *) |
228 |
|
fun genGlobals (vtbl, prog, globals, globalInit) = let |
229 |
|
(* FIXME: we should put the initialization code in a function! *) |
230 |
|
in |
231 |
|
gen (vtbl, globalInit) |
232 |
|
end |
233 |
|
|
234 |
fun generate (fileStem, IL.Program{globals, globalInit, strands}) = let |
fun generate (fileStem, IL.Program{globals, globalInit, strands}) = let |
235 |
val prog = T.newProgram () |
val prog = T.newProgram () |
236 |
|
val vtbl = VDefTbl.newTbl() |
237 |
in |
in |
238 |
|
genGlobals (vtbl, prog, globals, globalInit); |
239 |
|
(* output the program *) |
240 |
T.generate (fileStem, prog) |
T.generate (fileStem, prog) |
241 |
end |
end |
242 |
|
|