compiler.cfg.*: getting an instruction sequence from a cfg is used in a few tests so let's make a word for it

db4
Björn Lindqvist 2014-11-24 06:25:34 +01:00
parent 22c512788b
commit 4c07d04417
3 changed files with 7 additions and 6 deletions

View File

@ -124,8 +124,7 @@ M: rs-loc pprint* \ R pprint-loc ;
] map concat >hashtable representations set ;
: count-insns ( quot insn-check -- ? )
[ test-regs [ post-order [ instructions>> ] map concat ] map concat ] dip
count ; inline
[ test-regs [ cfg>insns ] map concat ] dip count ; inline
: contains-insn? ( quot insn-check -- ? )
count-insns 0 > ; inline

View File

@ -1,5 +1,5 @@
USING: accessors arrays assocs compiler.cfg compiler.cfg.dependence
compiler.cfg.dependence.tests compiler.cfg.instructions
compiler.cfg.test-words compiler.cfg.instructions
compiler.cfg.linearization compiler.cfg.registers compiler.cfg.scheduling
compiler.cfg.utilities grouping kernel math namespaces tools.test random
sequences sets splitting vectors words compiler.cfg.test-words ;
@ -55,8 +55,7 @@ IN: compiler.cfg.scheduling.tests
T{ ##load-tagged }
T{ ##allot }
T{ ##set-slot-imm }
} insns>cfg schedule-instructions
linearization-order [ instructions>> ] map concat [ insn#>> ] all?
} insns>cfg schedule-instructions cfg>insns [ insn#>> ] all?
] unit-test
: test-1187 ( -- insns )

View File

@ -3,7 +3,7 @@
USING: accessors assocs combinators combinators.short-circuit
cpu.architecture kernel layouts locals make math namespaces sequences
sets vectors fry arrays compiler.cfg compiler.cfg.instructions
compiler.cfg.rpo compiler.utilities ;
compiler.cfg.linearization compiler.cfg.rpo compiler.utilities ;
IN: compiler.cfg.utilities
: block>cfg ( bb -- cfg )
@ -15,6 +15,9 @@ IN: compiler.cfg.utilities
: insns>cfg ( insns -- cfg )
0 insns>block block>cfg ;
: cfg>insns ( cfg -- insns )
linearization-order [ instructions>> ] map concat ;
: back-edge? ( from to -- ? )
[ number>> ] bi@ >= ;