compiler.cfg.scheduling: remove old scheduling test code, adding a better way of testing scheduling
parent
990c57a4a4
commit
3ed1910ab1
|
@ -1,16 +1,9 @@
|
|||
USING: compiler.cfg.scheduling compiler.cfg.instructions
|
||||
vocabs.loader namespaces tools.test arrays kernel ;
|
||||
vocabs.loader namespaces tools.test arrays kernel random
|
||||
words compiler.units ;
|
||||
IN: compiler.cfg.scheduling.tests
|
||||
|
||||
! Recompile compiler.cfg.scheduling with extra tests,
|
||||
! and see if any errors come up. Back when there were
|
||||
! errors of this kind, they always surfaced this way.
|
||||
|
||||
t check-scheduling? [
|
||||
[ ] [ "compiler.cfg.scheduling" reload ] unit-test
|
||||
[ ] [ "compiler.cfg.dependence" reload ] unit-test
|
||||
] with-variable
|
||||
|
||||
! Test split-3-ways
|
||||
[
|
||||
{ }
|
||||
{ }
|
||||
|
|
|
@ -80,40 +80,6 @@ conditional-branch-insn
|
|||
[ (reorder) ] V{ } make reverse
|
||||
] dip 3append ;
|
||||
|
||||
ERROR: not-all-instructions-were-scheduled old-bb new-bb ;
|
||||
|
||||
SYMBOL: check-scheduling?
|
||||
f check-scheduling? set-global
|
||||
|
||||
:: check-instructions ( new-bb old-bb -- )
|
||||
new-bb old-bb [ instructions>> ] bi@
|
||||
[ [ length ] bi@ = ] [ [ unique ] bi@ = ] 2bi and
|
||||
[ old-bb new-bb not-all-instructions-were-scheduled ] unless ;
|
||||
|
||||
ERROR: definition-after-usage vregs old-bb new-bb ;
|
||||
|
||||
:: check-usages ( new-bb old-bb -- )
|
||||
HS{ } clone :> useds
|
||||
new-bb instructions>> split-3-ways drop nip
|
||||
[| insn |
|
||||
insn uses-vregs [ useds adjoin ] each
|
||||
insn defs-vregs :> defs-vregs
|
||||
defs-vregs useds intersects?
|
||||
[ defs-vregs old-bb new-bb definition-after-usage ] when
|
||||
] each ;
|
||||
|
||||
: check-scheduling ( new-bb old-bb -- )
|
||||
[ check-instructions ] [ check-usages ] 2bi ;
|
||||
|
||||
: with-scheduling-check ( bb quot: ( bb -- ) -- )
|
||||
check-scheduling? get [
|
||||
over dup clone
|
||||
[ call( bb -- ) ] 2dip
|
||||
check-scheduling
|
||||
] [
|
||||
call( bb -- )
|
||||
] if ; inline
|
||||
|
||||
: number-insns ( insns -- )
|
||||
[ >>insn# drop ] each-index ;
|
||||
|
||||
|
@ -121,13 +87,11 @@ ERROR: definition-after-usage vregs old-bb new-bb ;
|
|||
[ f >>insn# drop ] each ;
|
||||
|
||||
: schedule-block ( bb -- )
|
||||
[
|
||||
[
|
||||
[ number-insns ]
|
||||
[ reorder ]
|
||||
[ clear-numbers ] tri
|
||||
] change-instructions drop
|
||||
] with-scheduling-check ;
|
||||
] change-instructions drop ;
|
||||
|
||||
: schedule-instructions ( cfg -- cfg' )
|
||||
dup [
|
||||
|
|
Loading…
Reference in New Issue