1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs kernel locals fry
8 compiler.cfg.instructions
9 compiler.cfg.representations ;
10 IN: compiler.cfg.ssa.cssa
12 ! Convert SSA to conventional SSA. This pass runs after representation
13 ! selection, so it must keep track of representations when introducing
16 :: insert-copy ( bb src rep -- bb dst )
17 rep next-vreg-rep :> dst
18 bb [ dst src rep src rep-of emit-conversion ] add-instructions
21 : convert-phi ( ##phi -- )
22 dup dst>> rep-of '[ [ _ insert-copy ] assoc-map ] change-inputs drop ;
24 : construct-cssa ( cfg -- )
25 [ [ convert-phi ] each-phi ] each-basic-block ;