diff --git a/basis/compiler/cfg/builder/blocks/blocks-docs.factor b/basis/compiler/cfg/builder/blocks/blocks-docs.factor index d096f7b85f..08d92c51bd 100644 --- a/basis/compiler/cfg/builder/blocks/blocks-docs.factor +++ b/basis/compiler/cfg/builder/blocks/blocks-docs.factor @@ -70,10 +70,6 @@ HELP: end-branch { $values { "block" basic-block } { "pair/f" "two-tuple" } } { $description "pair is { final-bb final-height }" } ; -HELP: make-kill-block -{ $values { "block" basic-block } } -{ $description "Marks the block as a kill block." } ; - HELP: set-basic-block { $values { "basic-block" basic-block } } { $description "Sets the given blocks as the current one by storing it in the basic-block dynamic variable. If it has any " { $slot "instructions" } " the current " { $link building } " is set to those." } ; diff --git a/basis/compiler/cfg/builder/blocks/blocks-tests.factor b/basis/compiler/cfg/builder/blocks/blocks-tests.factor index 4cedac47a2..00e5a14078 100644 --- a/basis/compiler/cfg/builder/blocks/blocks-tests.factor +++ b/basis/compiler/cfg/builder/blocks/blocks-tests.factor @@ -33,11 +33,6 @@ IN: compiler.cfg.builder.blocks.tests dup set-basic-block ##branch, end-basic-block ] unit-test -! make-kill-block -{ t } [ - [ make-kill-block ] keep kill-block?>> -] unit-test - { { "succ" "succ" "succ" } } [ diff --git a/basis/compiler/cfg/builder/blocks/blocks.factor b/basis/compiler/cfg/builder/blocks/blocks.factor index e3d3006ba5..1cf3fc76d4 100644 --- a/basis/compiler/cfg/builder/blocks/blocks.factor +++ b/basis/compiler/cfg/builder/blocks/blocks.factor @@ -22,14 +22,11 @@ IN: compiler.cfg.builder.blocks [ swap call ] keep ##branch, begin-basic-block ; inline -: make-kill-block ( block -- ) - t swap kill-block?<< ; - : call-height ( #call -- n ) [ out-d>> length ] [ in-d>> length ] bi - ; : emit-call-block ( word height block -- ) - make-kill-block adjust-d ##call, ; + t swap kill-block?<< adjust-d ##call, ; : emit-trivial-call ( block word height -- block' ) rot [ emit-call-block ] emit-trivial-block ; diff --git a/basis/compiler/cfg/builder/builder.factor b/basis/compiler/cfg/builder/builder.factor index 99c43be3c6..66a1e25d62 100644 --- a/basis/compiler/cfg/builder/builder.factor +++ b/basis/compiler/cfg/builder/builder.factor @@ -37,7 +37,7 @@ GENERIC: emit-node ( block node -- block' ) [ over [ emit-node ] [ drop ] if ] each ; : begin-word ( block -- block' ) - dup make-kill-block + t >>kill-block? ##safepoint, ##prologue, ##branch, begin-basic-block ; @@ -165,10 +165,8 @@ M: #shuffle emit-node ( block node -- block' ) ! #return : end-word ( block -- block' ) ##branch, begin-basic-block - dup make-kill-block - ##safepoint, - ##epilogue, - ##return, ; + t >>kill-block? + ##safepoint, ##epilogue, ##return, ; M: #return emit-node ( block node -- block' ) drop end-word ; diff --git a/basis/compiler/cfg/cfg-docs.factor b/basis/compiler/cfg/cfg-docs.factor index 1ec7a366ef..33db978d4e 100644 --- a/basis/compiler/cfg/cfg-docs.factor +++ b/basis/compiler/cfg/cfg-docs.factor @@ -1,19 +1,20 @@ USING: compiler.cfg.instructions compiler.cfg.rpo -compiler.cfg.stack-frame compiler.tree help.markup help.syntax math -namespaces sequences vectors words ; +compiler.cfg.stack-frame compiler.tree help.markup help.syntax kernel +math namespaces sequences vectors words ; IN: compiler.cfg HELP: basic-block { $class-description - "Factors representation of a basic block in the Call Flow Graph (CFG). A basic block is a sequence of instructions that always are executed sequentially and doesn't contain any branching. It has the following slots:" + "Factors representation of a basic block in the Call Flow Graph (CFG). A basic block is a sequence of instructions that always are executed sequentially and doesn't contain any internal branching. It has the following slots:" { $table { { $slot "number" } { "The blocks sequence number. Generated by calling " { $link number-blocks } ". " } } { { $slot "successors" } { "A " { $link vector } " of basic blocks that may be executed directly after this block. Most blocks only have one successor but a block that checks where an if-condition should branch to would have two for example." } } { { $slot "predecessors" } { "The opposite of successors -- a " { $link vector } " of basic blocks from which the execution may have arrived into this block." } } { { $slot "instructions" } { "A " { $link vector } " of " { $link insn } " tuples which form the instructions of the basic block." } } - { { $slot "kill-block?" } { "The first and the last block in a cfg and all blocks containing " { $link ##call } " instructions are kill blocks." } } + { { $slot "kill-block?" } { "The first and the last block in a cfg and all blocks containing " { $link ##call } " instructions are kill blocks. Kill blocks can't be optimized so they are omitted from certain optimization steps." } } } -} ; +} +{ $notes "A basic-block is an " { $link identity-tuple } " becase it is used as a hash table key by the compiler." } ; HELP: { $values { "bb" basic-block } }