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 ;
|
||||
|
||||
: 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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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@ >= ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue