compiler.cfg.stacks.finalize: initial docs

db4
Björn Lindqvist 2014-12-18 17:12:41 +01:00
parent 3515a45b84
commit e968c16139
2 changed files with 28 additions and 10 deletions

View File

@ -0,0 +1,28 @@
USING: assocs compiler.cfg help.markup help.syntax ;
IN: compiler.cfg.stacks.finalize
HELP: inserting-peeks
{ $values { "from" basic-block } { "to" basic-block } { "assoc" assoc } }
{ $description
"A peek is inserted on an edge if the destination anticipates the stack location, the source does not anticipate it and it is not available from the source in a register." } ;
HELP: inserting-replaces
{ $values { "from" basic-block } { "to" basic-block } { "assoc" assoc } }
{ $description
"A replace is inserted on an edge if two conditions hold:"
{ $list
"the location is not dead at the destination, OR the location is live at the destination but not available at the destination."
"the location is pending in the source but not the destination"
}
} ;
{ inserting-replaces inserting-peeks } related-words
HELP: finalize-stack-shuffling
{ $values { "cfg" cfg } }
{ $description "Called to end the stack analysis." } ;
ARTICLE: "compiler.cfg.stacks.finalize" "Stack finalization"
"This pass inserts peeks and replaces." ;
ABOUT: "compiler.cfg.stacks.finalize"

View File

@ -7,22 +7,12 @@ compiler.cfg.stacks.local compiler.cfg.utilities fry kernel
locals make math sequences ;
IN: compiler.cfg.stacks.finalize
! This pass inserts peeks and replaces.
:: inserting-peeks ( from to -- assoc )
! A peek is inserted on an edge if the destination anticipates
! the stack location, the source does not anticipate it and
! it is not available from the source in a register.
to anticip-in
from anticip-out from avail-out assoc-union
assoc-diff ;
:: inserting-replaces ( from to -- assoc )
! A replace is inserted on an edge if two conditions hold:
! - the location is not dead at the destination, OR
! the location is live at the destination but not available
! at the destination
! - the location is pending in the source but not the destination
from pending-out to pending-in assoc-diff
to dead-in to live-in to anticip-in assoc-diff assoc-diff
assoc-diff ;