! Copyright (C) 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs cpu.architecture grouping kernel
-sequences
-compiler.cfg.instructions
-compiler.cfg.utilities
-compiler.cfg.gvn.graph
-compiler.cfg.gvn.rewrite ;
+USING: accessors compiler.cfg.gvn.graph compiler.cfg.gvn.rewrite
+compiler.cfg.instructions cpu.architecture kernel ;
IN: compiler.cfg.gvn.misc
M: ##replace rewrite
[ loc>> ] [ src>> vreg>insn ] bi
dup literal-insn? [
insn>literal dup immediate-store?
- [ swap \ ##replace-imm new-insn ] [ 2drop f ] if
- ] [ 2drop f ] if ;
-
-M: ##phi rewrite
- [ dst>> ] [ inputs>> values [ vreg>canon-vn ] map sift ] bi
- dup all-equal? [
- [ drop f ]
- [ first <copy> ] if-empty
+ [ swap ##replace-imm new-insn ] [ 2drop f ] if
] [ 2drop f ] if ;