1 ! Copyright (C) 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors combinators.short-circuit cpu.architecture fry
5 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? ] [ drop f ] if ;
14 : simplify-slot-addressing ( insn -- insn/f )
15 dup simplify-slot-addressing? [
16 clone dup slot>> vreg>insn
18 [ src2>> over scale>> '[ _ _ shift - ] change-tag ]
22 M: ##slot rewrite simplify-slot-addressing ;
23 M: ##set-slot rewrite simplify-slot-addressing ;
24 M: ##write-barrier rewrite simplify-slot-addressing ;