compiler.cfg.scheduling: always run scheduling because heuristic was broken
parent
80d7aab40b
commit
546b81b697
|
@ -3,8 +3,7 @@
|
||||||
USING: accessors arrays assocs fry kernel locals make math
|
USING: accessors arrays assocs fry kernel locals make math
|
||||||
namespaces sequences sets combinators.short-circuit
|
namespaces sequences sets combinators.short-circuit
|
||||||
compiler.cfg.def-use compiler.cfg.dependence
|
compiler.cfg.def-use compiler.cfg.dependence
|
||||||
compiler.cfg.instructions compiler.cfg.liveness compiler.cfg.rpo
|
compiler.cfg.instructions compiler.cfg.rpo cpu.architecture ;
|
||||||
cpu.architecture ;
|
|
||||||
IN: compiler.cfg.scheduling
|
IN: compiler.cfg.scheduling
|
||||||
|
|
||||||
! Instruction scheduling to reduce register pressure, from:
|
! Instruction scheduling to reduce register pressure, from:
|
||||||
|
@ -130,18 +129,7 @@ ERROR: definition-after-usage vregs old-bb new-bb ;
|
||||||
] change-instructions drop
|
] change-instructions drop
|
||||||
] with-scheduling-check ;
|
] with-scheduling-check ;
|
||||||
|
|
||||||
! Really, instruction scheduling should be aware that there are
|
|
||||||
! multiple types of registers, but this number is just used
|
|
||||||
! to decide whether to schedule instructions
|
|
||||||
: num-registers ( -- x ) int-regs machine-registers at length ;
|
|
||||||
|
|
||||||
: might-spill? ( bb -- ? )
|
|
||||||
[ live-in assoc-size ]
|
|
||||||
[ instructions>> [ defs-vregs length ] map-sum ] bi
|
|
||||||
+ num-registers >= ;
|
|
||||||
|
|
||||||
: schedule-instructions ( cfg -- cfg' )
|
: schedule-instructions ( cfg -- cfg' )
|
||||||
dup [
|
dup [
|
||||||
dup { [ kill-block?>> not ] [ might-spill? ] } 1&&
|
dup kill-block?>> [ drop ] [ schedule-block ] if
|
||||||
[ schedule-block ] [ drop ] if
|
|
||||||
] each-basic-block ;
|
] each-basic-block ;
|
||||||
|
|
Loading…
Reference in New Issue