source:project/release/3/graph-ssa/trunk/ssa-eggdoc.scm@11141

Last change on this file since 11141 was 11141, checked in by Ivan Raikov, 12 years ago

File size: 3.8 KB
Line
1
2(use eggdoc)
3
4(define doc
5  `((eggdoc:begin
6     (name "graph-ssa")
7     (description "Compute static single assignment form of a graph.")
8     (author (p "Richard Kelsey; ported to Chicken by "
9                (url "http://chicken.wiki.br/ivan raikov" "Ivan Raikov")))
10
11     (history
12      (version "1.0" "Initial release"))
13
14     (requires (url "graph-dominators.html" "graph-dominators"))
15
17
18     (usage "(require-extension graph-ssa)")
19
20     (documentation
21
22      (p "This code is based on the algorithm from "
23         (i "Efficiently computing static single assignment form and the control dependence graph") ", "
24         "ACM Transactions on Programming Languages and Systems 1991 13(4), pp. 451-490. ")
25
26      (subsection "Procedures"
27
28      (procedure "graph->ssa-graph:: G -> SSA-GRAPH"
29
30                 (p  "Computes the dominance frontiers of the nodes in the graph, and returns "
31                     "the list of nodes augmented with this information. "))
32
33      (procedure "graph-ssa-find-joins:: SSA-GRAPH -> NODES"
34
35                 (p "Given a list of SSA nodes, returns the list of nodes " (tt "N")
36                    " for which there are (at least) two paths " (tt "... N_0 M_0 ... M_i N")
37                    " and " (tt " ... N_1 P_0 ... P_j N") " such that " (tt "N_0") " and "
38                    (tt "N_1") " are distinct members of " (tt "NODES")
39                    " and the M's and P's are disjoint sets.")))
40
41
42     (examples (pre #<<EOF
43
44(require-extension srfi-1)
45(require-extension digraph)
46(require-extension graph-dominators)
47
48(define used-by '((a . b) (b . c) (c . d) (c . b) (b . e) (d . d) (d . e) ))
49
50(define g (make-digraph 'cfg "control flow graph"))
51
52(define node-list (delete-duplicates
53                   (concatenate (list (map car used-by) (map cdr used-by)))))
54
55(define node-ids (list-tabulate (length node-list) values))
56
57(for-each (lambda (i n) ((g 'add-node!) i (list #f n))) node-ids node-list)
58(define node-map (zip node-list node-ids))
59
60(for-each (lambda (e)
61            (match e ((ni . nj) (let ((i (car (alist-ref ni node-map)))
62                                      (j (car (alist-ref nj node-map))))
63                                  ((g 'add-edge!) (list i j (format "~A->~A" ni nj)))))
64                   (else (error "invalid edge " e))))
65          used-by)
66
67(define ssa-graph (graph->ssa-graph g))
68(graph-ssa-find-joins ssa-graph)
69
70
71EOF
72))
74      "Copyright (c) 1993-1999 by Richard Kelsey.
75
76   Ported to Chicken Scheme by Ivan Raikov.
77
78   Redistribution and use in source and binary forms, with or without
79   modification, are permitted provided that the following conditions
80   are met:
81
82     1. Redistributions of source code must retain the above copyright
83        notice, this list of conditions and the following disclaimer.
84
85     2. Redistributions in binary form must reproduce the above copyright
86        notice, this list of conditions and the following disclaimer in the
87        documentation and/or other materials provided with the distribution.
88
89     3. The names of its contributors may not be used to endorse or promote
90        products derived from this software without specific prior written
91        permission.
92
93   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
94   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
95   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
96   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER
97   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
98   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
99   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
100   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
101   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
102   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
103   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
104)))))
105
106(if (eggdoc->html doc) (void))
Note: See TracBrowser for help on using the repository browser.