compiler.cfg.stacks.height: removing vocab

It was so small so better to put the words it contained in the vocabs
where they are used.
char-rename
Björn Lindqvist 2016-08-26 11:06:17 +02:00
parent ebdf57d175
commit e8e1811542
9 changed files with 39 additions and 49 deletions

View File

@ -1,4 +1,6 @@
USING: accessors compiler.cfg.instructions compiler.cfg.stacks.finalize USING: accessors compiler.cfg compiler.cfg.instructions
compiler.cfg.registers compiler.cfg.stacks
compiler.cfg.stacks.finalize compiler.cfg.stacks.local
compiler.cfg.utilities kernel sequences tools.test ; compiler.cfg.utilities kernel sequences tools.test ;
IN: compiler.cfg.stacks.finalize.tests IN: compiler.cfg.stacks.finalize.tests
@ -11,3 +13,14 @@ IN: compiler.cfg.stacks.finalize.tests
[ successors>> first instructions>> first ] [ successors>> first instructions>> first ]
[ predecessors>> first instructions>> first ] bi* [ predecessors>> first instructions>> first ] bi*
] unit-test ] unit-test
{
T{ ds-loc f 4 }
T{ rs-loc f 5 }
} [
begin-stack-analysis
3 4 T{ basic-block }
[ record-stack-heights ]
[ D: 1 swap untranslate-loc ]
[ R: 1 swap untranslate-loc ] tri
] unit-test

View File

@ -1,12 +1,18 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs compiler.cfg.checker compiler.cfg USING: accessors compiler.cfg compiler.cfg.instructions
compiler.cfg.instructions compiler.cfg.predecessors compiler.cfg.rpo compiler.cfg.registers compiler.cfg.rpo compiler.cfg.stacks.global
compiler.cfg.stacks.global compiler.cfg.stacks.height compiler.cfg.stacks.local compiler.cfg.utilities fry kernel locals
compiler.cfg.stacks.local compiler.cfg.utilities fry kernel make math sequences sets ;
locals make math sequences sets ;
IN: compiler.cfg.stacks.finalize IN: compiler.cfg.stacks.finalize
GENERIC# untranslate-loc 1 ( loc bb -- loc' )
M: ds-loc untranslate-loc ( loc bb -- loc' )
[ n>> ] [ ds-height>> ] bi* + <ds-loc> ;
M: rs-loc untranslate-loc ( loc bb -- loc' )
[ n>> ] [ rs-height>> ] bi* + <rs-loc> ;
:: inserting-peeks ( from to -- set ) :: inserting-peeks ( from to -- set )
to anticip-in to anticip-in
from anticip-out from avail-out union from anticip-out from avail-out union

View File

@ -1,6 +0,0 @@
USING: compiler.cfg compiler.cfg.registers help.markup help.syntax math ;
IN: compiler.cfg.stacks.height
HELP: record-stack-heights
{ $values { "ds-height" number } { "rs-height" number } { "bb" basic-block } }
{ $description "Sets the data and retain stack heights in relation to the cfg of this basic block." } ;

View File

@ -1,14 +0,0 @@
USING: accessors assocs combinators compiler.cfg compiler.cfg.registers
compiler.cfg.stacks compiler.cfg.stacks.height kernel tools.test ;
IN: compiler.cfg.stacks.height.tests
{
T{ ds-loc f 4 }
T{ rs-loc f 5 }
} [
begin-stack-analysis
3 4 T{ basic-block }
[ record-stack-heights ]
[ D: 1 swap untranslate-loc ]
[ R: 1 swap untranslate-loc ] tri
] unit-test

View File

@ -1,14 +0,0 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors compiler.cfg.registers kernel math ;
IN: compiler.cfg.stacks.height
: record-stack-heights ( ds-height rs-height bb -- )
[ rs-height<< ] keep ds-height<< ;
GENERIC# untranslate-loc 1 ( loc bb -- loc' )
M: ds-loc untranslate-loc ( loc bb -- loc' )
[ n>> ] [ ds-height>> ] bi* + <ds-loc> ;
M: rs-loc untranslate-loc ( loc bb -- loc' )
[ n>> ] [ rs-height>> ] bi* + <rs-loc> ;

View File

@ -54,6 +54,10 @@ HELP: peek-loc
{ $values { "loc" loc } { "vreg" "virtual register" } } { $values { "loc" loc } { "vreg" "virtual register" } }
{ $description "Retrieves the virtual register at the given stack location. If no register has been stored at that location, then a new vreg is returned." } ; { $description "Retrieves the virtual register at the given stack location. If no register has been stored at that location, then a new vreg is returned." } ;
HELP: record-stack-heights
{ $values { "ds-height" number } { "rs-height" number } { "bb" basic-block } }
{ $description "Sets the data and retain stack heights in relation to the cfg of this basic block." } ;
HELP: replace-loc HELP: replace-loc
{ $values { "vreg" "virtual register" } { "loc" loc } } { $values { "vreg" "virtual register" } { "loc" loc } }
{ $description "Registers that the absolute stack location " { $snippet "loc" } " should be overwritten with the contents of the virtual register." } { $description "Registers that the absolute stack location " { $snippet "loc" } " should be overwritten with the contents of the virtual register." }

View File

@ -1,8 +1,7 @@
USING: assocs compiler.cfg.instructions compiler.cfg.registers USING: assocs compiler.cfg.instructions compiler.cfg.registers
compiler.cfg.stacks.height compiler.cfg.stacks.local compiler.cfg.stacks.local compiler.cfg.utilities compiler.test
compiler.cfg.utilities compiler.test cpu.architecture kernel cpu.architecture kernel kernel.private make math namespaces
kernel.private make math namespaces sequences.private slots.private sequences.private slots.private tools.test ;
tools.test ;
QUALIFIED: sets QUALIFIED: sets
IN: compiler.cfg.stacks.local.tests IN: compiler.cfg.stacks.local.tests

View File

@ -1,9 +1,8 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs compiler.cfg.instructions USING: accessors assocs compiler.cfg.instructions
compiler.cfg.parallel-copy compiler.cfg.registers compiler.cfg.parallel-copy compiler.cfg.registers hash-sets kernel
compiler.cfg.stacks.height hash-sets kernel make math math.order make math math.order namespaces sequences sets ;
namespaces sequences sets ;
IN: compiler.cfg.stacks.local IN: compiler.cfg.stacks.local
: current-height ( state -- ds rs ) : current-height ( state -- ds rs )
@ -68,6 +67,9 @@ SYMBOLS: local-peek-set replaces ;
: replace-loc ( vreg loc -- ) : replace-loc ( vreg loc -- )
height-state get translate-local-loc replaces get set-at ; height-state get translate-local-loc replaces get set-at ;
: record-stack-heights ( ds-height rs-height bb -- )
[ rs-height<< ] keep ds-height<< ;
: compute-local-kill-set ( basic-block -- set ) : compute-local-kill-set ( basic-block -- set )
[ ds-height>> ] [ rs-height>> ] bi height-state get local-kill-set ; [ ds-height>> ] [ rs-height>> ] bi height-state get local-kill-set ;

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors biassocs compiler.cfg.registers USING: accessors biassocs compiler.cfg.registers
compiler.cfg.stacks.finalize compiler.cfg.stacks.global compiler.cfg.stacks.finalize compiler.cfg.stacks.global
compiler.cfg.stacks.height compiler.cfg.stacks.local compiler.cfg.stacks.local compiler.cfg.utilities kernel math
compiler.cfg.utilities kernel math namespaces sequences ; namespaces sequences ;
IN: compiler.cfg.stacks IN: compiler.cfg.stacks
: begin-stack-analysis ( -- ) : begin-stack-analysis ( -- )