SCM Repository
View of /branches/pure-cfg/src/compiler/high-to-mid/test.sml
Parent Directory
|
Revision Log
Revision 477 -
(download)
(annotate)
Sat Nov 13 16:02:07 2010 UTC (10 years, 5 months ago) by jhr
File size: 1821 byte(s)
Sat Nov 13 16:02:07 2010 UTC (10 years, 5 months ago) by jhr
File size: 1821 byte(s)
Creating a branch to explore a pure CFG IL
(* test.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu) * All rights reserved. * * Test driver to the generation of probe code *) structure Test = struct structure II = ImageInfo structure FD = FieldDef structure K = Kernel structure DstIL = MidIL structure PP = SSAPPFn(DstIL) local structure VSet = DstIL.Var.Set in fun checkCode (result, code, pos) = let fun checkVar bvs x = if VSet.member(bvs, x) then () else print(concat["variable ", DstIL.Var.toString x, " used before definition\n"]) fun chkAssign ((y, rhs), bvs) = ( case rhs of DstIL.VAR x => checkVar bvs x | DstIL.LIT _ => () | DstIL.OP(_, xs) => List.app (checkVar bvs) xs | DstIL.CONS xs => List.app (checkVar bvs) xs (* end case *); VSet.add (bvs, y)) val bvs = List.foldl chkAssign (VSet.singleton pos) code in checkVar bvs result end end fun expand fld = let val result = DstIL.Var.new "result" val pos = DstIL.Var.new "pos" val code = Probe.expand (result, fld, pos) in print(concat["expand (", FD.toString fld, "):\n"]); List.app (fn s => print("\t" ^ PP.assignToString s ^ "\n")) code; checkCode (result, code, pos) end (* fake 2D image info *) val img2d = II.ImgInfo{ id = OS.FileSys.fileId "/dev/null", dim = 2, ty = ([], RawTypes.RT_Float), origin = [], sizes = [] } (* fake 3D image info *) val img3d = II.ImgInfo{ id = OS.FileSys.fileId "/dev/null", dim = 3, ty = ([], RawTypes.RT_Float), origin = [], sizes = [] } val fld2d = FD.convolve(img2d, K.bspln3) val fld2d' = FD.diff(FD.convolve(img2d, K.bspln3)) val fld3d = FD.convolve(img3d, K.bspln3) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |