From e8e1811542ccb4797478e364735de2f6d325380a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 26 Aug 2016 11:06:17 +0200 Subject: [PATCH] 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. --- .../cfg/stacks/finalize/finalize-tests.factor | 15 ++++++++++++++- .../compiler/cfg/stacks/finalize/finalize.factor | 16 +++++++++++----- .../cfg/stacks/height/height-docs.factor | 6 ------ .../cfg/stacks/height/height-tests.factor | 14 -------------- basis/compiler/cfg/stacks/height/height.factor | 14 -------------- .../compiler/cfg/stacks/local/local-docs.factor | 4 ++++ .../compiler/cfg/stacks/local/local-tests.factor | 7 +++---- basis/compiler/cfg/stacks/local/local.factor | 8 +++++--- basis/compiler/cfg/stacks/stacks.factor | 4 ++-- 9 files changed, 39 insertions(+), 49 deletions(-) delete mode 100644 basis/compiler/cfg/stacks/height/height-docs.factor delete mode 100644 basis/compiler/cfg/stacks/height/height-tests.factor delete mode 100644 basis/compiler/cfg/stacks/height/height.factor diff --git a/basis/compiler/cfg/stacks/finalize/finalize-tests.factor b/basis/compiler/cfg/stacks/finalize/finalize-tests.factor index 7bde72221e..4d50f62315 100644 --- a/basis/compiler/cfg/stacks/finalize/finalize-tests.factor +++ b/basis/compiler/cfg/stacks/finalize/finalize-tests.factor @@ -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 ; IN: compiler.cfg.stacks.finalize.tests @@ -11,3 +13,14 @@ IN: compiler.cfg.stacks.finalize.tests [ successors>> first instructions>> first ] [ predecessors>> first instructions>> first ] bi* ] 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 diff --git a/basis/compiler/cfg/stacks/finalize/finalize.factor b/basis/compiler/cfg/stacks/finalize/finalize.factor index d1ef80de68..dffb7682d3 100644 --- a/basis/compiler/cfg/stacks/finalize/finalize.factor +++ b/basis/compiler/cfg/stacks/finalize/finalize.factor @@ -1,12 +1,18 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs compiler.cfg.checker compiler.cfg -compiler.cfg.instructions compiler.cfg.predecessors compiler.cfg.rpo -compiler.cfg.stacks.global compiler.cfg.stacks.height -compiler.cfg.stacks.local compiler.cfg.utilities fry kernel -locals make math sequences sets ; +USING: accessors compiler.cfg compiler.cfg.instructions +compiler.cfg.registers compiler.cfg.rpo compiler.cfg.stacks.global +compiler.cfg.stacks.local compiler.cfg.utilities fry kernel locals +make math sequences sets ; IN: compiler.cfg.stacks.finalize +GENERIC# untranslate-loc 1 ( loc bb -- loc' ) + +M: ds-loc untranslate-loc ( loc bb -- loc' ) + [ n>> ] [ ds-height>> ] bi* + ; +M: rs-loc untranslate-loc ( loc bb -- loc' ) + [ n>> ] [ rs-height>> ] bi* + ; + :: inserting-peeks ( from to -- set ) to anticip-in from anticip-out from avail-out union diff --git a/basis/compiler/cfg/stacks/height/height-docs.factor b/basis/compiler/cfg/stacks/height/height-docs.factor deleted file mode 100644 index dd78c9d5b2..0000000000 --- a/basis/compiler/cfg/stacks/height/height-docs.factor +++ /dev/null @@ -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." } ; diff --git a/basis/compiler/cfg/stacks/height/height-tests.factor b/basis/compiler/cfg/stacks/height/height-tests.factor deleted file mode 100644 index 0cee683270..0000000000 --- a/basis/compiler/cfg/stacks/height/height-tests.factor +++ /dev/null @@ -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 diff --git a/basis/compiler/cfg/stacks/height/height.factor b/basis/compiler/cfg/stacks/height/height.factor deleted file mode 100644 index cc1d4f86be..0000000000 --- a/basis/compiler/cfg/stacks/height/height.factor +++ /dev/null @@ -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* + ; -M: rs-loc untranslate-loc ( loc bb -- loc' ) - [ n>> ] [ rs-height>> ] bi* + ; diff --git a/basis/compiler/cfg/stacks/local/local-docs.factor b/basis/compiler/cfg/stacks/local/local-docs.factor index 5d25915440..0d96d50379 100644 --- a/basis/compiler/cfg/stacks/local/local-docs.factor +++ b/basis/compiler/cfg/stacks/local/local-docs.factor @@ -54,6 +54,10 @@ HELP: peek-loc { $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." } ; +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 { $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." } diff --git a/basis/compiler/cfg/stacks/local/local-tests.factor b/basis/compiler/cfg/stacks/local/local-tests.factor index f2af8fe46d..8ef7e3dfcf 100644 --- a/basis/compiler/cfg/stacks/local/local-tests.factor +++ b/basis/compiler/cfg/stacks/local/local-tests.factor @@ -1,8 +1,7 @@ USING: assocs compiler.cfg.instructions compiler.cfg.registers -compiler.cfg.stacks.height compiler.cfg.stacks.local -compiler.cfg.utilities compiler.test cpu.architecture kernel -kernel.private make math namespaces sequences.private slots.private -tools.test ; +compiler.cfg.stacks.local compiler.cfg.utilities compiler.test +cpu.architecture kernel kernel.private make math namespaces +sequences.private slots.private tools.test ; QUALIFIED: sets IN: compiler.cfg.stacks.local.tests diff --git a/basis/compiler/cfg/stacks/local/local.factor b/basis/compiler/cfg/stacks/local/local.factor index 2b6dade464..203d3cb6fc 100644 --- a/basis/compiler/cfg/stacks/local/local.factor +++ b/basis/compiler/cfg/stacks/local/local.factor @@ -1,9 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs compiler.cfg.instructions -compiler.cfg.parallel-copy compiler.cfg.registers -compiler.cfg.stacks.height hash-sets kernel make math math.order -namespaces sequences sets ; +compiler.cfg.parallel-copy compiler.cfg.registers hash-sets kernel +make math math.order namespaces sequences sets ; IN: compiler.cfg.stacks.local : current-height ( state -- ds rs ) @@ -68,6 +67,9 @@ SYMBOLS: local-peek-set replaces ; : replace-loc ( vreg loc -- ) 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 ) [ ds-height>> ] [ rs-height>> ] bi height-state get local-kill-set ; diff --git a/basis/compiler/cfg/stacks/stacks.factor b/basis/compiler/cfg/stacks/stacks.factor index 5a2d94677b..cac9401cd4 100644 --- a/basis/compiler/cfg/stacks/stacks.factor +++ b/basis/compiler/cfg/stacks/stacks.factor @@ -2,8 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors biassocs compiler.cfg.registers compiler.cfg.stacks.finalize compiler.cfg.stacks.global -compiler.cfg.stacks.height compiler.cfg.stacks.local -compiler.cfg.utilities kernel math namespaces sequences ; +compiler.cfg.stacks.local compiler.cfg.utilities kernel math +namespaces sequences ; IN: compiler.cfg.stacks : begin-stack-analysis ( -- )