compiler.cfg.ssa.cssa, compiler.cfg.ssa.destruction, compiler.utilities: docs & tests

db4
Björn Lindqvist 2015-04-18 13:08:09 +02:00 committed by John Benediktsson
parent 16f6025979
commit 63a1e90af8
6 changed files with 35 additions and 18 deletions

View File

@ -0,0 +1,7 @@
USING: compiler.cfg.representations help.markup help.syntax ;
IN: compiler.cfg.ssa.cssa
ARTICLE: "compiler.cfg.ssa.cssa" "Conventional SSA Form"
"Convert SSA to conventional SSA. This pass runs after representation selection (see " { $link select-representations } "), so it must keep track of representations when introducing new values." ;
ABOUT: "compiler.cfg.ssa.cssa"

View File

@ -7,10 +7,6 @@ namespaces sequences ;
FROM: assocs => change-at ;
IN: compiler.cfg.ssa.cssa
! Convert SSA to conventional SSA. This pass runs after representation
! selection, so it must keep track of representations when introducing
! new values.
SYMBOLS: edge-copies phi-copies ;
: init-copies ( bb -- )

View File

@ -0,0 +1,12 @@
USING: compiler.cfg.instructions help.markup help.syntax ;
IN: compiler.cfg.ssa.destruction
ARTICLE: "compiler.cfg.ssa.destruction" "SSA Destruction"
"Because of the design of the register allocator, this pass has three peculiar properties."
{ $list
"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."
{ "Useless " { $link ##copy } " instructions, and all " { $link ##phi } " instructions, are eliminated, so the register allocator does not have to remove any redundant operations." }
{ "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." }
} ;
ABOUT: "compiler.cfg.ssa.destruction"

View File

@ -11,20 +11,6 @@ kernel locals make namespaces sequences sets ;
FROM: namespaces => set ;
IN: compiler.cfg.ssa.destruction
! Because of the design of the register allocator, this pass
! has three peculiar properties.
!
! 1) 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.
! 2) Useless ##copy instructions, and all ##phi instructions,
! are eliminated, so the register allocator does not have to
! remove any redundant operations.
! 3) This pass computes live sets and fills out GC maps with
! compiler.cfg.liveness, so the linear scan register allocator
! does not need to compute liveness again.
! Maps leaders to equivalence class elements.
SYMBOL: class-element-map

View File

@ -0,0 +1,7 @@
USING: assocs compiler.cfg.ssa.destruction.leaders help.markup help.syntax math
sequences ;
IN: compiler.utilities
HELP: compress-path
{ $values { "source" integer } { "assoc" assoc } { "destination" integer } }
{ $description "Gets the original definer for a vreg number. Then inserts a direct path from 'source' to that definer. For example if the assoc is " { $code "{ { 1 2 } { 2 3 } { 3 4 } { 4 4 } }" } "then the original definer of 1 is 4. The word is used by " { $link leader } " to figure out what the top leader of a vreg is." } ;

View File

@ -0,0 +1,9 @@
USING: compiler.utilities kernel tools.test ;
IN: compiler.utilities.tests
{
9
H{ { 9 9 } { 44 9 } { 7 9 } }
} [
7 H{ { 7 44 } { 44 9 } { 9 9 } } [ compress-path ] keep
] unit-test