2011-09-08 12:57:40 -04:00
|
|
|
! Copyright (C) 2010 Slava Pestov, 2011 Alex Vondrak.
|
2011-05-22 20:15:56 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: accessors combinators.short-circuit cpu.architecture fry
|
|
|
|
kernel math
|
|
|
|
compiler.cfg.instructions
|
|
|
|
compiler.cfg.gvn.graph
|
2011-06-28 20:58:55 -04:00
|
|
|
compiler.cfg.gvn.avail
|
2011-05-22 20:15:56 -04:00
|
|
|
compiler.cfg.gvn.rewrite ;
|
|
|
|
IN: compiler.cfg.gvn.slots
|
|
|
|
|
|
|
|
: simplify-slot-addressing? ( insn -- ? )
|
2011-06-28 20:58:55 -04:00
|
|
|
complex-addressing? [
|
|
|
|
slot>> vreg>insn [ ##add-imm? ] with-available-uses?
|
|
|
|
] [ drop f ] if ;
|
2011-05-22 20:15:56 -04:00
|
|
|
|
|
|
|
: simplify-slot-addressing ( insn -- insn/f )
|
|
|
|
dup simplify-slot-addressing? [
|
2011-06-18 19:27:29 -04:00
|
|
|
clone dup slot>> vreg>insn
|
2011-05-22 20:15:56 -04:00
|
|
|
[ src1>> >>slot ]
|
|
|
|
[ src2>> over scale>> '[ _ _ shift - ] change-tag ]
|
|
|
|
bi
|
|
|
|
] [ drop f ] if ;
|
|
|
|
|
|
|
|
M: ##slot rewrite simplify-slot-addressing ;
|
|
|
|
M: ##set-slot rewrite simplify-slot-addressing ;
|
|
|
|
M: ##write-barrier rewrite simplify-slot-addressing ;
|