Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /trunk/src/compiler/high-to-mid/high-to-mid.sml
ViewVC logotype

View of /trunk/src/compiler/high-to-mid/high-to-mid.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 328 - (download) (annotate)
Wed Aug 18 22:19:26 2010 UTC (9 years, 2 months ago) by jhr
File size: 1113 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 = 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 "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

    fun translate prog = raise Fail "FIXME"

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0