compiler.cfg.linear-scan.assignment: better vregs>regs

locals-and-roots
Björn Lindqvist 2016-04-07 11:28:17 +02:00
parent 754f52d399
commit e426e5c339
3 changed files with 8 additions and 8 deletions

View File

@ -66,7 +66,7 @@ HELP: vreg>reg
{ $see-also lookup-spill-slot pending-interval-assoc } ; { $see-also lookup-spill-slot pending-interval-assoc } ;
HELP: vregs>regs HELP: vregs>regs
{ $values { "vregs" "a sequence of virtual registers" } { "assoc" assoc } } { $values { "assoc" "an " { $link assoc } " (set) of virtual registers" } { "assoc" assoc } }
{ $description "Creates a mapping of virtual registers to registers." } ; { $description "Creates a mapping of virtual registers to registers." } ;
HELP: vreg>spill-slot HELP: vreg>spill-slot

View File

@ -151,10 +151,10 @@ IN: compiler.cfg.linear-scan.assignment.tests
] [ bad-vreg? ] must-fail-with ] [ bad-vreg? ] must-fail-with
! vregs>regs ! vregs>regs
{ H{ { 44 RBX } { 33 RAX } } } [ { { { 33 RAX } { 44 RBX } } } [
{ { 33 int-rep 33 f } { 44 int-rep 44 f } } setup-vreg-spills { { 33 int-rep 33 f } { 44 int-rep 44 f } } setup-vreg-spills
H{ { 33 RAX } { 44 RBX } } pending-interval-assoc set H{ { 33 RAX } { 44 RBX } } pending-interval-assoc set
{ 33 44 } vregs>regs { { 33 33 } { 44 44 } } vregs>regs
] unit-test ] unit-test

View File

@ -35,8 +35,8 @@ ERROR: not-spilled-error vreg ;
dup vreg>reg dup spill-slot? dup vreg>reg dup spill-slot?
[ nip ] [ drop leader not-spilled-error ] if ; [ nip ] [ drop leader not-spilled-error ] if ;
: vregs>regs ( vregs -- assoc ) : vregs>regs ( assoc -- assoc' )
[ dup vreg>reg ] H{ } map>assoc ; [ vreg>reg ] assoc-map ;
SYMBOL: unhandled-intervals SYMBOL: unhandled-intervals
@ -46,7 +46,7 @@ SYMBOL: machine-live-ins
machine-live-ins get at ; machine-live-ins get at ;
: compute-live-in ( bb -- ) : compute-live-in ( bb -- )
[ live-in keys vregs>regs ] keep machine-live-ins get set-at ; [ live-in vregs>regs ] keep machine-live-ins get set-at ;
SYMBOL: machine-edge-live-ins SYMBOL: machine-edge-live-ins
@ -54,7 +54,7 @@ SYMBOL: machine-edge-live-ins
machine-edge-live-ins get at at ; machine-edge-live-ins get at at ;
: compute-edge-live-in ( bb -- ) : compute-edge-live-in ( bb -- )
[ edge-live-ins get at [ keys vregs>regs ] assoc-map ] keep [ edge-live-ins get at [ vregs>regs ] assoc-map ] keep
machine-edge-live-ins get set-at ; machine-edge-live-ins get set-at ;
SYMBOL: machine-live-outs SYMBOL: machine-live-outs
@ -63,7 +63,7 @@ SYMBOL: machine-live-outs
machine-live-outs get at ; machine-live-outs get at ;
: compute-live-out ( bb -- ) : compute-live-out ( bb -- )
[ live-out keys vregs>regs ] keep machine-live-outs get set-at ; [ live-out vregs>regs ] keep machine-live-outs get set-at ;
: insert-spill ( live-interval -- ) : insert-spill ( live-interval -- )
[ reg>> ] [ spill-rep>> ] [ spill-to>> ] tri ##spill, ; [ reg>> ] [ spill-rep>> ] [ spill-to>> ] tri ##spill, ;