compiler.cfg.value-numbering: more cleanups
parent
ef8094e3b3
commit
a141df595b
|
@ -9,8 +9,7 @@ compiler.cfg.registers
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.value-numbering.math
|
compiler.cfg.value-numbering.math
|
||||||
compiler.cfg.value-numbering.graph
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.rewrite
|
compiler.cfg.value-numbering.rewrite ;
|
||||||
compiler.cfg.value-numbering.expressions ;
|
|
||||||
IN: compiler.cfg.value-numbering.alien
|
IN: compiler.cfg.value-numbering.alien
|
||||||
|
|
||||||
M: ##box-displaced-alien rewrite
|
M: ##box-displaced-alien rewrite
|
||||||
|
|
|
@ -6,8 +6,7 @@ compiler.cfg.comparisons compiler.cfg.instructions
|
||||||
compiler.cfg.registers
|
compiler.cfg.registers
|
||||||
compiler.cfg.value-numbering.math
|
compiler.cfg.value-numbering.math
|
||||||
compiler.cfg.value-numbering.graph
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.rewrite
|
compiler.cfg.value-numbering.rewrite ;
|
||||||
compiler.cfg.value-numbering.expressions ;
|
|
||||||
IN: compiler.cfg.value-numbering.comparisons
|
IN: compiler.cfg.value-numbering.comparisons
|
||||||
|
|
||||||
! Optimizations performed here:
|
! Optimizations performed here:
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays classes classes.algebra classes.parser
|
USING: accessors arrays classes classes.algebra combinators fry
|
||||||
classes.tuple combinators combinators.short-circuit fry
|
generic.parser kernel math namespaces quotations sequences slots
|
||||||
generic.parser kernel layouts math namespaces quotations
|
words make
|
||||||
sequences slots splitting words make
|
|
||||||
cpu.architecture
|
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.instructions.syntax
|
compiler.cfg.instructions.syntax
|
||||||
compiler.cfg.value-numbering.graph ;
|
compiler.cfg.value-numbering.graph ;
|
||||||
|
@ -84,36 +82,3 @@ M: ##copy >expr "Fail" throw ;
|
||||||
M: ##load-integer >expr val>> <integer-expr> ;
|
M: ##load-integer >expr val>> <integer-expr> ;
|
||||||
|
|
||||||
M: ##load-reference >expr obj>> <reference-expr> ;
|
M: ##load-reference >expr obj>> <reference-expr> ;
|
||||||
|
|
||||||
GENERIC: insn>integer ( insn -- n )
|
|
||||||
|
|
||||||
M: ##load-integer insn>integer val>> ;
|
|
||||||
|
|
||||||
: vreg>integer ( vreg -- n ) vreg>insn insn>integer ; inline
|
|
||||||
|
|
||||||
: vreg-immediate-arithmetic? ( vreg -- ? )
|
|
||||||
vreg>insn {
|
|
||||||
[ ##load-integer? ]
|
|
||||||
[ val>> immediate-arithmetic? ]
|
|
||||||
} 1&& ;
|
|
||||||
|
|
||||||
: vreg-immediate-bitwise? ( vreg -- ? )
|
|
||||||
vreg>insn {
|
|
||||||
[ ##load-integer? ]
|
|
||||||
[ val>> immediate-bitwise? ]
|
|
||||||
} 1&& ;
|
|
||||||
|
|
||||||
GENERIC: insn>comparand ( expr -- n )
|
|
||||||
|
|
||||||
M: ##load-integer insn>comparand val>> tag-fixnum ;
|
|
||||||
|
|
||||||
M: ##load-reference insn>comparand obj>> ;
|
|
||||||
|
|
||||||
: vreg>comparand ( vreg -- n ) vreg>insn insn>comparand ; inline
|
|
||||||
|
|
||||||
: vreg-immediate-comparand? ( vreg -- ? )
|
|
||||||
vreg>insn {
|
|
||||||
{ [ dup ##load-integer? ] [ val>> tag-fixnum immediate-comparand? ] }
|
|
||||||
{ [ dup ##load-reference? ] [ obj>> immediate-comparand? ] }
|
|
||||||
[ drop f ]
|
|
||||||
} cond ;
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel layouts math math.bitwise
|
USING: accessors kernel layouts math math.bitwise
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.value-numbering.expressions
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.graph ;
|
compiler.cfg.value-numbering.rewrite ;
|
||||||
IN: compiler.cfg.value-numbering.folding
|
IN: compiler.cfg.value-numbering.folding
|
||||||
|
|
||||||
: binary-constant-fold? ( insn -- ? )
|
: binary-constant-fold? ( insn -- ? )
|
||||||
|
|
|
@ -5,7 +5,6 @@ cpu.architecture fry kernel layouts locals make math sequences
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.registers
|
compiler.cfg.registers
|
||||||
compiler.cfg.utilities
|
compiler.cfg.utilities
|
||||||
compiler.cfg.value-numbering.expressions
|
|
||||||
compiler.cfg.value-numbering.folding
|
compiler.cfg.value-numbering.folding
|
||||||
compiler.cfg.value-numbering.graph
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.rewrite ;
|
compiler.cfg.value-numbering.rewrite ;
|
||||||
|
|
|
@ -1,9 +1,46 @@
|
||||||
! Copyright (C) 2010 Slava Pestov.
|
! Copyright (C) 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel compiler.cfg.instructions ;
|
USING: accessors combinators combinators.short-circuit kernel layouts
|
||||||
|
cpu.architecture
|
||||||
|
compiler.cfg.instructions
|
||||||
|
compiler.cfg.value-numbering.graph ;
|
||||||
IN: compiler.cfg.value-numbering.rewrite
|
IN: compiler.cfg.value-numbering.rewrite
|
||||||
|
|
||||||
! Outputs f to mean no change
|
! Outputs f to mean no change
|
||||||
GENERIC: rewrite ( insn -- insn/f )
|
GENERIC: rewrite ( insn -- insn/f )
|
||||||
|
|
||||||
M: insn rewrite drop f ;
|
M: insn rewrite drop f ;
|
||||||
|
|
||||||
|
! Utilities
|
||||||
|
GENERIC: insn>integer ( insn -- n )
|
||||||
|
|
||||||
|
M: ##load-integer insn>integer val>> ;
|
||||||
|
|
||||||
|
: vreg>integer ( vreg -- n ) vreg>insn insn>integer ; inline
|
||||||
|
|
||||||
|
: vreg-immediate-arithmetic? ( vreg -- ? )
|
||||||
|
vreg>insn {
|
||||||
|
[ ##load-integer? ]
|
||||||
|
[ val>> immediate-arithmetic? ]
|
||||||
|
} 1&& ;
|
||||||
|
|
||||||
|
: vreg-immediate-bitwise? ( vreg -- ? )
|
||||||
|
vreg>insn {
|
||||||
|
[ ##load-integer? ]
|
||||||
|
[ val>> immediate-bitwise? ]
|
||||||
|
} 1&& ;
|
||||||
|
|
||||||
|
GENERIC: insn>comparand ( expr -- n )
|
||||||
|
|
||||||
|
M: ##load-integer insn>comparand val>> tag-fixnum ;
|
||||||
|
|
||||||
|
M: ##load-reference insn>comparand obj>> ;
|
||||||
|
|
||||||
|
: vreg>comparand ( vreg -- n ) vreg>insn insn>comparand ; inline
|
||||||
|
|
||||||
|
: vreg-immediate-comparand? ( vreg -- ? )
|
||||||
|
vreg>insn {
|
||||||
|
{ [ dup ##load-integer? ] [ val>> tag-fixnum immediate-comparand? ] }
|
||||||
|
{ [ dup ##load-reference? ] [ obj>> immediate-comparand? ] }
|
||||||
|
[ drop f ]
|
||||||
|
} cond ;
|
||||||
|
|
|
@ -12,7 +12,6 @@ compiler.cfg.comparisons
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.value-numbering.math
|
compiler.cfg.value-numbering.math
|
||||||
compiler.cfg.value-numbering.graph
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.expressions
|
|
||||||
compiler.cfg.value-numbering.rewrite ;
|
compiler.cfg.value-numbering.rewrite ;
|
||||||
IN: compiler.cfg.value-numbering.simd
|
IN: compiler.cfg.value-numbering.simd
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ USING: accessors combinators.short-circuit cpu.architecture fry
|
||||||
kernel math
|
kernel math
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.value-numbering.graph
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.rewrite
|
compiler.cfg.value-numbering.rewrite ;
|
||||||
compiler.cfg.value-numbering.expressions ;
|
|
||||||
IN: compiler.cfg.value-numbering.slots
|
IN: compiler.cfg.value-numbering.slots
|
||||||
|
|
||||||
: simplify-slot-addressing? ( insn -- ? )
|
: simplify-slot-addressing? ( insn -- ? )
|
||||||
|
|
|
@ -11,11 +11,11 @@ compiler.cfg.utilities
|
||||||
compiler.cfg.instructions
|
compiler.cfg.instructions
|
||||||
compiler.cfg.value-numbering.alien
|
compiler.cfg.value-numbering.alien
|
||||||
compiler.cfg.value-numbering.comparisons
|
compiler.cfg.value-numbering.comparisons
|
||||||
compiler.cfg.value-numbering.expressions
|
|
||||||
compiler.cfg.value-numbering.graph
|
compiler.cfg.value-numbering.graph
|
||||||
compiler.cfg.value-numbering.math
|
compiler.cfg.value-numbering.math
|
||||||
compiler.cfg.value-numbering.rewrite
|
compiler.cfg.value-numbering.rewrite
|
||||||
compiler.cfg.value-numbering.slots ;
|
compiler.cfg.value-numbering.slots
|
||||||
|
compiler.cfg.value-numbering.expressions ;
|
||||||
IN: compiler.cfg.value-numbering
|
IN: compiler.cfg.value-numbering
|
||||||
|
|
||||||
GENERIC: process-instruction ( insn -- insn' )
|
GENERIC: process-instruction ( insn -- insn' )
|
||||||
|
|
Loading…
Reference in New Issue