SCM Repository
[diderot] / trunk / src / compiler / high-to-mid / high-to-mid.sml |
View of /trunk/src/compiler/high-to-mid/high-to-mid.sml
Parent Directory
|
Revision Log
Revision 280 -
(download)
(annotate)
Fri Aug 13 17:40:28 2010 UTC (10 years, 5 months ago) by jhr
File size: 1867 byte(s)
Fri Aug 13 17:40:28 2010 UTC (10 years, 5 months ago) by jhr
File size: 1867 byte(s)
New directory
(* high-to-mid.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * Translation from HighIL to MidIL representations. *) structure HighToMid : sig val translate : HighIL.program -> MidIL.program end = struct structure SrcIL = HighIL structure SrcOp = SrcIL.Op structure DstIL = MidIL structure DstOp = DstIL.Op structure VMap = SrcIL.Var.Map (* expand the field Inside operator into a image-space test *) fun expandInside (env, result, pos, fld) = let val pos' = lookupVar (env, pos) val fld = (case valueOf fld of SrcIL.OP(SrcOp.Field fld, []) => fld | _ => raise Fail "bogus field binding" (* end case *)) fun expand (FieldDef.CONV(_, img, _)) => let val imgPos = newVar ?? in [ (imgPos, DstIL.OP(DstOp.Transform img, [pos'])), (result, DstIL.OP(DstOp.Inside img, [imgPos])) ] end | expand (FieldDef.NEG fld) => expand fld | expand (FieldDef.SUM(fld1, dlf2)) => raise Fail "expandInside: SUM" in expand fld end fun expandProbe (env, result, fld, pos) = let val pos' = lookupVar (env, pos) val fld = (case valueOf fld of SrcIL.OP(SrcOp.Field fld, []) => fld | _ => raise Fail "bogus field binding" (* end case *)) fun expand (result, FieldDef.CONV(0, img, h)) => let val imgPos = newVar ?? val xformStm = (imgPos, DstIL.OP(DstOp.Transform img, [pos'])) (* generate samples based on kernel support and dimensionality of image *) in xformStm :: probeStms end | expand (FieldDef.CONV(k, img, h)) => ?? | expand (FieldDef.NEG fld) => let val r = newVar ?? val stms = expand (r, fld) in (r, DstIL.OP(DstOp.Neg ty, [r])) :: stms end | expand (FieldDef.SUM(fld1, dlf2)) => raise Fail "expandInside: SUM" in List.rev (expand (result, fld)) end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |