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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/IL/ssa-fn.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/IL/ssa-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 492, Wed Jan 26 17:42:05 2011 UTC revision 493, Thu Jan 27 16:40:50 2011 UTC
# Line 137  Line 137 
137          val replaceNode : (node * node) -> unit          val replaceNode : (node * node) -> unit
138        (* replace a simple node in a cfg with a subgraph *)        (* replace a simple node in a cfg with a subgraph *)
139          val splice : (node * cfg) -> unit          val splice : (node * cfg) -> unit
140          (* concatenate two CFGs *)
141            val concat : cfg * cfg -> cfg
142          (* convert a non-empty list of assignments to a CFG *)
143            val assignsToCFG : assign list -> cfg
144        end        end
145    
146    (* operations on CFG nodes *)    (* operations on CFG nodes *)
# Line 581  Line 585 
585                  | _ => raise Fail "unsupported replaceNode"                  | _ => raise Fail "unsupported replaceNode"
586                (* end case *))                (* end case *))
587    
588            fun concat (CFG{entry=e1, exit=x1}, CFG{entry=e2, exit=x2}) = (
589                  Node.setSucc (!x1, !e2);
590                  Node.setPred (!e2, !x1);
591                  CFG{entry=ref(!e1), exit=ref(!x2)})
592    
593          (* convert a non-empty list of assignments to a CFG *)
594            fun assignsToCFG stms = let
595                  val exit = ref Node.dummy
596                  fun cvt [] = raise Fail "unexpected empty assignment list"
597                    | cvt [assign] = let
598                        val nd = Node.mkASSIGN assign
599                        in
600                          exit := nd;
601                          nd
602                        end
603                    | cvt (assign::r) = let
604                        val r = cvt r
605                        val nd = Node.mkASSIGN assign
606                        in
607                          Node.addEdge (nd, r);
608                          nd
609                        end
610                  val entry = cvt stms
611                  in
612                    CFG{entry = ref entry, exit = exit}
613                  end
614    
615        end        end
616    
617    (* return a string representation of a PHI node *)    (* return a string representation of a PHI node *)

Legend:
Removed from v.492  
changed lines
  Added in v.493

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