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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 265 - (view) (download)

1 : jhr 198 (* ssa-check-fn.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * Consistency checking for SSA representation
7 :     *)
8 :    
9 :     functor SSACheckFn (IL : SSA) : sig
10 :    
11 :     end = struct
12 :    
13 :     (* things to check:
14 :     * 1) SSA property
15 :     * 2) variable usage counts
16 :     * 3) successor/predecessor matching in CFG
17 :     * 4) arity of operators
18 :     *)
19 :    
20 : jhr 265 fun checkRHS (OP(rator, args)) =
21 :     (* check operator arity *)
22 :     if Op.arity rator <> List.length args
23 :     then (* error *)
24 :     else ()
25 :     | checkRHS _ = ()
26 :    
27 :     fun checkNode (node as IL.ND{kind, ...}) = let
28 :     val preds = IL.Node.preds nd
29 :     val succs = IL.Node.succs nd
30 :     val inList = List.exists (fn nd => IL.Node.same(node, nd))
31 :     in
32 :     if List.all (fn nd => inList(IL.Node.succs nd)) (IL.Node.preds nd)
33 :     then ()
34 :     else (* error: predecessor/successor mismatch *);
35 :     if List.all (fn nd => inList(IL.Node.preds nd)) (IL.Node.succs nd)
36 :     then ()
37 :     else (* error: successor/predecessor mismatch *);
38 :     case kind
39 :     of NULL => (* error: unexpected NULL *)
40 :     | JOIN{phis, ...} =>
41 :     | BLOCK{body, ...} =>
42 :     | _ => ()
43 :     (* end case *))
44 :     end
45 :    
46 : jhr 198 end

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