compiler.cfg.*: the make-kill-block word is not needed
parent
5ca571e304
commit
f906f1c282
|
@ -70,10 +70,6 @@ HELP: end-branch
|
||||||
{ $values { "block" basic-block } { "pair/f" "two-tuple" } }
|
{ $values { "block" basic-block } { "pair/f" "two-tuple" } }
|
||||||
{ $description "pair is { final-bb final-height }" } ;
|
{ $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
|
HELP: set-basic-block
|
||||||
{ $values { "basic-block" 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." } ;
|
{ $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." } ;
|
||||||
|
|
|
@ -33,11 +33,6 @@ IN: compiler.cfg.builder.blocks.tests
|
||||||
<basic-block> dup set-basic-block ##branch, end-basic-block
|
<basic-block> dup set-basic-block ##branch, end-basic-block
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! make-kill-block
|
|
||||||
{ t } [
|
|
||||||
<basic-block> [ make-kill-block ] keep kill-block?>>
|
|
||||||
] unit-test
|
|
||||||
|
|
||||||
{
|
{
|
||||||
{ "succ" "succ" "succ" }
|
{ "succ" "succ" "succ" }
|
||||||
} [
|
} [
|
||||||
|
|
|
@ -22,14 +22,11 @@ IN: compiler.cfg.builder.blocks
|
||||||
[ swap call ] keep
|
[ swap call ] keep
|
||||||
##branch, begin-basic-block ; inline
|
##branch, begin-basic-block ; inline
|
||||||
|
|
||||||
: make-kill-block ( block -- )
|
|
||||||
t swap kill-block?<< ;
|
|
||||||
|
|
||||||
: call-height ( #call -- n )
|
: call-height ( #call -- n )
|
||||||
[ out-d>> length ] [ in-d>> length ] bi - ;
|
[ out-d>> length ] [ in-d>> length ] bi - ;
|
||||||
|
|
||||||
: emit-call-block ( word height block -- )
|
: 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' )
|
: emit-trivial-call ( block word height -- block' )
|
||||||
rot [ emit-call-block ] emit-trivial-block ;
|
rot [ emit-call-block ] emit-trivial-block ;
|
||||||
|
|
|
@ -37,7 +37,7 @@ GENERIC: emit-node ( block node -- block' )
|
||||||
[ over [ emit-node ] [ drop ] if ] each ;
|
[ over [ emit-node ] [ drop ] if ] each ;
|
||||||
|
|
||||||
: begin-word ( block -- block' )
|
: begin-word ( block -- block' )
|
||||||
dup make-kill-block
|
t >>kill-block?
|
||||||
##safepoint, ##prologue, ##branch,
|
##safepoint, ##prologue, ##branch,
|
||||||
begin-basic-block ;
|
begin-basic-block ;
|
||||||
|
|
||||||
|
@ -165,10 +165,8 @@ M: #shuffle emit-node ( block node -- block' )
|
||||||
! #return
|
! #return
|
||||||
: end-word ( block -- block' )
|
: end-word ( block -- block' )
|
||||||
##branch, begin-basic-block
|
##branch, begin-basic-block
|
||||||
dup make-kill-block
|
t >>kill-block?
|
||||||
##safepoint,
|
##safepoint, ##epilogue, ##return, ;
|
||||||
##epilogue,
|
|
||||||
##return, ;
|
|
||||||
|
|
||||||
M: #return emit-node ( block node -- block' )
|
M: #return emit-node ( block node -- block' )
|
||||||
drop end-word ;
|
drop end-word ;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
USING: compiler.cfg.instructions compiler.cfg.rpo
|
USING: compiler.cfg.instructions compiler.cfg.rpo
|
||||||
compiler.cfg.stack-frame compiler.tree help.markup help.syntax math
|
compiler.cfg.stack-frame compiler.tree help.markup help.syntax kernel
|
||||||
namespaces sequences vectors words ;
|
math namespaces sequences vectors words ;
|
||||||
IN: compiler.cfg
|
IN: compiler.cfg
|
||||||
|
|
||||||
HELP: basic-block
|
HELP: basic-block
|
||||||
{ $class-description
|
{ $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
|
{ $table
|
||||||
{ { $slot "number" } { "The blocks sequence number. Generated by calling " { $link number-blocks } ". " } }
|
{ { $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 "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 "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 "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: <basic-block>
|
HELP: <basic-block>
|
||||||
{ $values { "bb" basic-block } }
|
{ $values { "bb" basic-block } }
|
||||||
|
|
Loading…
Reference in New Issue