]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/ssa/destruction/destruction-docs.factor
compiler.cfg.ssa.destruction: try and sort the vreg pairs before
[factor.git] / basis / compiler / cfg / ssa / destruction / destruction-docs.factor
1 USING: compiler.cfg compiler.cfg.instructions
2 compiler.cfg.ssa.destruction.private compiler.cfg.ssa.interference help.markup
3 help.syntax kernel sequences ;
4 IN: compiler.cfg.ssa.destruction
5
6 HELP: class-element-map
7 { $var-description "Maps leaders to equivalence class elements which are sequences of " { $link vreg-info } " instances." } ;
8
9 HELP: cleanup-cfg
10 { $values { "cfg" cfg } }
11 { $description "In this step, " { $link ##parallel-copy } " instructions are substituted with more concreete " { $link ##copy } " instructions. " { $link ##phi } " instructions are removed here." } ;
12
13 HELP: coalesce-elements
14 { $values { "merged" "??" } { "follower" "vreg" } { "leader" "vreg" } }
15 { $description "Delete follower's class, and set leaders's class to merged." } ;
16
17 HELP: coalesce-vregs
18 { $values { "merged" "??" } { "follower" "vreg" } { "leader" "vreg" } }
19 { $description "Sets 'leader' as the leader of 'follower'." } ;
20
21 HELP: copies
22 { $var-description "Sequence of copies (tuples of { vreg-dst vreg-src}) that maybe can be eliminated later." }
23 { $see-also init-coalescing } ;
24
25 HELP: try-eliminate-copy
26 { $values { "follower" "vreg" } { "leader" "vreg" } { "must?" boolean } }
27 { $description "Tries to eliminate a vreg copy from 'leader' to 'follower'. If 'must?' is " { $link t } " then a " { $link vregs-shouldn't-interfere } " error is thrown if the vregs interfere." }
28 { $see-also try-eliminate-copies vregs-interfere? } ;
29
30 HELP: try-eliminate-copies
31 { $values { "pairs" "a sequence of vreg pairs" } { "must?" boolean } }
32 { $description "Tries to eliminate the vreg copies in the " { $link sequence } " 'pairs'. If 'must?' is " { $link t } " then a " { $link vregs-shouldn't-interfere } " error is thrown if any of the vregs interfere. To ensure deterministic " { $link leader-map } " data, the pairs are sorted." }
33 { $see-also try-eliminate-copy } ;
34
35 ARTICLE: "compiler.cfg.ssa.destruction" "SSA Destruction"
36 "Because of the design of the register allocator, this pass has three peculiar properties."
37 { $list
38   "Instead of renaming vreg usages in the CFG, a map from vregs to canonical representatives is computed. This allows the register allocator to use the original SSA names to get reaching definitions."
39   { "Useless " { $link ##copy } " instructions, and all " { $link ##phi } " instructions, are eliminated, so the register allocator does not have to remove any redundant operations." }
40   { "This pass computes live sets and fills out the " { $slot "gc-roots" } " slots of GC maps with " { $vocab-link "compiler.cfg.liveness" } ", so the linear scan register allocator does not need to compute liveness again." }
41 }
42 $nl
43 "Main entry point:"
44 { $subsections destruct-ssa } ;
45
46 ABOUT: "compiler.cfg.ssa.destruction"