1 ! Copyright (C) 2010 Slava Pestov, 2011 Alex Vondrak.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors cpu.architecture kernel math
4 compiler.cfg.instructions
7 compiler.cfg.gvn.rewrite ;
8 IN: compiler.cfg.gvn.slots
10 : simplify-slot-addressing? ( insn -- ? )
12 slot>> vreg>insn [ ##add-imm? ] with-available-uses?
15 : simplify-slot-addressing ( insn -- insn/f )
16 dup simplify-slot-addressing? [
17 clone dup slot>> vreg>insn
19 [ src2>> over scale>> '[ _ _ shift - ] change-tag ]
23 M: ##slot rewrite simplify-slot-addressing ;
24 M: ##set-slot rewrite simplify-slot-addressing ;
25 M: ##write-barrier rewrite simplify-slot-addressing ;