]> gitweb.factorcode.org Git - factor.git/blob - extra/compiler/cfg/gvn/slots/slots.factor
factor: trim using lists
[factor.git] / extra / compiler / cfg / gvn / slots / slots.factor
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
5 compiler.cfg.gvn.graph
6 compiler.cfg.gvn.avail
7 compiler.cfg.gvn.rewrite ;
8 IN: compiler.cfg.gvn.slots
9
10 : simplify-slot-addressing? ( insn -- ? )
11     complex-addressing? [
12         slot>> vreg>insn [ ##add-imm? ] with-available-uses?
13     ] [ drop f ] if ;
14
15 : simplify-slot-addressing ( insn -- insn/f )
16     dup simplify-slot-addressing? [
17         clone dup slot>> vreg>insn
18         [ src1>> >>slot ]
19         [ src2>> over scale>> '[ _ _ shift - ] change-tag ]
20         bi
21     ] [ drop f ] if ;
22
23 M: ##slot rewrite simplify-slot-addressing ;
24 M: ##set-slot rewrite simplify-slot-addressing ;
25 M: ##write-barrier rewrite simplify-slot-addressing ;