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"
}
$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"
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
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 ;
] 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 ;
[ 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 -- )