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

SCM Repository

[diderot] View of /trunk/src/compiler/IL/ssa-check-fn.sml
ViewVC logotype

View of /trunk/src/compiler/IL/ssa-check-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 435 - (download) (annotate)
Tue Oct 19 13:14:20 2010 UTC (8 years, 10 months ago) by jhr
File size: 1195 byte(s)
  Upated URL in header to diderot-language.cs.uchicago.edu
(* ssa-check-fn.sml
 *
 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * Consistency checking for SSA representation
 *)

functor SSACheckFn (IL : SSA) : sig

  end = struct

(* things to check:
 *   1) SSA property
 *   2) variable usage counts
 *   3) successor/predecessor matching in CFG
 *   4) arity of operators
 *)

    fun checkRHS (OP(rator, args)) =
	(* check operator arity *)
	  if Op.arity rator <> List.length args
	    then (* error *)
	    else ()
      | checkRHS _ = ()

    fun checkNode (node as IL.ND{kind, ...}) = let
	  val preds = IL.Node.preds nd
	  val succs = IL.Node.succs nd
	  val inList = List.exists (fn nd => IL.Node.same(node, nd))
	  in
	    if List.all (fn nd => inList(IL.Node.succs nd)) (IL.Node.preds nd)
	      then ()
	      else (* error: predecessor/successor mismatch *);
	    if List.all (fn nd => inList(IL.Node.preds nd)) (IL.Node.succs nd)
	      then ()
	      else (* error: successor/predecessor mismatch *);
	    case kind
	     of NULL => (* error: unexpected NULL *)
	      | JOIN{phis, ...} =>
	      | BLOCK{body, ...} =>
	      | _ => ()
	    (* end case *))
	  end

  end

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