compiler.tree.dead-code.simple: tests and more docs

locals-and-roots
Björn Lindqvist 2016-03-18 11:23:20 +01:00
parent baae677276
commit 6576660069
2 changed files with 28 additions and 1 deletions

View File

@ -1,6 +1,10 @@
USING: compiler.tree help.markup help.syntax sequences ;
USING: compiler.tree help.markup help.syntax kernel sequences ;
IN: compiler.tree.dead-code.simple
HELP: dead-flushable-call?
{ $values { "#call" #call } { "?" boolean } }
{ $description { $link t } " if the called word is flushable and none of its outputs are used." } ;
HELP: filter-corresponding
{ $values { "new" sequence } { "old" sequence } { "old'" sequence } }
{ $description "Remove elements from 'old' if the element with the same index in 'new' is dead." } ;

View File

@ -0,0 +1,23 @@
USING: accessors compiler.tree compiler.tree.dead-code.liveness
compiler.tree.dead-code.simple kernel math namespaces tools.test ;
IN: compiler.tree.dead-code.simple.tests
! dead-flushable-call?
{ t } [
{ } { } \ + <#call> dead-flushable-call?
] unit-test
{ f t } [
H{ { 3 t } } live-values set
{ 1 2 } { 3 } \ + <#call> dead-flushable-call?
{ 1 2 } { 77 } \ + <#call> dead-flushable-call?
] unit-test
{
f
"foo" { 3 }
} [
H{ { 3 t } } live-values set
"foo" 9 <#push> remove-dead-code*
"foo" 3 <#push> remove-dead-code* [ literal>> ] [ out-d>> ] bi
] unit-test