compiler.cfg.*: getting an instruction sequence from a cfg is used in a few tests so let's make a word for it
parent
22c512788b
commit
4c07d04417
|
@ -124,8 +124,7 @@ M: rs-loc pprint* \ R pprint-loc ;
|
||||||
] map concat >hashtable representations set ;
|
] map concat >hashtable representations set ;
|
||||||
|
|
||||||
: count-insns ( quot insn-check -- ? )
|
: count-insns ( quot insn-check -- ? )
|
||||||
[ test-regs [ post-order [ instructions>> ] map concat ] map concat ] dip
|
[ test-regs [ cfg>insns ] map concat ] dip count ; inline
|
||||||
count ; inline
|
|
||||||
|
|
||||||
: contains-insn? ( quot insn-check -- ? )
|
: contains-insn? ( quot insn-check -- ? )
|
||||||
count-insns 0 > ; inline
|
count-insns 0 > ; inline
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: accessors arrays assocs compiler.cfg compiler.cfg.dependence
|
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.linearization compiler.cfg.registers compiler.cfg.scheduling
|
||||||
compiler.cfg.utilities grouping kernel math namespaces tools.test random
|
compiler.cfg.utilities grouping kernel math namespaces tools.test random
|
||||||
sequences sets splitting vectors words compiler.cfg.test-words ;
|
sequences sets splitting vectors words compiler.cfg.test-words ;
|
||||||
|
@ -55,8 +55,7 @@ IN: compiler.cfg.scheduling.tests
|
||||||
T{ ##load-tagged }
|
T{ ##load-tagged }
|
||||||
T{ ##allot }
|
T{ ##allot }
|
||||||
T{ ##set-slot-imm }
|
T{ ##set-slot-imm }
|
||||||
} insns>cfg schedule-instructions
|
} insns>cfg schedule-instructions cfg>insns [ insn#>> ] all?
|
||||||
linearization-order [ instructions>> ] map concat [ insn#>> ] all?
|
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
: test-1187 ( -- insns )
|
: test-1187 ( -- insns )
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors assocs combinators combinators.short-circuit
|
USING: accessors assocs combinators combinators.short-circuit
|
||||||
cpu.architecture kernel layouts locals make math namespaces sequences
|
cpu.architecture kernel layouts locals make math namespaces sequences
|
||||||
sets vectors fry arrays compiler.cfg compiler.cfg.instructions
|
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
|
IN: compiler.cfg.utilities
|
||||||
|
|
||||||
: block>cfg ( bb -- cfg )
|
: block>cfg ( bb -- cfg )
|
||||||
|
@ -15,6 +15,9 @@ IN: compiler.cfg.utilities
|
||||||
: insns>cfg ( insns -- cfg )
|
: insns>cfg ( insns -- cfg )
|
||||||
0 insns>block block>cfg ;
|
0 insns>block block>cfg ;
|
||||||
|
|
||||||
|
: cfg>insns ( cfg -- insns )
|
||||||
|
linearization-order [ instructions>> ] map concat ;
|
||||||
|
|
||||||
: back-edge? ( from to -- ? )
|
: back-edge? ( from to -- ? )
|
||||||
[ number>> ] bi@ >= ;
|
[ number>> ] bi@ >= ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue