2009-08-02 11:26:52 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: accessors assocs kernel locals
|
2009-08-07 18:44:50 -04:00
|
|
|
cpu.architecture
|
2009-08-02 11:26:52 -04:00
|
|
|
compiler.cfg.rpo
|
|
|
|
compiler.cfg.hats
|
|
|
|
compiler.cfg.utilities
|
|
|
|
compiler.cfg.instructions ;
|
|
|
|
IN: compiler.cfg.ssa.cssa
|
|
|
|
|
|
|
|
! Convert SSA to conventional SSA.
|
|
|
|
|
|
|
|
:: insert-copy ( bb src -- bb dst )
|
|
|
|
i :> dst
|
2009-08-07 18:44:50 -04:00
|
|
|
bb [ dst src int-rep ##copy ] add-instructions
|
2009-08-02 11:26:52 -04:00
|
|
|
bb dst ;
|
|
|
|
|
|
|
|
: convert-phi ( ##phi -- )
|
|
|
|
[ [ insert-copy ] assoc-map ] change-inputs drop ;
|
|
|
|
|
|
|
|
: construct-cssa ( cfg -- )
|
|
|
|
[ [ convert-phi ] each-phi ] each-basic-block ;
|