1 ! Copyright (C) 2010 Slava Pestov, 2011 Alex Vondrak.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors combinators.short-circuit cpu.architecture fry
5 compiler.cfg.instructions
8 compiler.cfg.gvn.rewrite ;
9 IN: compiler.cfg.gvn.slots
11 : simplify-slot-addressing? ( insn -- ? )
13 slot>> vreg>insn [ ##add-imm? ] with-available-uses?
16 : simplify-slot-addressing ( insn -- insn/f )
17 dup simplify-slot-addressing? [
18 clone dup slot>> vreg>insn
20 [ src2>> over scale>> '[ _ _ shift - ] change-tag ]
24 M: ##slot rewrite simplify-slot-addressing ;
25 M: ##set-slot rewrite simplify-slot-addressing ;
26 M: ##write-barrier rewrite simplify-slot-addressing ;