From e112b0d70ede0d94ad259fe4242c1eff5af9e39f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 27 Jul 2009 02:20:53 -0500 Subject: [PATCH] compiler.cfg.phi-elimination: no longer needed --- .../compiler/cfg/phi-elimination/authors.txt | 2 - .../phi-elimination-tests.factor | 55 ------------------- .../phi-elimination/phi-elimination.factor | 40 -------------- 3 files changed, 97 deletions(-) delete mode 100644 basis/compiler/cfg/phi-elimination/authors.txt delete mode 100644 basis/compiler/cfg/phi-elimination/phi-elimination-tests.factor delete mode 100644 basis/compiler/cfg/phi-elimination/phi-elimination.factor diff --git a/basis/compiler/cfg/phi-elimination/authors.txt b/basis/compiler/cfg/phi-elimination/authors.txt deleted file mode 100644 index a44f8d7f8d..0000000000 --- a/basis/compiler/cfg/phi-elimination/authors.txt +++ /dev/null @@ -1,2 +0,0 @@ -Slava Pestov -Daniel Ehrenberg diff --git a/basis/compiler/cfg/phi-elimination/phi-elimination-tests.factor b/basis/compiler/cfg/phi-elimination/phi-elimination-tests.factor deleted file mode 100644 index 22afc0b32b..0000000000 --- a/basis/compiler/cfg/phi-elimination/phi-elimination-tests.factor +++ /dev/null @@ -1,55 +0,0 @@ -! Copyright (C) 2009 Slava Pestov, Daniel Ehrenberg. -! See http://factorcode.org/license.txt for BSD license. -USING: compiler.cfg.instructions compiler.cfg compiler.cfg.registers -compiler.cfg.comparisons compiler.cfg.debugger locals -compiler.cfg.phi-elimination kernel accessors sequences classes -namespaces tools.test cpu.architecture arrays ; -IN: compiler.cfg.phi-elimination.tests - -V{ T{ ##branch } } 0 test-bb - -V{ - T{ ##peek f V int-regs 0 D 0 } - T{ ##compare-branch f V int-regs 0 V int-regs 0 cc< } -} 1 test-bb - -V{ - T{ ##load-immediate f V int-regs 1 1 } - T{ ##branch } -} 2 test-bb - -V{ - T{ ##load-immediate f V int-regs 2 2 } - T{ ##branch } -} 3 test-bb - -V{ - T{ ##phi f V int-regs 3 { } } - T{ ##replace f V int-regs 3 D 0 } - T{ ##return } -} 4 test-bb - -4 get instructions>> first -2 get V int-regs 1 2array -3 get V int-regs 2 2array 2array ->>inputs drop - -test-diamond - -3 vreg-counter set-global - -[ ] [ cfg new 0 get >>entry eliminate-phis drop ] unit-test - -[ T{ ##copy f V int-regs 4 V int-regs 1 } ] [ - 2 get successors>> first instructions>> first -] unit-test - -[ T{ ##copy f V int-regs 4 V int-regs 2 } ] [ - 3 get successors>> first instructions>> first -] unit-test - -[ T{ ##copy f V int-regs 3 V int-regs 4 } ] [ - 4 get instructions>> first -] unit-test - -[ 3 ] [ 4 get instructions>> length ] unit-test diff --git a/basis/compiler/cfg/phi-elimination/phi-elimination.factor b/basis/compiler/cfg/phi-elimination/phi-elimination.factor deleted file mode 100644 index 38e82176ca..0000000000 --- a/basis/compiler/cfg/phi-elimination/phi-elimination.factor +++ /dev/null @@ -1,40 +0,0 @@ -! Copyright (C) 2009 Slava Pestov, Daniel Ehrenberg. -! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs fry kernel sequences namespaces -compiler.cfg compiler.cfg.instructions compiler.cfg.rpo -compiler.cfg.utilities compiler.cfg.hats make -locals ; -IN: compiler.cfg.phi-elimination - -! assoc mapping predecessors to sequences -SYMBOL: added-instructions - -: add-instructions ( predecessor quot -- ) - [ - added-instructions get - [ drop V{ } clone ] cache - building - ] dip with-variable ; inline - -: insert-basic-blocks ( bb -- ) - [ added-instructions get ] dip - '[ [ _ ] dip insert-basic-block ] assoc-each ; - -: insert-copy ( predecessor input output -- ) - '[ _ _ swap ##copy ] add-instructions ; - -: eliminate-phi ( ##phi -- ##copy ) - i - [ [ inputs>> ] dip '[ _ insert-copy ] assoc-each ] - [ [ dst>> ] dip \ ##copy new-insn ] - 2bi ; - -: eliminate-phi-step ( bb -- ) - H{ } clone added-instructions set - [ instructions>> [ dup ##phi? [ eliminate-phi ] when ] change-each ] - [ insert-basic-blocks ] - bi ; - -: eliminate-phis ( cfg -- cfg' ) - dup [ eliminate-phi-step ] each-basic-block - cfg-changed ;