compiler.cfg.scheduling: remove old scheduling test code, adding a better way of testing scheduling

db4
Slava Pestov 2011-08-28 21:23:27 -07:00
parent 990c57a4a4
commit 3ed1910ab1
2 changed files with 7 additions and 50 deletions

View File

@ -1,16 +1,9 @@
USING: compiler.cfg.scheduling compiler.cfg.instructions 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 IN: compiler.cfg.scheduling.tests
! Recompile compiler.cfg.scheduling with extra tests, ! Test split-3-ways
! 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
[ [
{ } { }
{ } { }

View File

@ -80,40 +80,6 @@ conditional-branch-insn
[ (reorder) ] V{ } make reverse [ (reorder) ] V{ } make reverse
] dip 3append ; ] 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 -- ) : number-insns ( insns -- )
[ >>insn# drop ] each-index ; [ >>insn# drop ] each-index ;
@ -121,13 +87,11 @@ ERROR: definition-after-usage vregs old-bb new-bb ;
[ f >>insn# drop ] each ; [ f >>insn# drop ] each ;
: schedule-block ( bb -- ) : schedule-block ( bb -- )
[
[ [
[ number-insns ] [ number-insns ]
[ reorder ] [ reorder ]
[ clear-numbers ] tri [ clear-numbers ] tri
] change-instructions drop ] change-instructions drop ;
] with-scheduling-check ;
: schedule-instructions ( cfg -- cfg' ) : schedule-instructions ( cfg -- cfg' )
dup [ dup [