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 349 -
(download)
(annotate)
Fri Sep 24 00:24:20 2010 UTC (11 years, 9 months ago) by jhr
File size: 1307 byte(s)
Fri Sep 24 00:24:20 2010 UTC (11 years, 9 months ago) by jhr
File size: 1307 byte(s)
working on HighIL to MidIL translation
(* 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 = HighOps structure DstIL = MidIL structure DstOp = MidOps structure VMap = SrcIL.Var.Map fun lookupVar (env, x) = (case VMap.find(env, x) of SOME x' => x' | NONE => raise Fail("unknown variable "^SrcIL.Var.toString x) (* end case *)) (* 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 fld of SrcIL.OP(SrcOp.Field fld, []) => fld | _ => raise Fail "bogus field binding" (* end case *)) fun expand (FieldDef.CONV(_, img, _)) = let val imgPos = DstIL.Var.new "x" 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 val expandProbe = Probe.expand fun translate prog = raise Fail "FIXME" end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |