From 054982f24a25fb840a48c99c107824bd8f9273e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Wed, 10 Dec 2014 16:51:53 +0100 Subject: [PATCH] compiler.cfg.*: docs for compiler.cfg.dominance and compiler.cfg.ssa.construction --- .../cfg/dominance/dominance-docs.factor | 20 +++++++++++++ basis/compiler/cfg/dominance/dominance.factor | 11 ------- .../ssa/construction/construction-docs.factor | 29 +++++++++++++++++++ .../cfg/ssa/construction/construction.factor | 20 ------------- 4 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 basis/compiler/cfg/dominance/dominance-docs.factor create mode 100644 basis/compiler/cfg/ssa/construction/construction-docs.factor diff --git a/basis/compiler/cfg/dominance/dominance-docs.factor b/basis/compiler/cfg/dominance/dominance-docs.factor new file mode 100644 index 0000000000..9a72ae6539 --- /dev/null +++ b/basis/compiler/cfg/dominance/dominance-docs.factor @@ -0,0 +1,20 @@ +USING: compiler.cfg compiler.cfg.dominance.private help.markup help.syntax +sequences ; +IN: compiler.cfg.dominance + +HELP: dom-parents +{ $var-description "Maps bb -> idom(bb)" } ; + +HELP: dom-children +{ $values { "bb" basic-block } { "seq" sequence } } +{ $description "Maps bb -> {bb' | idom(bb') = bb}" } ; + +ARTICLE: "compiler.cfg.dominance" "A Simple, Fast Dominance Algorithm" $nl +"A Simple, Fast Dominance Algorithm" $nl +"Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy" $nl +"http://www.cs.rice.edu/~keith/EMBED/dom.pdf" +$nl +"Also, a nice overview is given in these lecture notes:" $nl +"http://llvm.cs.uiuc.edu/~vadve/CS526/public_html/Notes/4ssa.4up.pdf" ; + +ABOUT: "compiler.cfg.dominance" diff --git a/basis/compiler/cfg/dominance/dominance.factor b/basis/compiler/cfg/dominance/dominance.factor index 71dc12f6a1..7a4f83ad2d 100644 --- a/basis/compiler/cfg/dominance/dominance.factor +++ b/basis/compiler/cfg/dominance/dominance.factor @@ -6,18 +6,8 @@ compiler.cfg.rpo compiler.cfg.predecessors ; FROM: namespaces => set ; IN: compiler.cfg.dominance -! Reference: - -! A Simple, Fast Dominance Algorithm -! Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy -! http://www.cs.rice.edu/~keith/EMBED/dom.pdf - -! Also, a nice overview is given in these lecture notes: -! http://llvm.cs.uiuc.edu/~vadve/CS526/public_html/Notes/4ssa.4up.pdf - idom(bb) SYMBOL: dom-parents PRIVATE> @@ -48,7 +38,6 @@ PRIVATE> reverse-post-order unclip dup set-idom drop '[ _ iterate ] loop ; -! Maps bb -> {bb' | idom(bb') = bb} SYMBOL: dom-childrens PRIVATE> diff --git a/basis/compiler/cfg/ssa/construction/construction-docs.factor b/basis/compiler/cfg/ssa/construction/construction-docs.factor new file mode 100644 index 0000000000..16fa879e71 --- /dev/null +++ b/basis/compiler/cfg/ssa/construction/construction-docs.factor @@ -0,0 +1,29 @@ +USING: compiler.cfg.instructions compiler.cfg.ssa.construction.private +help.markup help.syntax ; +IN: compiler.cfg.ssa.construction + +HELP: phis +{ $var-description "Maps vregs to " { $link ##phi } " instructions." } ; + +HELP: used-vregs +{ $var-description "Worklist of used vregs, to calculate used phis." } ; + +HELP: defs +{ $var-description "Maps vregs to sets of basic blocks." } ; + +HELP: defs-multi +{ $var-description "Set of vregs defined in more than one basic block." } ; + +HELP: inserting-phis +{ $var-description "Maps basic blocks to sequences of " { $link ##phi } " instructions." } ; + +ARTICLE: "compiler.cfg.ssa.construction" "SSA construction" +"Iterated dominance frontiers are computed using the DJ Graph method in " { $vocab-link "compiler.cfg.ssa.construction.tdmsc" } "." +$nl +"The renaming algorithm is based on \"Practical Improvements to the Construction and Destruction of Static Single Assignment Form\"." +$nl +"We construct pruned SSA without computing live sets, by building a dependency graph for phi instructions, marking the transitive closure of a vertex as live if it is referenced by some non-phi instruction. Thanks to Cameron Zwarich for the trick." +$nl +"http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.49.9683" ; + +ABOUT: "compiler.cfg.ssa.construction" diff --git a/basis/compiler/cfg/ssa/construction/construction.factor b/basis/compiler/cfg/ssa/construction/construction.factor index 111cc7fc0d..9c32e92377 100644 --- a/basis/compiler/cfg/ssa/construction/construction.factor +++ b/basis/compiler/cfg/ssa/construction/construction.factor @@ -15,27 +15,10 @@ FROM: assocs => change-at ; FROM: namespaces => set ; IN: compiler.cfg.ssa.construction -! Iterated dominance frontiers are computed using the DJ Graph -! method in compiler.cfg.ssa.construction.tdmsc. - -! The renaming algorithm is based on "Practical Improvements to -! the Construction and Destruction of Static Single Assignment -! Form". - -! We construct pruned SSA without computing live sets, by -! building a dependency graph for phi instructions, marking the -! transitive closure of a vertex as live if it is referenced by -! some non-phi instruction. Thanks to Cameron Zwarich for the -! trick. - -! http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.49.9683 -