compiler.cfg.ssa.destruction: the natural-sort was malplaced, only sort
inputs from ##phi, should fix remainder of #1345db4
parent
c0645ecafe
commit
c5ec490f39
|
@ -29,7 +29,7 @@ HELP: try-eliminate-copy
|
|||
|
||||
HELP: try-eliminate-copies
|
||||
{ $values { "pairs" "a sequence of vreg pairs" } { "must?" boolean } }
|
||||
{ $description "Tries to eliminate the vreg copies in the " { $link sequence } " 'pairs'. If 'must?' is " { $link t } " then a " { $link vregs-shouldn't-interfere } " error is thrown if any of the vregs interfere. To ensure deterministic " { $link leader-map } " data, the pairs are sorted." }
|
||||
{ $description "Tries to eliminate the vreg copies in the " { $link sequence } " 'pairs'. If 'must?' is " { $link t } " then a " { $link vregs-shouldn't-interfere } " error is thrown if any of the vregs interfere." }
|
||||
{ $see-also try-eliminate-copy } ;
|
||||
|
||||
ARTICLE: "compiler.cfg.ssa.destruction" "SSA Destruction"
|
||||
|
@ -41,6 +41,12 @@ ARTICLE: "compiler.cfg.ssa.destruction" "SSA Destruction"
|
|||
}
|
||||
$nl
|
||||
"Main entry point:"
|
||||
{ $subsections destruct-ssa } ;
|
||||
{ $subsections destruct-ssa }
|
||||
"Vreg copy elimination:"
|
||||
{ $subsections
|
||||
perform-coalescing
|
||||
try-eliminate-copies
|
||||
try-eliminate-copy
|
||||
} ;
|
||||
|
||||
ABOUT: "compiler.cfg.ssa.destruction"
|
||||
|
|
|
@ -2,8 +2,9 @@ USING: alien.syntax assocs compiler.cfg.def-use
|
|||
compiler.cfg.instructions compiler.cfg.registers
|
||||
compiler.cfg.ssa.destruction compiler.cfg.ssa.destruction.leaders
|
||||
compiler.cfg.ssa.destruction.private compiler.cfg.utilities
|
||||
cpu.architecture cpu.x86.assembler.operands grouping kernel make namespaces
|
||||
random sequences tools.test ;
|
||||
cpu.architecture cpu.x86.assembler.operands grouping kernel make math
|
||||
math.functions math.order math.ranges namespaces random sequences
|
||||
tools.test ;
|
||||
QUALIFIED: sets
|
||||
IN: compiler.cfg.ssa.destruction.tests
|
||||
|
||||
|
@ -99,3 +100,10 @@ IN: compiler.cfg.ssa.destruction.tests
|
|||
2286 leader
|
||||
] replicate all-equal?
|
||||
] unit-test
|
||||
|
||||
! Test is just to ensure the my-euler word compiles. See #1345
|
||||
: my-euler-step ( min m n -- min' )
|
||||
dup sqrt 1 mod [ - min ] [ 2drop ] if ; inline
|
||||
|
||||
: my-euler ( -- answer )
|
||||
33 2500 [1,b] [ dup [1,b] [ my-euler-step ] with each ] each ;
|
||||
|
|
|
@ -74,7 +74,7 @@ ERROR: vregs-shouldn't-interfere vreg1 vreg2 ;
|
|||
] if ;
|
||||
|
||||
: try-eliminate-copies ( pairs must? -- )
|
||||
[ natural-sort ] dip '[ first2 _ try-eliminate-copy ] each ;
|
||||
'[ first2 _ try-eliminate-copy ] each ;
|
||||
|
||||
M: ##tagged>integer prepare-insn
|
||||
[ dst>> ] [ src>> ] bi t try-eliminate-copy ;
|
||||
|
@ -83,16 +83,14 @@ M: ##tagged>integer prepare-insn
|
|||
[ 2array ] with map ;
|
||||
|
||||
M: ##phi prepare-insn
|
||||
[ dst>> ] [ inputs>> values ] bi zip-scalar t try-eliminate-copies ;
|
||||
[ dst>> ] [ inputs>> values ] bi zip-scalar
|
||||
natural-sort t try-eliminate-copies ;
|
||||
|
||||
: prepare-coalescing ( cfg -- )
|
||||
init-coalescing [ [ prepare-insn ] each ] simple-analysis ;
|
||||
|
||||
: process-copies ( copies -- )
|
||||
>alist f try-eliminate-copies ;
|
||||
|
||||
: perform-coalescing ( cfg -- )
|
||||
prepare-coalescing copies get process-copies ;
|
||||
prepare-coalescing copies get f try-eliminate-copies ;
|
||||
|
||||
GENERIC: cleanup-insn ( insn -- )
|
||||
|
||||
|
|
Loading…
Reference in New Issue