]> gitweb.factorcode.org Git - factor.git/commitdiff
Scheduling schedules more BBs--it was leaving out some ones that shouldn't've been...
authorDaniel Ehrenberg <littledan@pool-224-36.res.carleton.edu>
Fri, 12 Feb 2010 03:02:02 +0000 (21:02 -0600)
committerDaniel Ehrenberg <littledan@pool-224-36.res.carleton.edu>
Fri, 12 Feb 2010 03:02:02 +0000 (21:02 -0600)
basis/compiler/cfg/dependence/dependence.factor
basis/compiler/cfg/scheduling/scheduling.factor

index 9292b19f556c934e1a752519d6a040515a3dcc56..94649239705fe5b44850640935cf224ac09b38d9 100644 (file)
@@ -120,13 +120,11 @@ UNION: alien-call-insn
         [ add-data-edges ]
         [ add-control-edges ]
         [ set-follows ]
-        [ nodes set ] ! for assertions later
+        [ nodes set ]
         [ set-roots ]
     } cleave ;
 
-! Constructing fan-in trees using the
 ! Sethi-Ulmann numbering
-
 :: calculate-registers ( node -- registers )
     node children>> [ 0 ] [
         [ [ calculate-registers ] map natural-sort ]
@@ -136,6 +134,8 @@ UNION: alien-call-insn
     node insn>> temp-vregs length +
     dup node (>>registers) ;
 
+! Constructing fan-in trees
+
 : attach-parent ( node parent -- )
     [ >>parent drop ]
     [ [ ?push ] change-children drop ] 2bi ;
index a61200f6c9d480056d176ab05dcafb3b80a38668..a38349a786f73e9128385a24d998a6a367bffb70 100644 (file)
@@ -122,26 +122,14 @@ ERROR: definition-after-usage vreg old-bb new-bb ;
 ! to decide whether to schedule instructions
 : num-registers ( -- x ) int-regs machine-registers at length ;
 
-: update-vregs ( insn vregs -- )
-    [ [ defs-vreg ] dip '[ _ delete-at ] when* ]
-    [ [ uses-vregs ] dip '[ _ conjoin ] each ] 2bi ;
-
-:: (might-spill?) ( vregs insns -- ? )
-    insns <reversed> [
-        [ vregs update-vregs ]
-        [ temp-vregs length vregs assoc-size + num-registers > ] bi
-    ] any? ;
-
 : might-spill? ( bb -- ? )
-    ! Conservative approximation testing whether a bb might spill
-    ! by calculating register pressure all along, assuming
-    ! everything in live-out are in registers
-    ! This is done bottom-up: a def means the register is no longer live
-    [ live-out H{ } assoc-clone-like ] [ instructions>> ] bi (might-spill?) ;
+    [ live-in assoc-size ]
+    [ instructions>> [ defs-vreg ] count ] bi
+    + num-registers >= ;
 
 : schedule-instructions ( cfg -- cfg' )
     dup [
-        dup might-spill?
+    dup might-spill?
         [ schedule-block ]
         [ drop ] if
     ] each-basic-block ;