SCM Repository
View of /trunk/src/compiler/translate/translate-basis.sml
Parent Directory
|
Revision Log
Revision 180 -
(download)
(annotate)
Wed Jul 28 14:37:08 2010 UTC (10 years, 5 months ago) by jhr
File size: 2903 byte(s)
Wed Jul 28 14:37:08 2010 UTC (10 years, 5 months ago) by jhr
File size: 2903 byte(s)
Working on translation to HighIL
(* translate-basis.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * Translation for basis operations in Simple AST to HighIL code *) structure TranslateBasis : sig val translate : (HighIL.var * Var.var * Types.meta_var list * HighIL.var list) -> HighIL.simple_stmt list end = struct structure IL = HighIL structure Op = HighOps fun simpleOP rator (y, [], xs) = [IL.ASSIGN(y, IL.OP(rator, xs))] val tbl = let val tbl = Var.Tbl.mkTable (128, Fail "Tanslate table") in List.app (Var.Tbl.insert tbl) [ (add_ii, simpleOp(OP.Add OP.IntTy)), (add_tt, fn (y, [SK], xs) => ??), (sub_ii, simpleOp(OP.Sub OP.IntTy)), (sub_tt, fn (y, [SK], xs) => ??), (mul_ii, simpleOp(OP.Mul OP.IntTy)), (mul_rr, simpleOp(OP.Mul(OP.TensorTy[]))), (mul_rt, fn (y, [SK], xs) => ??), (mul_tr, fn (y, [SK], xs) => ??), (div_ii, simpleOp(OP.Div OP.IntTy)), (div_rr, simpleOp(OP.Div(OP.TensorTy[]))), (div_tr, fn (y, [SK], xs) => ??), (lt_ii, simpleOp(OP.LT OP.IntTy)), (lt_rr, simpleOp(OP.LT(OP.TensorTy[]))), (lte_ii, simpleOp(OP.LTE OP.IntTy)), (lte_rr, simpleOp(OP.LTE(OP.TensorTy[]))), (gte_ii, simpleOp(OP.GTE OP.IntTy)), (gte_rr, simpleOp(OP.GTE(OP.TensorTy[]))), (gt_ii, simpleOp(OP.GT OP.IntTy)), (gt_rr, simpleOp(OP.GT(OP.TensorTy[]))), (equ_bb, simpleOp(OP.EQ OP.BoolTy)), (equ_ii, simpleOp(OP.EQ OP.IntTy)), (equ_ss, simpleOp(OP.EQ OP.StringTy)), (equ_rr, simpleOp(OP.EQ(OP.TensorTy[]))), (neq_bb, simpleOp(OP.NEQ OP.BoolTy)), (neq_ii, simpleOp(OP.NEQ OP.IntTy)), (neq_ss, simpleOp(OP.NEQ OP.StringTy)), (neq_rr, simpleOp(OP.NEQ(OP.TensorTy[]))), (neg_i, simpleOp(OP.Neg OP.IntTy)), (neg_t, fn (y, [SK], xs) => ??), (neg_f, fn (y, [DK, NK, SK], xs) => ??), (op_at, fn (y, [DK, NK, SK], xs) => ??), (op_D, fn (y, [DK, NK, SK], xs) => ??), (op_norm, fn (y, [SK], xs) => ??), (op_not, simpleOp OP.Not), (op_subscript, fn (y, [SK, NK], xs) => ??), (fn_CL, fn (y, [N3, N3], xs) => ??), (fn_convolve, fn (y, [DK, NK, SK], xs) => ??), (fn_cos, simpleOp OP.Cos), (fn_dot, fn (y, [NK], xs) => ??), (fn_inside, fn (y, [DK, NK, SK], xs) => ??), (fn_load, fn (y, [NK, SK], xs) => ??), (fn_max, simpleOp Op.Min), (fn_min, simpleOp OP.Max), (fn_modulate, fn (y, [NK], xs) => ??), (fn_pow, simpleOp OP.Pow), (fn_principleEvec, fn (y, [NK], xs) => ??), (fn_sin, simpleOp OP.Sin), (kn_bspln3, fn (y, [], xs) => ??, (kn_bspln5, fn (y, [], xs) => ??, (kn_ctmr, fn (y, [], xs) => ??, (kn_tent, fn (y, [], xs) => ??, (i2r, fn (y, [], xs) => ??, (input, fn (y, [TK], xs) => ??) ]; tbl end fun translate (y, f, mvs, xs) = (case Var.Tbl.find tbl f of SOME transFn => transFn(mvs, xs) | NONE => raise Fail("TranslateBasis.translate: unknown function " ^ Var.toString f) (* end case *)) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |