]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg: virtual registers are integers now, and representations are stored...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 8 Aug 2009 09:02:18 +0000 (04:02 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 8 Aug 2009 09:02:18 +0000 (04:02 -0500)
41 files changed:
basis/compiler/cfg/alias-analysis/alias-analysis.factor
basis/compiler/cfg/builder/builder.factor
basis/compiler/cfg/cfg.factor
basis/compiler/cfg/dce/dce-tests.factor
basis/compiler/cfg/debugger/debugger.factor
basis/compiler/cfg/def-use/def-use-tests.factor
basis/compiler/cfg/gc-checks/gc-checks-tests.factor
basis/compiler/cfg/gc-checks/gc-checks.factor
basis/compiler/cfg/hats/hats.factor
basis/compiler/cfg/intrinsics/slots/slots.factor
basis/compiler/cfg/linear-scan/allocation/state/state.factor
basis/compiler/cfg/linear-scan/assignment/assignment.factor
basis/compiler/cfg/linear-scan/linear-scan-tests.factor
basis/compiler/cfg/linear-scan/linear-scan.factor
basis/compiler/cfg/linear-scan/resolve/resolve.factor
basis/compiler/cfg/liveness/liveness-tests.factor
basis/compiler/cfg/mr/mr.factor
basis/compiler/cfg/parallel-copy/parallel-copy-tests.factor
basis/compiler/cfg/parallel-copy/parallel-copy.factor
basis/compiler/cfg/registers/registers.factor
basis/compiler/cfg/renaming/renaming.factor
basis/compiler/cfg/representations/preferred/preferred-tests.factor [new file with mode: 0644]
basis/compiler/cfg/representations/preferred/preferred.factor
basis/compiler/cfg/representations/representations-tests.factor
basis/compiler/cfg/representations/representations.factor
basis/compiler/cfg/ssa/construction/construction-tests.factor
basis/compiler/cfg/ssa/construction/construction.factor
basis/compiler/cfg/ssa/cssa/cssa.factor
basis/compiler/cfg/ssa/destruction/destruction.factor
basis/compiler/cfg/ssa/interference/interference-tests.factor
basis/compiler/cfg/stacks/local/local.factor
basis/compiler/cfg/stacks/uninitialized/uninitialized-tests.factor
basis/compiler/cfg/two-operand/two-operand-tests.factor
basis/compiler/cfg/two-operand/two-operand.factor
basis/compiler/cfg/utilities/utilities.factor
basis/compiler/cfg/value-numbering/rewrite/rewrite.factor
basis/compiler/cfg/value-numbering/value-numbering-tests.factor
basis/compiler/cfg/value-numbering/value-numbering.factor
basis/compiler/cfg/write-barrier/write-barrier-tests.factor
basis/compiler/tests/low-level-ir.factor
basis/cpu/architecture/architecture.factor

index 8f7696e1009952d86491b0417d614c61e0a1ac82..c3d2deeb023ae31fadbab1d43a880e8422fb83f9 100644 (file)
@@ -226,7 +226,7 @@ M: ##read analyze-aliases*
     call-next-method
     dup [ dst>> ] [ insn-slot# ] [ insn-object ] tri
     2dup live-slot dup [
-        2nip int-rep \ ##copy new-insn analyze-aliases* nip
+        2nip any-rep \ ##copy new-insn analyze-aliases* nip
     ] [
         drop remember-slot
     ] if ;
index 05d922545d8eb5faf988cffd1750ec06cbabcc75..206dfac7860969040a5207b9ca04706da38daca7 100755 (executable)
@@ -145,7 +145,7 @@ M: #dispatch emit-node
     ! Inputs to the final instruction need to be copied because of
     ! loc>vreg sync. ^^offset>slot always returns a fresh vreg,
     ! though.
-    ds-pop ^^offset>slot i ##dispatch emit-if ;
+    ds-pop ^^offset>slot next-vreg ##dispatch emit-if ;
 
 ! #call
 M: #call emit-node
index 63466c510eed3175d9a04103a39e5d4f58632e1b..6a04f5b6270f80bdd01a7d3738df99aa3eb5a161 100644 (file)
@@ -19,7 +19,7 @@ M: basic-block hashcode* nip id>> ;
         V{ } clone >>predecessors
         \ basic-block counter >>id ;
 
-TUPLE: cfg { entry basic-block } word label spill-area-size post-order ;
+TUPLE: cfg { entry basic-block } word label spill-area-size reps post-order ;
 
 : <cfg> ( entry word label -- cfg )
     cfg new
index 403ce8803875374b049eee677166dd8df300e41a..6a7ef08257a0ed0a34bd60877f7138e3ba0ed7f3 100644 (file)
@@ -11,62 +11,62 @@ IN: compiler.cfg.dce.tests
     entry>> instructions>> ; 
 
 [ V{
-    T{ ##load-immediate { dst V int-rep 1 } { val 8 } }
-    T{ ##load-immediate { dst V int-rep 2 } { val 16 } }
-    T{ ##add { dst V int-rep 3 } { src1 V int-rep 1 } { src2 V int-rep 2 } }
-    T{ ##replace { src V int-rep 3 } { loc D 0 } }
+    T{ ##load-immediate { dst 1 } { val 8 } }
+    T{ ##load-immediate { dst 2 } { val 16 } }
+    T{ ##add { dst 3 } { src1 1 } { src2 2 } }
+    T{ ##replace { src 3 } { loc D 0 } }
 } ] [ V{
-    T{ ##load-immediate { dst V int-rep 1 } { val 8 } }
-    T{ ##load-immediate { dst V int-rep 2 } { val 16 } }
-    T{ ##add { dst V int-rep 3 } { src1 V int-rep 1 } { src2 V int-rep 2 } }
-    T{ ##replace { src V int-rep 3 } { loc D 0 } }
+    T{ ##load-immediate { dst 1 } { val 8 } }
+    T{ ##load-immediate { dst 2 } { val 16 } }
+    T{ ##add { dst 3 } { src1 1 } { src2 2 } }
+    T{ ##replace { src 3 } { loc D 0 } }
 } test-dce ] unit-test
 
 [ V{ } ] [ V{
-    T{ ##load-immediate { dst V int-rep 1 } { val 8 } }
-    T{ ##load-immediate { dst V int-rep 2 } { val 16 } }
-    T{ ##add { dst V int-rep 3 } { src1 V int-rep 1 } { src2 V int-rep 2 } }
+    T{ ##load-immediate { dst 1 } { val 8 } }
+    T{ ##load-immediate { dst 2 } { val 16 } }
+    T{ ##add { dst 3 } { src1 1 } { src2 2 } }
 } test-dce ] unit-test
 
 [ V{ } ] [ V{
-    T{ ##load-immediate { dst V int-rep 3 } { val 8 } }
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
+    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##allot { dst 1 } { temp 2 } }
 } test-dce ] unit-test
 
 [ V{ } ] [ V{
-    T{ ##load-immediate { dst V int-rep 3 } { val 8 } }
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##set-slot-imm { obj V int-rep 1 } { src V int-rep 3 } }
+    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##set-slot-imm { obj 1 } { src 3 } }
 } test-dce ] unit-test
 
 [ V{
-    T{ ##load-immediate { dst V int-rep 3 } { val 8 } }
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##set-slot-imm { obj V int-rep 1 } { src V int-rep 3 } }
-    T{ ##replace { src V int-rep 1 } { loc D 0 } }
+    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##set-slot-imm { obj 1 } { src 3 } }
+    T{ ##replace { src 1 } { loc D 0 } }
 } ] [ V{
-    T{ ##load-immediate { dst V int-rep 3 } { val 8 } }
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##set-slot-imm { obj V int-rep 1 } { src V int-rep 3 } }
-    T{ ##replace { src V int-rep 1 } { loc D 0 } }
+    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##set-slot-imm { obj 1 } { src 3 } }
+    T{ ##replace { src 1 } { loc D 0 } }
 } test-dce ] unit-test
 
 [ V{
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##replace { src V int-rep 1 } { loc D 0 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##replace { src 1 } { loc D 0 } }
 } ] [ V{
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##replace { src V int-rep 1 } { loc D 0 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##replace { src 1 } { loc D 0 } }
 } test-dce ] unit-test
 
 [ V{
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##replace { src V int-rep 1 } { loc D 0 } }
-    T{ ##load-immediate { dst V int-rep 3 } { val 8 } }
-    T{ ##set-slot-imm { obj V int-rep 1 } { src V int-rep 3 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##replace { src 1 } { loc D 0 } }
+    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##set-slot-imm { obj 1 } { src 3 } }
 } ] [ V{
-    T{ ##allot { dst V int-rep 1 } { temp V int-rep 2 } }
-    T{ ##replace { src V int-rep 1 } { loc D 0 } }
-    T{ ##load-immediate { dst V int-rep 3 } { val 8 } }
-    T{ ##set-slot-imm { obj V int-rep 1 } { src V int-rep 3 } }
+    T{ ##allot { dst 1 } { temp 2 } }
+    T{ ##replace { src 1 } { loc D 0 } }
+    T{ ##load-immediate { dst 3 } { val 8 } }
+    T{ ##set-slot-imm { obj 1 } { src 3 } }
 } test-dce ] unit-test
index df959abe26f7ff22deda3330af69e131a6e327db..bab17d160b396e1fdf1bfa5186bcd1d24ab05598 100644 (file)
@@ -4,11 +4,12 @@ USING: kernel words sequences quotations namespaces io vectors
 classes.tuple accessors prettyprint prettyprint.config assocs
 prettyprint.backend prettyprint.custom prettyprint.sections
 parser compiler.tree.builder compiler.tree.optimizer
-compiler.cfg.builder compiler.cfg.linearization
+cpu.architecture compiler.cfg.builder compiler.cfg.linearization
 compiler.cfg.registers compiler.cfg.stack-frame
 compiler.cfg.linear-scan compiler.cfg.two-operand
 compiler.cfg.optimizer compiler.cfg.instructions
-compiler.cfg.utilities compiler.cfg.mr compiler.cfg ;
+compiler.cfg.utilities compiler.cfg.def-use
+compiler.cfg.rpo compiler.cfg.mr compiler.cfg ;
 IN: compiler.cfg.debugger
 
 GENERIC: test-cfg ( quot -- cfgs )
@@ -41,11 +42,6 @@ M: word test-cfg
     ] each ;
 
 ! Prettyprinting
-M: vreg pprint*
-    <block
-    \ V pprint-word [ rep>> pprint* ] [ n>> pprint* ] bi
-    block> ;
-
 : pprint-loc ( loc word -- ) <block pprint-word n>> pprint* block> ;
 
 M: ds-loc pprint* \ D pprint-loc ;
@@ -71,4 +67,12 @@ M: rs-loc pprint* \ R pprint-loc ;
     0 1 edge
     1 { 2 3 } edges
     2 4 edge
-    3 4 edge ;
\ No newline at end of file
+    3 4 edge ;
+
+: fake-representations ( cfg -- )
+    post-order [
+        instructions>>
+        [ [ temp-vregs ] [ defs-vreg ] bi [ suffix ] when* ]
+        map concat
+    ] map concat
+    [ int-rep ] H{ } map>assoc representations set ;
\ No newline at end of file
index 50d336c28e6211fa9d52a39fbde8c07b513c0b0b..21978d0f9bed79dc5521748166766be58d4be21a 100644 (file)
@@ -10,23 +10,23 @@ compiler.cfg.instructions
 compiler.cfg.registers ;
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##peek f V int-rep 1 D 0 }
-    T{ ##peek f V int-rep 2 D 0 }
+    T{ ##peek f 0 D 0 }
+    T{ ##peek f 1 D 0 }
+    T{ ##peek f 2 D 0 }
 } 1 test-bb
 V{
-    T{ ##replace f V int-rep 2 D 0 }
+    T{ ##replace f 2 D 0 }
 } 2 test-bb
 1 2 edge
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
 } 3 test-bb
 2 3 edge
 V{ } 4 test-bb
 V{ } 5 test-bb
 3 { 4 5 } edges
 V{
-    T{ ##phi f V int-rep 2 H{ { 2 V int-rep 0 } { 3 V int-rep 1 } } }
+    T{ ##phi f 2 H{ { 2 0 } { 3 1 } } }
 } 6 test-bb
 4 6 edge
 5 6 edge
index a51b8aa36d41b1f98cda6f13a36fabcffc170706..ac7ebd94e8d856707f53274770ff62f09381ba4d 100644 (file)
@@ -5,6 +5,7 @@ compiler.cfg.predecessors cpu.architecture tools.test kernel vectors
 namespaces accessors sequences ;
 
 : test-gc-checks ( -- )
+    H{ } clone representations set
     cfg new 0 get >>entry
     compute-predecessors
     insert-gc-checks
@@ -12,11 +13,11 @@ namespaces accessors sequences ;
 
 V{
     T{ ##inc-d f 3 }
-    T{ ##replace f V int-rep 0 D 1 }
+    T{ ##replace f 0 D 1 }
 } 0 test-bb
 
 V{
-    T{ ##box-float f V int-rep 0 V int-rep 1 }
+    T{ ##box-float f 0 1 }
 } 1 test-bb
 
 0 1 edge
index 36ef51ae02fbef05d5131875b3a91c528f3384dd..21a60768ea27edb96a7412d2eba4ba09b2d548f1 100644 (file)
@@ -1,13 +1,16 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel sequences assocs fry
+cpu.architecture
 compiler.cfg.rpo
-compiler.cfg.hats
 compiler.cfg.registers
 compiler.cfg.instructions
 compiler.cfg.stacks.uninitialized ;
 IN: compiler.cfg.gc-checks
 
+! Garbage collection check insertion. This pass runs after representation
+! selection, so it must keep track of representations.
+
 : insert-gc-check? ( bb -- ? )
     instructions>> [ ##allocation? ] any? ;
 
@@ -16,7 +19,9 @@ IN: compiler.cfg.gc-checks
 
 : insert-gc-check ( bb -- )
     dup '[
-        i i f f _ uninitialized-locs \ ##gc new-insn
+        int-rep next-vreg-rep
+        int-rep next-vreg-rep
+        f f _ uninitialized-locs \ ##gc new-insn
         prefix
     ] change-instructions drop ;
 
index c53709024ca811faaedfde7ff18bc60eb5f3165b..04fddbb2036ae83711bb8953975e9c5b11a76f87 100644 (file)
@@ -5,77 +5,70 @@ sequences classes.tuple cpu.architecture compiler.cfg.registers
 compiler.cfg.instructions ;
 IN: compiler.cfg.hats
 
-: i ( -- vreg ) int-rep next-vreg ; inline
-: ^^i ( -- vreg vreg ) i dup ; inline
-: ^^i1 ( obj -- vreg vreg obj ) [ ^^i ] dip ; inline
-: ^^i2 ( obj obj -- vreg vreg obj obj ) [ ^^i ] 2dip ; inline
-: ^^i3 ( obj obj obj -- vreg vreg obj obj obj ) [ ^^i ] 3dip ; inline
+: ^^r ( -- vreg vreg ) next-vreg dup ; inline
+: ^^r1 ( obj -- vreg vreg obj ) [ ^^r ] dip ; inline
+: ^^r2 ( obj obj -- vreg vreg obj obj ) [ ^^r ] 2dip ; inline
+: ^^r3 ( obj obj obj -- vreg vreg obj obj obj ) [ ^^r ] 3dip ; inline
 
-: d ( -- vreg ) double-float-rep next-vreg ; inline
-: ^^d  ( -- vreg vreg ) d dup ; inline
-: ^^d1 ( obj -- vreg vreg obj ) [ ^^d ] dip ; inline
-: ^^d2 ( obj obj -- vreg vreg obj obj ) [ ^^d ] 2dip ; inline
-: ^^d3 ( obj obj obj -- vreg vreg obj obj obj ) [ ^^d ] 3dip ; inline
-
-: ^^load-literal ( obj -- dst ) ^^i1 ##load-literal ; inline
-: ^^copy ( src -- dst ) ^^i1 dup rep>> ##copy ; inline
-: ^^slot ( obj slot tag -- dst ) ^^i3 i ##slot ; inline
-: ^^slot-imm ( obj slot tag -- dst ) ^^i3 ##slot-imm ; inline
-: ^^set-slot ( src obj slot tag -- ) i ##set-slot ; inline
-: ^^string-nth ( obj index -- dst ) ^^i2 i ##string-nth ; inline
-: ^^add ( src1 src2 -- dst ) ^^i2 ##add ; inline
-: ^^add-imm ( src1 src2 -- dst ) ^^i2 ##add-imm ; inline
-: ^^sub ( src1 src2 -- dst ) ^^i2 ##sub ; inline
-: ^^sub-imm ( src1 src2 -- dst ) ^^i2 ##sub-imm ; inline
+: ^^load-literal ( obj -- dst ) ^^r1 ##load-literal ; inline
+: ^^copy ( src -- dst ) ^^r1 any-rep ##copy ; inline
+: ^^slot ( obj slot tag -- dst ) ^^r3 next-vreg ##slot ; inline
+: ^^slot-imm ( obj slot tag -- dst ) ^^r3 ##slot-imm ; inline
+: ^^set-slot ( src obj slot tag -- ) next-vreg ##set-slot ; inline
+: ^^string-nth ( obj index -- dst ) ^^r2 next-vreg ##string-nth ; inline
+: ^^add ( src1 src2 -- dst ) ^^r2 ##add ; inline
+: ^^add-imm ( src1 src2 -- dst ) ^^r2 ##add-imm ; inline
+: ^^sub ( src1 src2 -- dst ) ^^r2 ##sub ; inline
+: ^^sub-imm ( src1 src2 -- dst ) ^^r2 ##sub-imm ; inline
 : ^^neg ( src -- dst ) [ 0 ^^load-literal ] dip ^^sub ; inline
-: ^^mul ( src1 src2 -- dst ) ^^i2 ##mul ; inline
-: ^^mul-imm ( src1 src2 -- dst ) ^^i2 ##mul-imm ; inline
-: ^^and ( input mask -- output ) ^^i2 ##and ; inline
-: ^^and-imm ( input mask -- output ) ^^i2 ##and-imm ; inline
-: ^^or ( src1 src2 -- dst ) ^^i2 ##or ; inline
-: ^^or-imm ( src1 src2 -- dst ) ^^i2 ##or-imm ; inline
-: ^^xor ( src1 src2 -- dst ) ^^i2 ##xor ; inline
-: ^^xor-imm ( src1 src2 -- dst ) ^^i2 ##xor-imm ; inline
-: ^^shl ( src1 src2 -- dst ) ^^i2 ##shl ; inline
-: ^^shl-imm ( src1 src2 -- dst ) ^^i2 ##shl-imm ; inline
-: ^^shr ( src1 src2 -- dst ) ^^i2 ##shr ; inline
-: ^^shr-imm ( src1 src2 -- dst ) ^^i2 ##shr-imm ; inline
-: ^^sar ( src1 src2 -- dst ) ^^i2 ##sar ; inline
-: ^^sar-imm ( src1 src2 -- dst ) ^^i2 ##sar-imm ; inline
-: ^^not ( src -- dst ) ^^i1 ##not ; inline
-: ^^log2 ( src -- dst ) ^^i1 ##log2 ; inline
-: ^^bignum>integer ( src -- dst ) ^^i1 i ##bignum>integer ; inline
-: ^^integer>bignum ( src -- dst ) ^^i1 i ##integer>bignum ; inline
-: ^^add-float ( src1 src2 -- dst ) ^^d2 ##add-float ; inline
-: ^^sub-float ( src1 src2 -- dst ) ^^d2 ##sub-float ; inline
-: ^^mul-float ( src1 src2 -- dst ) ^^d2 ##mul-float ; inline
-: ^^div-float ( src1 src2 -- dst ) ^^d2 ##div-float ; inline
-: ^^float>integer ( src -- dst ) ^^i1 ##float>integer ; inline
-: ^^integer>float ( src -- dst ) ^^d1 ##integer>float ; inline
-: ^^allot ( size class -- dst ) ^^i2 i ##allot ; inline
+: ^^mul ( src1 src2 -- dst ) ^^r2 ##mul ; inline
+: ^^mul-imm ( src1 src2 -- dst ) ^^r2 ##mul-imm ; inline
+: ^^and ( input mask -- output ) ^^r2 ##and ; inline
+: ^^and-imm ( input mask -- output ) ^^r2 ##and-imm ; inline
+: ^^or ( src1 src2 -- dst ) ^^r2 ##or ; inline
+: ^^or-imm ( src1 src2 -- dst ) ^^r2 ##or-imm ; inline
+: ^^xor ( src1 src2 -- dst ) ^^r2 ##xor ; inline
+: ^^xor-imm ( src1 src2 -- dst ) ^^r2 ##xor-imm ; inline
+: ^^shl ( src1 src2 -- dst ) ^^r2 ##shl ; inline
+: ^^shl-imm ( src1 src2 -- dst ) ^^r2 ##shl-imm ; inline
+: ^^shr ( src1 src2 -- dst ) ^^r2 ##shr ; inline
+: ^^shr-imm ( src1 src2 -- dst ) ^^r2 ##shr-imm ; inline
+: ^^sar ( src1 src2 -- dst ) ^^r2 ##sar ; inline
+: ^^sar-imm ( src1 src2 -- dst ) ^^r2 ##sar-imm ; inline
+: ^^not ( src -- dst ) ^^r1 ##not ; inline
+: ^^log2 ( src -- dst ) ^^r1 ##log2 ; inline
+: ^^bignum>integer ( src -- dst ) ^^r1 next-vreg ##bignum>integer ; inline
+: ^^integer>bignum ( src -- dst ) ^^r1 next-vreg ##integer>bignum ; inline
+: ^^add-float ( src1 src2 -- dst ) ^^r2 ##add-float ; inline
+: ^^sub-float ( src1 src2 -- dst ) ^^r2 ##sub-float ; inline
+: ^^mul-float ( src1 src2 -- dst ) ^^r2 ##mul-float ; inline
+: ^^div-float ( src1 src2 -- dst ) ^^r2 ##div-float ; inline
+: ^^float>integer ( src -- dst ) ^^r1 ##float>integer ; inline
+: ^^integer>float ( src -- dst ) ^^r1 ##integer>float ; inline
+: ^^allot ( size class -- dst ) ^^r2 next-vreg ##allot ; inline
 : ^^allot-tuple ( n -- dst ) 2 + cells tuple ^^allot ; inline
 : ^^allot-array ( n -- dst ) 2 + cells array ^^allot ; inline
 : ^^allot-byte-array ( n -- dst ) 2 cells + byte-array ^^allot ; inline
-: ^^box-alien ( src -- dst ) ^^i1 i ##box-alien ; inline
-: ^^unbox-alien ( src -- dst ) ^^i1 ##unbox-alien ; inline
-: ^^unbox-c-ptr ( src class -- dst ) ^^i2 i ##unbox-c-ptr ;
-: ^^alien-unsigned-1 ( src -- dst ) ^^i1 ##alien-unsigned-1 ; inline
-: ^^alien-unsigned-2 ( src -- dst ) ^^i1 ##alien-unsigned-2 ; inline
-: ^^alien-unsigned-4 ( src -- dst ) ^^i1 ##alien-unsigned-4 ; inline
-: ^^alien-signed-1 ( src -- dst ) ^^i1 ##alien-signed-1 ; inline
-: ^^alien-signed-2 ( src -- dst ) ^^i1 ##alien-signed-2 ; inline
-: ^^alien-signed-4 ( src -- dst ) ^^i1 ##alien-signed-4 ; inline
-: ^^alien-cell ( src -- dst ) ^^i1 ##alien-cell ; inline
-: ^^alien-float ( src -- dst ) ^^d1 ##alien-float ; inline
-: ^^alien-double ( src -- dst ) ^^d1 ##alien-double ; inline
-: ^^alien-global ( symbol library -- dst ) ^^i2 ##alien-global ; inline
-: ^^compare ( src1 src2 cc -- dst ) ^^i3 i ##compare ; inline
-: ^^compare-imm ( src1 src2 cc -- dst ) ^^i3 i ##compare-imm ; inline
-: ^^compare-float ( src1 src2 cc -- dst ) ^^i3 i ##compare-float ; inline
+: ^^box-alien ( src -- dst ) ^^r1 next-vreg ##box-alien ; inline
+: ^^unbox-alien ( src -- dst ) ^^r1 ##unbox-alien ; inline
+: ^^unbox-c-ptr ( src class -- dst ) ^^r2 next-vreg ##unbox-c-ptr ;
+: ^^alien-unsigned-1 ( src -- dst ) ^^r1 ##alien-unsigned-1 ; inline
+: ^^alien-unsigned-2 ( src -- dst ) ^^r1 ##alien-unsigned-2 ; inline
+: ^^alien-unsigned-4 ( src -- dst ) ^^r1 ##alien-unsigned-4 ; inline
+: ^^alien-signed-1 ( src -- dst ) ^^r1 ##alien-signed-1 ; inline
+: ^^alien-signed-2 ( src -- dst ) ^^r1 ##alien-signed-2 ; inline
+: ^^alien-signed-4 ( src -- dst ) ^^r1 ##alien-signed-4 ; inline
+: ^^alien-cell ( src -- dst ) ^^r1 ##alien-cell ; inline
+: ^^alien-float ( src -- dst ) ^^r1 ##alien-float ; inline
+: ^^alien-double ( src -- dst ) ^^r1 ##alien-double ; inline
+: ^^alien-global ( symbol library -- dst ) ^^r2 ##alien-global ; inline
+: ^^compare ( src1 src2 cc -- dst ) ^^r3 next-vreg ##compare ; inline
+: ^^compare-imm ( src1 src2 cc -- dst ) ^^r3 next-vreg ##compare-imm ; inline
+: ^^compare-float ( src1 src2 cc -- dst ) ^^r3 next-vreg ##compare-float ; inline
 : ^^offset>slot ( vreg -- vreg' ) cell 4 = [ 1 ^^shr-imm ] [ ^^copy ] if ; inline
-: ^^tag-fixnum ( src -- dst ) ^^i1 ##tag-fixnum ; inline
-: ^^untag-fixnum ( src -- dst ) ^^i1 ##untag-fixnum ; inline
-: ^^fixnum-add ( src1 src2 -- dst ) ^^i2 ##fixnum-add ; inline
-: ^^fixnum-sub ( src1 src2 -- dst ) ^^i2 ##fixnum-sub ; inline
-: ^^fixnum-mul ( src1 src2 -- dst ) ^^i2 ##fixnum-mul ; inline
-: ^^phi ( inputs -- dst ) ^^i1 ##phi ; inline
\ No newline at end of file
+: ^^tag-fixnum ( src -- dst ) ^^r1 ##tag-fixnum ; inline
+: ^^untag-fixnum ( src -- dst ) ^^r1 ##untag-fixnum ; inline
+: ^^fixnum-add ( src1 src2 -- dst ) ^^r2 ##fixnum-add ; inline
+: ^^fixnum-sub ( src1 src2 -- dst ) ^^r2 ##fixnum-sub ; inline
+: ^^fixnum-mul ( src1 src2 -- dst ) ^^r2 ##fixnum-mul ; inline
+: ^^phi ( inputs -- dst ) ^^r1 ##phi ; inline
\ No newline at end of file
index 93139a19a3169098cd6b47337ace561ed20af11f..79e56c08ad171c0c464a6bc0fe3f464eafbb8f22 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: layouts namespaces kernel accessors sequences
-classes.algebra compiler.tree.propagation.info
-compiler.cfg.stacks compiler.cfg.hats compiler.cfg.instructions
+USING: layouts namespaces kernel accessors sequences classes.algebra
+compiler.tree.propagation.info compiler.cfg.stacks compiler.cfg.hats
+compiler.cfg.registers compiler.cfg.instructions
 compiler.cfg.utilities compiler.cfg.builder.blocks ;
 IN: compiler.cfg.intrinsics.slots
 
@@ -45,7 +45,7 @@ IN: compiler.cfg.intrinsics.slots
             dup third value-info-small-fixnum?
             [ (emit-set-slot-imm) ] [ (emit-set-slot) ] if
         ] [ first class>> immediate class<= ] bi
-        [ drop ] [ i i ##write-barrier ] if
+        [ drop ] [ next-vreg next-vreg ##write-barrier ] if
     ] [ drop emit-primitive ] if ;
 
 : emit-string-nth ( -- )
@@ -53,4 +53,4 @@ IN: compiler.cfg.intrinsics.slots
 
 : emit-set-string-nth-fast ( -- )
     3inputs [ ^^untag-fixnum ] [ ^^untag-fixnum ] [ ] tri*
-    swap i ##set-string-nth-fast ;
+    swap next-vreg ##set-string-nth-fast ;
index 20ce3412843d70fb173104c985e490bca8494b92..cf120eae3beba13223b203280f98e58f3357f413 100644 (file)
@@ -2,7 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators cpu.architecture fry heaps
 kernel math math.order namespaces sequences vectors
-compiler.cfg compiler.cfg.linear-scan.live-intervals ;
+compiler.cfg compiler.cfg.registers
+compiler.cfg.linear-scan.live-intervals ;
 IN: compiler.cfg.linear-scan.allocation.state
 
 ! Start index of current live interval. We ensure that all
@@ -26,7 +27,7 @@ SYMBOL: registers
 SYMBOL: active-intervals
 
 : active-intervals-for ( vreg -- seq )
-    rep>> reg-class-of active-intervals get at ;
+    rep-of reg-class-of active-intervals get at ;
 
 : add-active ( live-interval -- )
     dup vreg>> active-intervals-for push ;
@@ -41,7 +42,7 @@ SYMBOL: active-intervals
 SYMBOL: inactive-intervals
 
 : inactive-intervals-for ( vreg -- seq )
-    rep>> reg-class-of inactive-intervals get at ;
+    rep-of reg-class-of inactive-intervals get at ;
 
 : add-inactive ( live-interval -- )
     dup vreg>> inactive-intervals-for push ;
@@ -123,7 +124,7 @@ SYMBOL: unhandled-intervals
 SYMBOL: spill-slots
 
 : assign-spill-slot ( vreg -- n )
-    spill-slots get [ rep>> next-spill-slot ] cache ;
+    spill-slots get [ rep-of next-spill-slot ] cache ;
 
 : init-allocator ( registers -- )
     registers set
@@ -141,7 +142,7 @@ SYMBOL: spill-slots
 
 ! A utility used by register-status and spill-status words
 : free-positions ( new -- assoc )
-    vreg>> rep>> reg-class-of registers get at [ 1/0. ] H{ } map>assoc ;
+    vreg>> rep-of reg-class-of registers get at [ 1/0. ] H{ } map>assoc ;
 
 : add-use-position ( n reg assoc -- ) [ [ min ] when* ] change-at ;
 
index 8b3c5be7f0e1bcdb26c0ea8fedfec430cd193e7d..c05103f244a0c2eedc3e87e94e5b55ac6cb06bc6 100644 (file)
@@ -52,7 +52,7 @@ SYMBOL: register-live-outs
     init-unhandled ;
 
 : insert-spill ( live-interval -- )
-    [ reg>> ] [ vreg>> rep>> ] [ spill-to>> ] tri _spill ;
+    [ reg>> ] [ vreg>> rep-of ] [ spill-to>> ] tri _spill ;
 
 : handle-spill ( live-interval -- )
     dup spill-to>> [ insert-spill ] [ drop ] if ;
@@ -72,7 +72,7 @@ SYMBOL: register-live-outs
     pending-interval-heap get (expire-old-intervals) ;
 
 : insert-reload ( live-interval -- )
-    [ reg>> ] [ vreg>> rep>> ] [ reload-from>> ] tri _reload ;
+    [ reg>> ] [ vreg>> rep-of ] [ reload-from>> ] tri _reload ;
 
 : handle-reload ( live-interval -- )
     dup reload-from>> [ insert-reload ] [ drop ] if ;
@@ -108,10 +108,10 @@ M: vreg-insn assign-registers-in-insn
 : trace-on-gc ( assoc -- assoc' )
     ! When a GC occurs, virtual registers which contain tagged data
     ! are traced by the GC. Outputs a sequence physical registers.
-    [ drop rep>> int-rep eq? ] { } assoc-filter-as values ;
+    [ drop rep-of int-rep eq? ] { } assoc-filter-as values ;
 
 : spill-on-gc? ( vreg reg -- ? )
-    [ rep>> int-rep? not ] [ spill-slot? not ] bi* and ;
+    [ rep-of int-rep? not ] [ spill-slot? not ] bi* and ;
 
 : spill-on-gc ( assoc -- assoc' )
     ! When a GC occurs, virtual registers which contain untagged data,
@@ -123,7 +123,7 @@ M: vreg-insn assign-registers-in-insn
     [
         [
             2dup spill-on-gc?
-            [ swap [ assign-spill-slot ] [ rep>> ] bi 3array , ] [ 2drop ] if
+            [ swap [ assign-spill-slot ] [ rep-of ] bi 3array , ] [ 2drop ] if
         ] assoc-each
     ] { } make ;
 
index 7794fc47e8b839b0b7789220c2a6ead47b7ea7f8..1580ee3f653b81ceb4a809da8f6f5146367e9c99 100644 (file)
@@ -11,6 +11,7 @@ compiler.cfg.predecessors
 compiler.cfg.rpo
 compiler.cfg.linearization
 compiler.cfg.debugger
+compiler.cfg.def-use
 compiler.cfg.comparisons
 compiler.cfg.linear-scan
 compiler.cfg.linear-scan.numbering
@@ -78,9 +79,15 @@ check-numbering? on
 cfg new 0 >>spill-area-size cfg set
 H{ } spill-slots set
 
+H{
+    { 1 single-float-rep }
+    { 2 single-float-rep }
+    { 3 single-float-rep }
+} representations set
+
 [
     T{ live-interval
-       { vreg V single-float-rep 1 }
+       { vreg 1 }
        { start 0 }
        { end 2 }
        { uses V{ 0 1 } }
@@ -88,7 +95,7 @@ H{ } spill-slots set
        { spill-to 0 }
     }
     T{ live-interval
-       { vreg V single-float-rep 1 }
+       { vreg 1 }
        { start 5 }
        { end 5 }
        { uses V{ 5 } }
@@ -97,7 +104,7 @@ H{ } spill-slots set
     }
 ] [
     T{ live-interval
-       { vreg V single-float-rep 1 }
+       { vreg 1 }
        { start 0 }
        { end 5 }
        { uses V{ 0 1 5 } }
@@ -107,7 +114,7 @@ H{ } spill-slots set
 
 [
     T{ live-interval
-       { vreg V single-float-rep 2 }
+       { vreg 2 }
        { start 0 }
        { end 1 }
        { uses V{ 0 } }
@@ -115,7 +122,7 @@ H{ } spill-slots set
        { spill-to 4 }
     }
     T{ live-interval
-       { vreg V single-float-rep 2 }
+       { vreg 2 }
        { start 1 }
        { end 5 }
        { uses V{ 1 5 } }
@@ -124,7 +131,7 @@ H{ } spill-slots set
     }
 ] [
     T{ live-interval
-       { vreg V single-float-rep 2 }
+       { vreg 2 }
        { start 0 }
        { end 5 }
        { uses V{ 0 1 5 } }
@@ -134,7 +141,7 @@ H{ } spill-slots set
 
 [
     T{ live-interval
-       { vreg V single-float-rep 3 }
+       { vreg 3 }
        { start 0 }
        { end 1 }
        { uses V{ 0 } }
@@ -142,7 +149,7 @@ H{ } spill-slots set
        { spill-to 8 }
     }
     T{ live-interval
-       { vreg V single-float-rep 3 }
+       { vreg 3 }
        { start 20 }
        { end 30 }
        { uses V{ 20 30 } }
@@ -151,7 +158,7 @@ H{ } spill-slots set
     }
 ] [
     T{ live-interval
-       { vreg V single-float-rep 3 }
+       { vreg 3 }
        { start 0 }
        { end 30 }
        { uses V{ 0 20 30 } }
@@ -159,6 +166,12 @@ H{ } spill-slots set
     } 10 split-for-spill
 ] unit-test
 
+H{
+    { 1 int-rep }
+    { 2 int-rep }
+    { 3 int-rep }
+} representations set
+
 [
     {
         3
@@ -169,21 +182,21 @@ H{ } spill-slots set
         { int-regs
           V{
               T{ live-interval
-                 { vreg V int-rep 1 }
+                 { vreg 1 }
                  { reg 1 }
                  { start 1 }
                  { end 15 }
                  { uses V{ 1 3 7 10 15 } }
               }
               T{ live-interval
-                 { vreg V int-rep 2 }
+                 { vreg 2 }
                  { reg 2 }
                  { start 3 }
                  { end 8 }
                  { uses V{ 3 4 8 } }
               }
               T{ live-interval
-                 { vreg V int-rep 3 }
+                 { vreg 3 }
                  { reg 3 }
                  { start 3 }
                  { end 10 }
@@ -194,7 +207,7 @@ H{ } spill-slots set
     } active-intervals set
     H{ } inactive-intervals set
     T{ live-interval
-        { vreg V int-rep 1 }
+        { vreg 1 }
         { start 5 }
         { end 5 }
         { uses V{ 5 } }
@@ -212,14 +225,14 @@ H{ } spill-slots set
         { int-regs
           V{
               T{ live-interval
-                 { vreg V int-rep 1 }
+                 { vreg 1 }
                  { reg 1 }
                  { start 1 }
                  { end 15 }
                  { uses V{ 1 } }
               }
               T{ live-interval
-                 { vreg V int-rep 2 }
+                 { vreg 2 }
                  { reg 2 }
                  { start 3 }
                  { end 8 }
@@ -230,7 +243,7 @@ H{ } spill-slots set
     } active-intervals set
     H{ } inactive-intervals set
     T{ live-interval
-        { vreg V int-rep 3 }
+        { vreg 3 }
         { start 5 }
         { end 5 }
         { uses V{ 5 } }
@@ -238,10 +251,12 @@ H{ } spill-slots set
     spill-status
 ] unit-test
 
+H{ { 1 int-rep } { 2 int-rep } } representations set
+
 [ ] [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 100 }
            { uses V{ 0 100 } }
@@ -255,14 +270,14 @@ H{ } spill-slots set
 [ ] [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 10 }
            { uses V{ 0 10 } }
            { ranges V{ T{ live-range f 0 10 } } }
         }
         T{ live-interval
-           { vreg V int-rep 2 }
+           { vreg 2 }
            { start 11 }
            { end 20 }
            { uses V{ 11 20 } }
@@ -276,14 +291,14 @@ H{ } spill-slots set
 [ ] [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 100 }
            { uses V{ 0 100 } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
         T{ live-interval
-           { vreg V int-rep 2 }
+           { vreg 2 }
            { start 30 }
            { end 60 }
            { uses V{ 30 60 } }
@@ -297,14 +312,14 @@ H{ } spill-slots set
 [ ] [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 100 }
            { uses V{ 0 100 } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
         T{ live-interval
-           { vreg V int-rep 2 }
+           { vreg 2 }
            { start 30 }
            { end 200 }
            { uses V{ 30 200 } }
@@ -318,14 +333,14 @@ H{ } spill-slots set
 [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 100 }
            { uses V{ 0 100 } }
            { ranges V{ T{ live-range f 0 100 } } }
         }
         T{ live-interval
-           { vreg V int-rep 2 }
+           { vreg 2 }
            { start 30 }
            { end 100 }
            { uses V{ 30 100 } }
@@ -337,32 +352,39 @@ H{ } spill-slots set
 ] must-fail
 
 ! Problem with spilling intervals with no more usages after the spill location
+H{
+    { 1 int-rep }
+    { 2 int-rep }
+    { 3 int-rep }
+    { 4 int-rep }
+    { 5 int-rep }
+} representations set
 
 [ ] [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 20 }
            { uses V{ 0 10 20 } }
            { ranges V{ T{ live-range f 0 2 } T{ live-range f 10 20 } } }
         }
         T{ live-interval
-           { vreg V int-rep 2 }
+           { vreg 2 }
            { start 0 }
            { end 20 }
            { uses V{ 0 10 20 } }
            { ranges V{ T{ live-range f 0 2 } T{ live-range f 10 20 } } }
         }
         T{ live-interval
-           { vreg V int-rep 3 }
+           { vreg 3 }
            { start 4 }
            { end 8 }
            { uses V{ 6 } }
            { ranges V{ T{ live-range f 4 8 } } }
         }
         T{ live-interval
-           { vreg V int-rep 4 }
+           { vreg 4 }
            { start 4 }
            { end 8 }
            { uses V{ 8 } }
@@ -371,7 +393,7 @@ H{ } spill-slots set
 
         ! This guy will invoke the 'spill partially available' code path
         T{ live-interval
-           { vreg V int-rep 5 }
+           { vreg 5 }
            { start 4 }
            { end 8 }
            { uses V{ 8 } }
@@ -382,13 +404,12 @@ H{ } spill-slots set
     check-linear-scan
 ] unit-test
 
-
 ! Test spill-new code path
 
 [ ] [
     {
         T{ live-interval
-           { vreg V int-rep 1 }
+           { vreg 1 }
            { start 0 }
            { end 10 }
            { uses V{ 0 6 10 } }
@@ -397,7 +418,7 @@ H{ } spill-slots set
 
         ! This guy will invoke the 'spill new' code path
         T{ live-interval
-           { vreg V int-rep 5 }
+           { vreg 5 }
            { start 2 }
            { end 8 }
            { uses V{ 8 } }
@@ -408,948 +429,6 @@ H{ } spill-slots set
     check-linear-scan
 ] unit-test
 
-SYMBOL: available
-
-SYMBOL: taken
-
-SYMBOL: max-registers
-
-SYMBOL: max-insns
-
-SYMBOL: max-uses
-
-: not-taken ( -- n )
-    available get keys dup empty? [ "Oops" throw ] when
-    random
-    dup taken get nth 1 + max-registers get = [
-        dup available get delete-at
-    ] [
-        dup taken get [ 1 + ] change-nth
-    ] if ;
-
-: random-live-intervals ( num-intervals max-uses max-registers max-insns -- seq )
-    [
-        max-insns set
-        max-registers set
-        max-uses set
-        max-insns get [ 0 ] replicate taken set
-        max-insns get [ dup ] H{ } map>assoc available set
-        [
-            \ live-interval new
-                swap int-rep swap vreg boa >>vreg
-                max-uses get random 2 max [ not-taken 2 * ] replicate natural-sort
-                [ >>uses ] [ first >>start ] bi
-                dup uses>> last >>end
-                dup [ start>> ] [ end>> ] bi <live-range> 1vector >>ranges
-        ] map
-    ] with-scope ;
-
-: random-test ( num-intervals max-uses max-registers max-insns -- )
-    over [ random-live-intervals ] dip int-regs associate check-linear-scan ;
-
-[ ] [ 30 2 1 60 random-test ] unit-test
-[ ] [ 60 2 2 60 random-test ] unit-test
-[ ] [ 80 2 3 200 random-test ] unit-test
-[ ] [ 70 2 5 30 random-test ] unit-test
-[ ] [ 60 2 6 30 random-test ] unit-test
-[ ] [ 1 2 10 10 random-test ] unit-test
-
-[ ] [ 10 4 2 60 random-test ] unit-test
-[ ] [ 10 20 2 400 random-test ] unit-test
-[ ] [ 10 20 4 300 random-test ] unit-test
-
-USING: math.private ;
-
-[ ] [
-    [ float+ float>fixnum 3 fixnum*fast ]
-    test-cfg first optimize-cfg linear-scan drop
-] unit-test
-
-: fake-live-ranges ( seq -- seq' )
-    [
-        clone dup [ start>> ] [ end>> ] bi <live-range> 1vector >>ranges
-    ] map ;
-
-[ ] [
-    {
-        T{ live-interval
-            { vreg V int-rep 70 }
-            { start 14 }
-            { end 17 }
-            { uses V{ 14 15 16 17 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 67 }
-            { start 13 }
-            { end 14 }
-            { uses V{ 13 14 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 30 }
-            { start 4 }
-            { end 18 }
-            { uses V{ 4 12 16 17 18 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 27 }
-            { start 3 }
-            { end 13 }
-            { uses V{ 3 7 13 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 59 }
-            { start 10 }
-            { end 18 }
-            { uses V{ 10 11 12 18 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 60 }
-            { start 12 }
-            { end 17 }
-            { uses V{ 12 17 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 56 }
-            { start 9 }
-            { end 10 }
-            { uses V{ 9 10 } }
-        }
-    } fake-live-ranges
-    { { int-regs { 0 1 2 3 } } }
-    allocate-registers drop
-] unit-test
-
-[ ] [
-    {
-        T{ live-interval
-            { vreg V int-rep 3687168 }
-            { start 106 }
-            { end 112 }
-            { uses V{ 106 112 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687169 }
-            { start 107 }
-            { end 113 }
-            { uses V{ 107 113 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687727 }
-            { start 190 }
-            { end 198 }
-            { uses V{ 190 195 198 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686445 }
-            { start 43 }
-            { end 44 }
-            { uses V{ 43 44 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686195 }
-            { start 5 }
-            { end 11 }
-            { uses V{ 5 11 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686449 }
-            { start 44 }
-            { end 56 }
-            { uses V{ 44 45 45 46 56 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686198 }
-            { start 8 }
-            { end 10 }
-            { uses V{ 8 9 10 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686454 }
-            { start 46 }
-            { end 49 }
-            { uses V{ 46 47 47 49 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686196 }
-            { start 6 }
-            { end 12 }
-            { uses V{ 6 12 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686197 }
-            { start 7 }
-            { end 14 }
-            { uses V{ 7 13 14 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686455 }
-            { start 48 }
-            { end 51 }
-            { uses V{ 48 51 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686463 }
-            { start 52 }
-            { end 53 }
-            { uses V{ 52 53 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686460 }
-            { start 49 }
-            { end 52 }
-            { uses V{ 49 50 50 52 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686461 }
-            { start 51 }
-            { end 71 }
-            { uses V{ 51 52 64 68 71 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686464 }
-            { start 53 }
-            { end 54 }
-            { uses V{ 53 54 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686465 }
-            { start 54 }
-            { end 76 }
-            { uses V{ 54 55 55 76 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686470 }
-            { start 58 }
-            { end 60 }
-            { uses V{ 58 59 59 60 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686469 }
-            { start 56 }
-            { end 58 }
-            { uses V{ 56 57 57 58 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686473 }
-            { start 60 }
-            { end 62 }
-            { uses V{ 60 61 61 62 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686479 }
-            { start 62 }
-            { end 64 }
-            { uses V{ 62 63 63 64 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686735 }
-            { start 78 }
-            { end 96 }
-            { uses V{ 78 79 79 96 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686482 }
-            { start 64 }
-            { end 65 }
-            { uses V{ 64 65 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686483 }
-            { start 65 }
-            { end 66 }
-            { uses V{ 65 66 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687510 }
-            { start 168 }
-            { end 171 }
-            { uses V{ 168 171 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687511 }
-            { start 169 }
-            { end 176 }
-            { uses V{ 169 176 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686484 }
-            { start 66 }
-            { end 75 }
-            { uses V{ 66 67 67 75 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687509 }
-            { start 162 }
-            { end 163 }
-            { uses V{ 162 163 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686491 }
-            { start 68 }
-            { end 69 }
-            { uses V{ 68 69 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687512 }
-            { start 170 }
-            { end 178 }
-            { uses V{ 170 177 178 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687515 }
-            { start 172 }
-            { end 173 }
-            { uses V{ 172 173 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686492 }
-            { start 69 }
-            { end 74 }
-            { uses V{ 69 70 70 74 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687778 }
-            { start 202 }
-            { end 208 }
-            { uses V{ 202 208 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686499 }
-            { start 71 }
-            { end 72 }
-            { uses V{ 71 72 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687520 }
-            { start 174 }
-            { end 175 }
-            { uses V{ 174 175 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687779 }
-            { start 203 }
-            { end 209 }
-            { uses V{ 203 209 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687782 }
-            { start 206 }
-            { end 207 }
-            { uses V{ 206 207 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686503 }
-            { start 74 }
-            { end 75 }
-            { uses V{ 74 75 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686500 }
-            { start 72 }
-            { end 74 }
-            { uses V{ 72 73 73 74 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687780 }
-            { start 204 }
-            { end 210 }
-            { uses V{ 204 210 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686506 }
-            { start 75 }
-            { end 76 }
-            { uses V{ 75 76 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687530 }
-            { start 185 }
-            { end 192 }
-            { uses V{ 185 192 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687528 }
-            { start 183 }
-            { end 198 }
-            { uses V{ 183 198 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687529 }
-            { start 184 }
-            { end 197 }
-            { uses V{ 184 197 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687781 }
-            { start 205 }
-            { end 211 }
-            { uses V{ 205 211 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687535 }
-            { start 187 }
-            { end 194 }
-            { uses V{ 187 194 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686252 }
-            { start 9 }
-            { end 17 }
-            { uses V{ 9 15 17 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686509 }
-            { start 76 }
-            { end 90 }
-            { uses V{ 76 87 90 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687532 }
-            { start 186 }
-            { end 196 }
-            { uses V{ 186 196 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687538 }
-            { start 188 }
-            { end 193 }
-            { uses V{ 188 193 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687827 }
-            { start 217 }
-            { end 219 }
-            { uses V{ 217 219 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687825 }
-            { start 215 }
-            { end 218 }
-            { uses V{ 215 216 218 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687831 }
-            { start 218 }
-            { end 219 }
-            { uses V{ 218 219 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686296 }
-            { start 16 }
-            { end 18 }
-            { uses V{ 16 18 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686302 }
-            { start 29 }
-            { end 31 }
-            { uses V{ 29 31 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687838 }
-            { start 231 }
-            { end 232 }
-            { uses V{ 231 232 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686300 }
-            { start 26 }
-            { end 27 }
-            { uses V{ 26 27 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686301 }
-            { start 27 }
-            { end 30 }
-            { uses V{ 27 28 28 30 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686306 }
-            { start 37 }
-            { end 93 }
-            { uses V{ 37 82 93 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686307 }
-            { start 38 }
-            { end 88 }
-            { uses V{ 38 85 88 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687837 }
-            { start 222 }
-            { end 223 }
-            { uses V{ 222 223 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686305 }
-            { start 36 }
-            { end 81 }
-            { uses V{ 36 42 77 81 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686310 }
-            { start 39 }
-            { end 95 }
-            { uses V{ 39 84 95 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687836 }
-            { start 227 }
-            { end 228 }
-            { uses V{ 227 228 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687839 }
-            { start 239 }
-            { end 246 }
-            { uses V{ 239 245 246 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687841 }
-            { start 240 }
-            { end 241 }
-            { uses V{ 240 241 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687845 }
-            { start 241 }
-            { end 243 }
-            { uses V{ 241 243 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686315 }
-            { start 40 }
-            { end 94 }
-            { uses V{ 40 83 94 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687846 }
-            { start 242 }
-            { end 245 }
-            { uses V{ 242 245 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687849 }
-            { start 243 }
-            { end 245 }
-            { uses V{ 243 244 244 245 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687850 }
-            { start 245 }
-            { end 245 }
-            { uses V{ 245 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687851 }
-            { start 246 }
-            { end 246 }
-            { uses V{ 246 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687852 }
-            { start 246 }
-            { end 246 }
-            { uses V{ 246 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687853 }
-            { start 247 }
-            { end 248 }
-            { uses V{ 247 248 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687854 }
-            { start 249 }
-            { end 250 }
-            { uses V{ 249 250 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687855 }
-            { start 258 }
-            { end 259 }
-            { uses V{ 258 259 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687080 }
-            { start 280 }
-            { end 285 }
-            { uses V{ 280 285 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687081 }
-            { start 281 }
-            { end 286 }
-            { uses V{ 281 286 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687082 }
-            { start 282 }
-            { end 287 }
-            { uses V{ 282 287 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687083 }
-            { start 283 }
-            { end 288 }
-            { uses V{ 283 288 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687085 }
-            { start 284 }
-            { end 299 }
-            { uses V{ 284 285 286 287 288 296 299 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687086 }
-            { start 284 }
-            { end 284 }
-            { uses V{ 284 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687087 }
-            { start 289 }
-            { end 293 }
-            { uses V{ 289 293 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687088 }
-            { start 290 }
-            { end 294 }
-            { uses V{ 290 294 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687089 }
-            { start 291 }
-            { end 297 }
-            { uses V{ 291 297 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687090 }
-            { start 292 }
-            { end 298 }
-            { uses V{ 292 298 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687363 }
-            { start 118 }
-            { end 119 }
-            { uses V{ 118 119 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686599 }
-            { start 77 }
-            { end 89 }
-            { uses V{ 77 86 89 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687370 }
-            { start 131 }
-            { end 132 }
-            { uses V{ 131 132 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687371 }
-            { start 138 }
-            { end 143 }
-            { uses V{ 138 143 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687368 }
-            { start 127 }
-            { end 128 }
-            { uses V{ 127 128 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687369 }
-            { start 122 }
-            { end 123 }
-            { uses V{ 122 123 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687373 }
-            { start 139 }
-            { end 140 }
-            { uses V{ 139 140 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686352 }
-            { start 41 }
-            { end 91 }
-            { uses V{ 41 43 79 91 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687377 }
-            { start 140 }
-            { end 141 }
-            { uses V{ 140 141 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687382 }
-            { start 143 }
-            { end 143 }
-            { uses V{ 143 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687383 }
-            { start 144 }
-            { end 161 }
-            { uses V{ 144 159 161 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687380 }
-            { start 141 }
-            { end 143 }
-            { uses V{ 141 142 142 143 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687381 }
-            { start 143 }
-            { end 160 }
-            { uses V{ 143 160 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687384 }
-            { start 145 }
-            { end 158 }
-            { uses V{ 145 158 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687385 }
-            { start 146 }
-            { end 157 }
-            { uses V{ 146 157 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687640 }
-            { start 189 }
-            { end 191 }
-            { uses V{ 189 191 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687388 }
-            { start 147 }
-            { end 152 }
-            { uses V{ 147 152 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687393 }
-            { start 148 }
-            { end 153 }
-            { uses V{ 148 153 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687398 }
-            { start 149 }
-            { end 154 }
-            { uses V{ 149 154 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686372 }
-            { start 42 }
-            { end 92 }
-            { uses V{ 42 45 78 80 92 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687140 }
-            { start 293 }
-            { end 295 }
-            { uses V{ 293 294 294 295 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687403 }
-            { start 150 }
-            { end 155 }
-            { uses V{ 150 155 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687150 }
-            { start 304 }
-            { end 306 }
-            { uses V{ 304 306 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687151 }
-            { start 305 }
-            { end 307 }
-            { uses V{ 305 307 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687408 }
-            { start 151 }
-            { end 156 }
-            { uses V{ 151 156 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687153 }
-            { start 312 }
-            { end 313 }
-            { uses V{ 312 313 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686902 }
-            { start 267 }
-            { end 272 }
-            { uses V{ 267 272 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686903 }
-            { start 268 }
-            { end 273 }
-            { uses V{ 268 273 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686900 }
-            { start 265 }
-            { end 270 }
-            { uses V{ 265 270 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686901 }
-            { start 266 }
-            { end 271 }
-            { uses V{ 266 271 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687162 }
-            { start 100 }
-            { end 119 }
-            { uses V{ 100 114 117 119 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687163 }
-            { start 101 }
-            { end 118 }
-            { uses V{ 101 115 116 118 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3686904 }
-            { start 269 }
-            { end 274 }
-            { uses V{ 269 274 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687166 }
-            { start 104 }
-            { end 110 }
-            { uses V{ 104 110 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687167 }
-            { start 105 }
-            { end 111 }
-            { uses V{ 105 111 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687164 }
-            { start 102 }
-            { end 108 }
-            { uses V{ 102 108 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 3687165 }
-            { start 103 }
-            { end 109 }
-            { uses V{ 103 109 } }
-        }
-    } fake-live-ranges
-    { { int-regs { 0 1 2 3 4 } } }
-    allocate-registers drop
-] unit-test
-
-! A reduction of the above
-[ ] [
-    {
-        T{ live-interval
-            { vreg V int-rep 6449 }
-            { start 44 }
-            { end 56 }
-            { uses V{ 44 45 46 56 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6454 }
-            { start 46 }
-            { end 49 }
-            { uses V{ 46 47 49 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6455 }
-            { start 48 }
-            { end 51 }
-            { uses V{ 48 51 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6460 }
-            { start 49 }
-            { end 52 }
-            { uses V{ 49 50 52 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6461 }
-            { start 51 }
-            { end 71 }
-            { uses V{ 51 52 64 68 71 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6464 }
-            { start 53 }
-            { end 54 }
-            { uses V{ 53 54 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6470 }
-            { start 58 }
-            { end 60 }
-            { uses V{ 58 59 60 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6469 }
-            { start 56 }
-            { end 58 }
-            { uses V{ 56 57 58 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6473 }
-            { start 60 }
-            { end 62 }
-            { uses V{ 60 61 62 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6479 }
-            { start 62 }
-            { end 64 }
-            { uses V{ 62 63 64 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6735 }
-            { start 78 }
-            { end 96 }
-            { uses V{ 78 79 96 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6483 }
-            { start 65 }
-            { end 66 }
-            { uses V{ 65 66 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 7845 }
-            { start 91 }
-            { end 93 }
-            { uses V{ 91 93 } }
-        }
-        T{ live-interval
-            { vreg V int-rep 6372 }
-            { start 42 }
-            { end 92 }
-            { uses V{ 42 45 78 80 92 } }
-        }
-    } fake-live-ranges
-    { { int-regs { 0 1 2 3 } } }
-    allocate-registers drop
-] unit-test
-
 [ f ] [
     T{ live-range f 0 10 }
     T{ live-range f 20 30 }
@@ -1426,13 +505,20 @@ USING: math.private ;
 
 ! register-status had problems because it used map>assoc where the sequence
 ! had multiple keys
+H{
+    { 1 int-rep }
+    { 2 int-rep }
+    { 3 int-rep }
+    { 4 int-rep }
+} representations set
+
 [ { 0 10 } ] [
     H{ { int-regs { 0 1 } } } registers set
     H{
         { int-regs
           {
               T{ live-interval
-                 { vreg V int-rep 1 }
+                 { vreg 1 }
                  { start 0 }
                  { end 20 }
                  { reg 0 }
@@ -1441,7 +527,7 @@ USING: math.private ;
               }
 
               T{ live-interval
-                 { vreg V int-rep 2 }
+                 { vreg 2 }
                  { start 4 }
                  { end 40 }
                  { reg 0 }
@@ -1455,7 +541,7 @@ USING: math.private ;
         { int-regs
           {
               T{ live-interval
-                 { vreg V int-rep 3 }
+                 { vreg 3 }
                  { start 0 }
                  { end 40 }
                  { reg 1 }
@@ -1467,7 +553,7 @@ USING: math.private ;
     } active-intervals set
 
     T{ live-interval
-       { vreg V int-rep 4 }
+       { vreg 4 }
         { start 8 }
         { end 10 }
         { ranges V{ T{ live-range f 8 10 } } }
@@ -1476,29 +562,39 @@ USING: math.private ;
     register-status
 ] unit-test
 
+:: test-linear-scan-on-cfg ( regs -- )
+    [
+        cfg new 0 get >>entry
+        compute-predecessors
+        dup fake-representations
+        dup { { int-regs regs } } (linear-scan)
+        cfg-changed
+        flatten-cfg 1array mr.
+    ] with-scope ;
+
 ! Bug in live spill slots calculation
 
 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
 
 V{
     T{ ##peek
-       { dst V int-rep 703128 }
+       { dst 703128 }
        { loc D 1 }
     }
     T{ ##peek
-       { dst V int-rep 703129 }
+       { dst 703129 }
        { loc D 0 }
     }
     T{ ##copy
-       { dst V int-rep 703134 }
-       { src V int-rep 703128 }
+       { dst 703134 }
+       { src 703128 }
     }
     T{ ##copy
-       { dst V int-rep 703135 }
-       { src V int-rep 703129 }
+       { dst 703135 }
+       { src 703129 }
     }
     T{ ##compare-imm-branch
-       { src1 V int-rep 703128 }
+       { src1 703128 }
        { src2 5 }
        { cc cc/= }
     }
@@ -1506,23 +602,23 @@ V{
 
 V{
     T{ ##copy
-       { dst V int-rep 703134 }
-       { src V int-rep 703129 }
+       { dst 703134 }
+       { src 703129 }
     }
     T{ ##copy
-       { dst V int-rep 703135 }
-       { src V int-rep 703128 }
+       { dst 703135 }
+       { src 703128 }
     }
     T{ ##branch }
 } 2 test-bb
 
 V{
     T{ ##replace
-       { src V int-rep 703134 }
+       { src 703134 }
        { loc D 0 }
     }
     T{ ##replace
-       { src V int-rep 703135 }
+       { src 703135 }
        { loc D 1 }
     }
     T{ ##epilogue }
@@ -1533,38 +629,25 @@ V{
 1 { 2 3 } edges
 2 3 edge
 
-SYMBOL: linear-scan-result
-
-:: test-linear-scan-on-cfg ( regs -- )
-    [
-        cfg new 0 get >>entry
-        compute-predecessors
-        dup { { int-regs regs } } (linear-scan)
-        cfg-changed
-        flatten-cfg 1array mr.
-    ] with-scope ;
-
-[ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
-
 ! Bug in inactive interval handling
 ! [ rot dup [ -rot ] when ]
 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
     
 V{
     T{ ##peek
-       { dst V int-rep 689473 }
+       { dst 689473 }
        { loc D 2 }
     }
     T{ ##peek
-       { dst V int-rep 689474 }
+       { dst 689474 }
        { loc D 1 }
     }
     T{ ##peek
-       { dst V int-rep 689475 }
+       { dst 689475 }
        { loc D 0 }
     }
     T{ ##compare-imm-branch
-       { src1 V int-rep 689473 }
+       { src1 689473 }
        { src2 5 }
        { cc cc/= }
     }
@@ -1572,47 +655,47 @@ V{
 
 V{
     T{ ##copy
-       { dst V int-rep 689481 }
-       { src V int-rep 689475 }
+       { dst 689481 }
+       { src 689475 }
     }
     T{ ##copy
-       { dst V int-rep 689482 }
-       { src V int-rep 689474 }
+       { dst 689482 }
+       { src 689474 }
     }
     T{ ##copy
-       { dst V int-rep 689483 }
-       { src V int-rep 689473 }
+       { dst 689483 }
+       { src 689473 }
     }
     T{ ##branch }
 } 2 test-bb
 
 V{
     T{ ##copy
-       { dst V int-rep 689481 }
-       { src V int-rep 689473 }
+       { dst 689481 }
+       { src 689473 }
     }
     T{ ##copy
-       { dst V int-rep 689482 }
-       { src V int-rep 689475 }
+       { dst 689482 }
+       { src 689475 }
     }
     T{ ##copy
-       { dst V int-rep 689483 }
-       { src V int-rep 689474 }
+       { dst 689483 }
+       { src 689474 }
     }
     T{ ##branch }
 } 3 test-bb
 
 V{
     T{ ##replace
-       { src V int-rep 689481 }
+       { src 689481 }
        { loc D 0 }
     }
     T{ ##replace
-       { src V int-rep 689482 }
+       { src 689482 }
        { loc D 1 }
     }
     T{ ##replace
-       { src V int-rep 689483 }
+       { src 689483 }
        { loc D 2 }
     }
     T{ ##epilogue }
@@ -1634,15 +717,15 @@ T{ basic-block
     
 V{
     T{ ##peek
-       { dst V int-rep 689600 }
+       { dst 689600 }
        { loc D 1 }
     }
     T{ ##peek
-       { dst V int-rep 689601 }
+       { dst 689601 }
        { loc D 0 }
     }
     T{ ##compare-imm-branch
-       { src1 V int-rep 689600 }
+       { src1 689600 }
        { src2 5 }
        { cc cc/= }
     }
@@ -1650,55 +733,55 @@ V{
     
 V{
     T{ ##peek
-       { dst V int-rep 689604 }
+       { dst 689604 }
        { loc D 2 }
     }
     T{ ##copy
-       { dst V int-rep 689607 }
-       { src V int-rep 689604 }
+       { dst 689607 }
+       { src 689604 }
     }
     T{ ##copy
-       { dst V int-rep 689608 }
-       { src V int-rep 689600 }
+       { dst 689608 }
+       { src 689600 }
     }
     T{ ##copy
-       { dst V int-rep 689610 }
-       { src V int-rep 689601 }
+       { dst 689610 }
+       { src 689601 }
     }
     T{ ##branch }
 } 2 test-bb
     
 V{
     T{ ##peek
-       { dst V int-rep 689609 }
+       { dst 689609 }
        { loc D 2 }
     }
     T{ ##copy
-       { dst V int-rep 689607 }
-       { src V int-rep 689600 }
+       { dst 689607 }
+       { src 689600 }
     }
     T{ ##copy
-       { dst V int-rep 689608 }
-       { src V int-rep 689601 }
+       { dst 689608 }
+       { src 689601 }
     }
     T{ ##copy
-       { dst V int-rep 689610 }
-       { src V int-rep 689609 }
+       { dst 689610 }
+       { src 689609 }
     }
     T{ ##branch }
 } 3 test-bb
     
 V{
     T{ ##replace
-       { src V int-rep 689607 }
+       { src 689607 }
        { loc D 0 }
     }
     T{ ##replace
-       { src V int-rep 689608 }
+       { src 689608 }
        { loc D 1 }
     }
     T{ ##replace
-       { src V int-rep 689610 }
+       { src 689610 }
        { loc D 2 }
     }
     T{ ##epilogue }
@@ -1716,11 +799,11 @@ V{ T{ ##prologue } T{ ##branch } } 0 test-bb
 
 V{
     T{ ##peek
-       { dst V int-rep 0 }
+       { dst 0 }
        { loc D 0 }
     }
     T{ ##compare-imm-branch
-       { src1 V int-rep 0 }
+       { src1 0 }
        { src2 5 }
        { cc cc/= }
     }
@@ -1728,31 +811,31 @@ V{
 
 V{
     T{ ##peek
-       { dst V int-rep 1 }
+       { dst 1 }
        { loc D 1 }
     }
     T{ ##copy
-       { dst V int-rep 2 }
-       { src V int-rep 1 }
+       { dst 2 }
+       { src 1 }
     }
     T{ ##branch }
 } 2 test-bb
 
 V{
     T{ ##peek
-       { dst V int-rep 3 }
+       { dst 3 }
        { loc D 2 }
     }
     T{ ##copy
-       { dst V int-rep 2 }
-       { src V int-rep 3 }
+       { dst 2 }
+       { src 3 }
     }
     T{ ##branch }
 } 3 test-bb
 
 V{
     T{ ##replace
-       { src V int-rep 2 }
+       { src 2 }
        { loc D 0 }
     }
     T{ ##return }
@@ -1765,29 +848,29 @@ test-diamond
 ! Inactive interval handling: splitting active interval
 ! if it fits in lifetime hole only partially
 
-V{ T{ ##peek f V int-rep 3 R 1 } T{ ##branch } } 0 test-bb
+V{ T{ ##peek f 3 R 1 } T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 2 R 0 }
-    T{ ##compare-imm-branch f V int-rep 2 5 cc= }
+    T{ ##peek f 2 R 0 }
+    T{ ##compare-imm-branch f 2 5 cc= }
 } 1 test-bb
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
+    T{ ##peek f 0 D 0 }
     T{ ##branch }
 } 2 test-bb
 
 
 V{
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##replace f V int-rep 1 D 2 }
+    T{ ##peek f 1 D 1 }
+    T{ ##peek f 0 D 0 }
+    T{ ##replace f 1 D 2 }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##replace f V int-rep 3 R 2 }
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 3 R 2 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 4 test-bb
 
@@ -1799,11 +882,11 @@ test-diamond
 ! [ _copy ] [ 3 get instructions>> second class ] unit-test
 
 ! Resolve pass; make sure the spilling is done correctly
-V{ T{ ##peek f V int-rep 3 R 1 } T{ ##branch } } 0 test-bb
+V{ T{ ##peek f 3 R 1 } T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 2 R 0 }
-    T{ ##compare-imm-branch f V int-rep 2 5 cc= }
+    T{ ##peek f 2 R 0 }
+    T{ ##compare-imm-branch f 2 5 cc= }
 } 1 test-bb
 
 V{
@@ -1811,16 +894,16 @@ V{
 } 2 test-bb
 
 V{
-    T{ ##replace f V int-rep 3 R 1 }
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##replace f V int-rep 1 D 2 }
-    T{ ##replace f V int-rep 0 D 2 }
+    T{ ##replace f 3 R 1 }
+    T{ ##peek f 1 D 1 }
+    T{ ##peek f 0 D 0 }
+    T{ ##replace f 1 D 2 }
+    T{ ##replace f 0 D 2 }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##replace f V int-rep 3 R 2 }
+    T{ ##replace f 3 R 2 }
     T{ ##return }
 } 4 test-bb
 
@@ -1842,16 +925,16 @@ V{
 } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##compare-imm-branch f V int-rep 0 5 cc= }
+    T{ ##peek f 0 D 0 }
+    T{ ##compare-imm-branch f 0 5 cc= }
 } 1 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
-    T{ ##peek f V int-rep 1 D 0 }
-    T{ ##peek f V int-rep 2 D 0 }
-    T{ ##replace f V int-rep 1 D 0 }
-    T{ ##replace f V int-rep 2 D 0 }
+    T{ ##replace f 0 D 0 }
+    T{ ##peek f 1 D 0 }
+    T{ ##peek f 2 D 0 }
+    T{ ##replace f 1 D 0 }
+    T{ ##replace f 2 D 0 }
     T{ ##branch }
 } 2 test-bb
 
@@ -1860,17 +943,17 @@ V{
 } 3 test-bb
 
 V{
-    T{ ##peek f V int-rep 1 D 0 }
-    T{ ##compare-imm-branch f V int-rep 1 5 cc= }
+    T{ ##peek f 1 D 0 }
+    T{ ##compare-imm-branch f 1 5 cc= }
 } 4 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 5 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 6 test-bb
 
@@ -1892,45 +975,45 @@ V{
 ! got fixed
 V{ T{ ##branch } } 0 test-bb
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 2 D 2 }
-    T{ ##peek f V int-rep 3 D 3 }
-    T{ ##peek f V int-rep 4 D 0 }
+    T{ ##peek f 0 D 0 }
+    T{ ##peek f 1 D 1 }
+    T{ ##peek f 2 D 2 }
+    T{ ##peek f 3 D 3 }
+    T{ ##peek f 4 D 0 }
     T{ ##branch }
 } 1 test-bb
 V{ T{ ##branch } } 2 test-bb
 V{ T{ ##branch } } 3 test-bb
 V{
     
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 3 D 3 }
-    T{ ##replace f V int-rep 4 D 4 }
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 1 D 1 }
+    T{ ##replace f 2 D 2 }
+    T{ ##replace f 3 D 3 }
+    T{ ##replace f 4 D 4 }
+    T{ ##replace f 0 D 0 }
     T{ ##branch }
 } 4 test-bb
-V{ T{ ##replace f V int-rep 0 D 0 } T{ ##branch } } 5 test-bb
+V{ T{ ##replace f 0 D 0 } T{ ##branch } } 5 test-bb
 V{ T{ ##return } } 6 test-bb
 V{ T{ ##branch } } 7 test-bb
 V{
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 3 D 3 }
-    T{ ##peek f V int-rep 5 D 1 }
-    T{ ##peek f V int-rep 6 D 2 }
-    T{ ##peek f V int-rep 7 D 3 }
-    T{ ##peek f V int-rep 8 D 4 }
-    T{ ##replace f V int-rep 5 D 1 }
-    T{ ##replace f V int-rep 6 D 2 }
-    T{ ##replace f V int-rep 7 D 3 }
-    T{ ##replace f V int-rep 8 D 4 }
+    T{ ##replace f 1 D 1 }
+    T{ ##replace f 2 D 2 }
+    T{ ##replace f 3 D 3 }
+    T{ ##peek f 5 D 1 }
+    T{ ##peek f 6 D 2 }
+    T{ ##peek f 7 D 3 }
+    T{ ##peek f 8 D 4 }
+    T{ ##replace f 5 D 1 }
+    T{ ##replace f 6 D 2 }
+    T{ ##replace f 7 D 3 }
+    T{ ##replace f 8 D 4 }
     T{ ##branch }
 } 8 test-bb
 V{
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 3 D 3 }
+    T{ ##replace f 1 D 1 }
+    T{ ##replace f 2 D 2 }
+    T{ ##replace f 3 D 3 }
     T{ ##return }
 } 9 test-bb
 
@@ -1955,24 +1038,24 @@ V{
 
 ! Some random bug
 V{
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 2 D 2 }
-    T{ ##peek f V int-rep 3 D 0 }
-    T{ ##peek f V int-rep 0 D 0 }
+    T{ ##peek f 1 D 1 }
+    T{ ##peek f 2 D 2 }
+    T{ ##replace f 1 D 1 }
+    T{ ##replace f 2 D 2 }
+    T{ ##peek f 3 D 0 }
+    T{ ##peek f 0 D 0 }
     T{ ##branch }
 } 0 test-bb
 
 V{ T{ ##branch } } 1 test-bb
 
 V{
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 3 D 3 }
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 0 D 3 }
+    T{ ##peek f 1 D 1 }
+    T{ ##peek f 2 D 2 }
+    T{ ##replace f 3 D 3 }
+    T{ ##replace f 1 D 1 }
+    T{ ##replace f 2 D 2 }
+    T{ ##replace f 0 D 3 }
     T{ ##branch }
 } 2 test-bb
 
@@ -1989,40 +1072,40 @@ test-diamond
 ! Spilling an interval immediately after its activated;
 ! and the interval does not have a use at the activation point
 V{
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 2 D 2 }
-    T{ ##peek f V int-rep 0 D 0 }
+    T{ ##peek f 1 D 1 }
+    T{ ##peek f 2 D 2 }
+    T{ ##replace f 1 D 1 }
+    T{ ##replace f 2 D 2 }
+    T{ ##peek f 0 D 0 }
     T{ ##branch }
 } 0 test-bb
 
 V{ T{ ##branch } } 1 test-bb
 
 V{
-    T{ ##peek f V int-rep 1 D 1 }
+    T{ ##peek f 1 D 1 }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 2 D 2 }
-    T{ ##replace f V int-rep 2 D 2 }
+    T{ ##replace f 1 D 1 }
+    T{ ##peek f 2 D 2 }
+    T{ ##replace f 2 D 2 }
     T{ ##branch }
 } 3 test-bb
 
 V{ T{ ##branch } } 4 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 5 test-bb
 
-1 get 1vector 0 get (>>successors)
-2 get 4 get V{ } 2sequence 1 get (>>successors)
-5 get 1vector 4 get (>>successors)
-3 get 1vector 2 get (>>successors)
-5 get 1vector 3 get (>>successors)
+0 1 edge
+1 { 2 4 } edges
+4 5 edge
+2 3 edge
+3 5 edge
 
 [ ] [ { 1 2 } test-linear-scan-on-cfg ] unit-test
 
@@ -2030,89 +1113,89 @@ V{
 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##load-immediate { dst V int-rep 61 } }
-    T{ ##peek { dst V int-rep 62 } { loc D 0 } }
-    T{ ##peek { dst V int-rep 64 } { loc D 1 } }
+    T{ ##load-immediate { dst 61 } }
+    T{ ##peek { dst 62 } { loc D 0 } }
+    T{ ##peek { dst 64 } { loc D 1 } }
     T{ ##slot-imm
-        { dst V int-rep 69 }
-        { obj V int-rep 64 }
+        { dst 69 }
+        { obj 64 }
         { slot 1 }
         { tag 2 }
     }
-    T{ ##copy { dst V int-rep 79 } { src V int-rep 69 } }
+    T{ ##copy { dst 79 } { src 69 } }
     T{ ##slot-imm
-        { dst V int-rep 85 }
-        { obj V int-rep 62 }
+        { dst 85 }
+        { obj 62 }
         { slot 2 }
         { tag 7 }
     }
     T{ ##compare-branch
-        { src1 V int-rep 69 }
-        { src2 V int-rep 85 }
+        { src1 69 }
+        { src2 85 }
         { cc cc> }
     }
 } 1 test-bb
 
 V{
     T{ ##slot-imm
-        { dst V int-rep 97 }
-        { obj V int-rep 62 }
+        { dst 97 }
+        { obj 62 }
         { slot 2 }
         { tag 7 }
     }
-    T{ ##replace { src V int-rep 79 } { loc D 3 } }
-    T{ ##replace { src V int-rep 62 } { loc D 4 } }
-    T{ ##replace { src V int-rep 79 } { loc D 1 } }
-    T{ ##replace { src V int-rep 62 } { loc D 2 } }
-    T{ ##replace { src V int-rep 61 } { loc D 5 } }
-    T{ ##replace { src V int-rep 62 } { loc R 0 } }
-    T{ ##replace { src V int-rep 69 } { loc R 1 } }
-    T{ ##replace { src V int-rep 97 } { loc D 0 } }
+    T{ ##replace { src 79 } { loc D 3 } }
+    T{ ##replace { src 62 } { loc D 4 } }
+    T{ ##replace { src 79 } { loc D 1 } }
+    T{ ##replace { src 62 } { loc D 2 } }
+    T{ ##replace { src 61 } { loc D 5 } }
+    T{ ##replace { src 62 } { loc R 0 } }
+    T{ ##replace { src 69 } { loc R 1 } }
+    T{ ##replace { src 97 } { loc D 0 } }
     T{ ##call { word resize-array } }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##peek { dst V int-rep 98 } { loc R 0 } }
-    T{ ##peek { dst V int-rep 100 } { loc D 0 } }
+    T{ ##peek { dst 98 } { loc R 0 } }
+    T{ ##peek { dst 100 } { loc D 0 } }
     T{ ##set-slot-imm
-        { src V int-rep 100 }
-        { obj V int-rep 98 }
+        { src 100 }
+        { obj 98 }
         { slot 2 }
         { tag 7 }
     }
-    T{ ##peek { dst V int-rep 108 } { loc D 2 } }
-    T{ ##peek { dst V int-rep 110 } { loc D 3 } }
-    T{ ##peek { dst V int-rep 112 } { loc D 0 } }
-    T{ ##peek { dst V int-rep 114 } { loc D 1 } }
-    T{ ##peek { dst V int-rep 116 } { loc D 4 } }
-    T{ ##peek { dst V int-rep 119 } { loc R 0 } }
-    T{ ##copy { dst V int-rep 109 } { src V int-rep 108 } }
-    T{ ##copy { dst V int-rep 111 } { src V int-rep 110 } }
-    T{ ##copy { dst V int-rep 113 } { src V int-rep 112 } }
-    T{ ##copy { dst V int-rep 115 } { src V int-rep 114 } }
-    T{ ##copy { dst V int-rep 117 } { src V int-rep 116 } }
-    T{ ##copy { dst V int-rep 120 } { src V int-rep 119 } }
+    T{ ##peek { dst 108 } { loc D 2 } }
+    T{ ##peek { dst 110 } { loc D 3 } }
+    T{ ##peek { dst 112 } { loc D 0 } }
+    T{ ##peek { dst 114 } { loc D 1 } }
+    T{ ##peek { dst 116 } { loc D 4 } }
+    T{ ##peek { dst 119 } { loc R 0 } }
+    T{ ##copy { dst 109 } { src 108 } }
+    T{ ##copy { dst 111 } { src 110 } }
+    T{ ##copy { dst 113 } { src 112 } }
+    T{ ##copy { dst 115 } { src 114 } }
+    T{ ##copy { dst 117 } { src 116 } }
+    T{ ##copy { dst 120 } { src 119 } }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##copy { dst V int-rep 109 } { src V int-rep 62 } }
-    T{ ##copy { dst V int-rep 111 } { src V int-rep 61 } }
-    T{ ##copy { dst V int-rep 113 } { src V int-rep 62 } }
-    T{ ##copy { dst V int-rep 115 } { src V int-rep 79 } }
-    T{ ##copy { dst V int-rep 117 } { src V int-rep 64 } }
-    T{ ##copy { dst V int-rep 120 } { src V int-rep 69 } }
+    T{ ##copy { dst 109 } { src 62 } }
+    T{ ##copy { dst 111 } { src 61 } }
+    T{ ##copy { dst 113 } { src 62 } }
+    T{ ##copy { dst 115 } { src 79 } }
+    T{ ##copy { dst 117 } { src 64 } }
+    T{ ##copy { dst 120 } { src 69 } }
     T{ ##branch }
 } 4 test-bb
 
 V{
-    T{ ##replace { src V int-rep 120 } { loc D 0 } }
-    T{ ##replace { src V int-rep 109 } { loc D 3 } }
-    T{ ##replace { src V int-rep 111 } { loc D 4 } }
-    T{ ##replace { src V int-rep 113 } { loc D 1 } }
-    T{ ##replace { src V int-rep 115 } { loc D 2 } }
-    T{ ##replace { src V int-rep 117 } { loc D 5 } }
+    T{ ##replace { src 120 } { loc D 0 } }
+    T{ ##replace { src 109 } { loc D 3 } }
+    T{ ##replace { src 111 } { loc D 4 } }
+    T{ ##replace { src 113 } { loc D 1 } }
+    T{ ##replace { src 115 } { loc D 2 } }
+    T{ ##replace { src 117 } { loc D 5 } }
     T{ ##epilogue }
     T{ ##return }
 } 5 test-bb
 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek { dst V int-rep 85 } { loc D 0 } }
+    T{ ##peek { dst 85 } { loc D 0 } }
     T{ ##slot-imm
-        { dst V int-rep 89 }
-        { obj V int-rep 85 }
+        { dst 89 }
+        { obj 85 }
         { slot 3 }
         { tag 7 }
     }
-    T{ ##peek { dst V int-rep 91 } { loc D 1 } }
+    T{ ##peek { dst 91 } { loc D 1 } }
     T{ ##slot-imm
-        { dst V int-rep 96 }
-        { obj V int-rep 91 }
+        { dst 96 }
+        { obj 91 }
         { slot 1 }
         { tag 2 }
     }
     T{ ##add
-        { dst V int-rep 109 }
-        { src1 V int-rep 89 }
-        { src2 V int-rep 96 }
+        { dst 109 }
+        { src1 89 }
+        { src2 96 }
     }
     T{ ##slot-imm
-        { dst V int-rep 115 }
-        { obj V int-rep 85 }
+        { dst 115 }
+        { obj 85 }
         { slot 2 }
         { tag 7 }
     }
     T{ ##slot-imm
-        { dst V int-rep 118 }
-        { obj V int-rep 115 }
+        { dst 118 }
+        { obj 115 }
         { slot 1 }
         { tag 2 }
     }
     T{ ##compare-branch
-        { src1 V int-rep 109 }
-        { src2 V int-rep 118 }
+        { src1 109 }
+        { src2 118 }
         { cc cc> }
     }
 } 1 test-bb
 
 V{
     T{ ##add-imm
-        { dst V int-rep 128 }
-        { src1 V int-rep 109 }
+        { dst 128 }
+        { src1 109 }
         { src2 8 }
     }
-    T{ ##load-immediate { dst V int-rep 129 } { val 24 } }
+    T{ ##load-immediate { dst 129 } { val 24 } }
     T{ ##inc-d { n 4 } }
     T{ ##inc-r { n 1 } }
-    T{ ##replace { src V int-rep 109 } { loc D 2 } }
-    T{ ##replace { src V int-rep 85 } { loc D 3 } }
-    T{ ##replace { src V int-rep 128 } { loc D 0 } }
-    T{ ##replace { src V int-rep 85 } { loc D 1 } }
-    T{ ##replace { src V int-rep 89 } { loc D 4 } }
-    T{ ##replace { src V int-rep 96 } { loc R 0 } }
-    T{ ##replace { src V int-rep 129 } { loc R 0 } }
+    T{ ##replace { src 109 } { loc D 2 } }
+    T{ ##replace { src 85 } { loc D 3 } }
+    T{ ##replace { src 128 } { loc D 0 } }
+    T{ ##replace { src 85 } { loc D 1 } }
+    T{ ##replace { src 89 } { loc D 4 } }
+    T{ ##replace { src 96 } { loc R 0 } }
+    T{ ##replace { src 129 } { loc R 0 } }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##peek { dst V int-rep 134 } { loc D 1 } }
+    T{ ##peek { dst 134 } { loc D 1 } }
     T{ ##slot-imm
-        { dst V int-rep 140 }
-        { obj V int-rep 134 }
+        { dst 140 }
+        { obj 134 }
         { slot 2 }
         { tag 7 }
     }
     T{ ##inc-d { n 1 } }
     T{ ##inc-r { n 1 } }
-    T{ ##replace { src V int-rep 140 } { loc D 0 } }
-    T{ ##replace { src V int-rep 134 } { loc R 0 } }
+    T{ ##replace { src 140 } { loc D 0 } }
+    T{ ##replace { src 134 } { loc R 0 } }
     T{ ##call { word resize-array } }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##peek { dst V int-rep 141 } { loc R 0 } }
-    T{ ##peek { dst V int-rep 143 } { loc D 0 } }
+    T{ ##peek { dst 141 } { loc R 0 } }
+    T{ ##peek { dst 143 } { loc D 0 } }
     T{ ##set-slot-imm
-        { src V int-rep 143 }
-        { obj V int-rep 141 }
+        { src 143 }
+        { obj 141 }
         { slot 2 }
         { tag 7 }
     }
     T{ ##write-barrier
-        { src V int-rep 141 }
-        { card# V int-rep 145 }
-        { table V int-rep 146 }
+        { src 141 }
+        { card# 145 }
+        { table 146 }
     }
     T{ ##inc-d { n -1 } }
     T{ ##inc-r { n -1 } }
-    T{ ##peek { dst V int-rep 156 } { loc D 2 } }
-    T{ ##peek { dst V int-rep 158 } { loc D 3 } }
-    T{ ##peek { dst V int-rep 160 } { loc D 0 } }
-    T{ ##peek { dst V int-rep 162 } { loc D 1 } }
-    T{ ##peek { dst V int-rep 164 } { loc D 4 } }
-    T{ ##peek { dst V int-rep 167 } { loc R 0 } }
-    T{ ##copy { dst V int-rep 157 } { src V int-rep 156 } }
-    T{ ##copy { dst V int-rep 159 } { src V int-rep 158 } }
-    T{ ##copy { dst V int-rep 161 } { src V int-rep 160 } }
-    T{ ##copy { dst V int-rep 163 } { src V int-rep 162 } }
-    T{ ##copy { dst V int-rep 165 } { src V int-rep 164 } }
-    T{ ##copy { dst V int-rep 168 } { src V int-rep 167 } }
+    T{ ##peek { dst 156 } { loc D 2 } }
+    T{ ##peek { dst 158 } { loc D 3 } }
+    T{ ##peek { dst 160 } { loc D 0 } }
+    T{ ##peek { dst 162 } { loc D 1 } }
+    T{ ##peek { dst 164 } { loc D 4 } }
+    T{ ##peek { dst 167 } { loc R 0 } }
+    T{ ##copy { dst 157 } { src 156 } }
+    T{ ##copy { dst 159 } { src 158 } }
+    T{ ##copy { dst 161 } { src 160 } }
+    T{ ##copy { dst 163 } { src 162 } }
+    T{ ##copy { dst 165 } { src 164 } }
+    T{ ##copy { dst 168 } { src 167 } }
     T{ ##branch }
 } 4 test-bb
 
 V{
     T{ ##inc-d { n 3 } }
     T{ ##inc-r { n 1 } }
-    T{ ##copy { dst V int-rep 157 } { src V int-rep 85 } }
-    T{ ##copy { dst V int-rep 159 } { src V int-rep 89 } }
-    T{ ##copy { dst V int-rep 161 } { src V int-rep 85 } }
-    T{ ##copy { dst V int-rep 163 } { src V int-rep 109 } }
-    T{ ##copy { dst V int-rep 165 } { src V int-rep 91 } }
-    T{ ##copy { dst V int-rep 168 } { src V int-rep 96 } }
+    T{ ##copy { dst 157 } { src 85 } }
+    T{ ##copy { dst 159 } { src 89 } }
+    T{ ##copy { dst 161 } { src 85 } }
+    T{ ##copy { dst 163 } { src 109 } }
+    T{ ##copy { dst 165 } { src 91 } }
+    T{ ##copy { dst 168 } { src 96 } }
     T{ ##branch }
 } 5 test-bb
 
 V{
     T{ ##set-slot-imm
-        { src V int-rep 163 }
-        { obj V int-rep 161 }
+        { src 163 }
+        { obj 161 }
         { slot 3 }
         { tag 7 }
     }
     T{ ##inc-d { n 1 } }
     T{ ##inc-r { n -1 } }
-    T{ ##replace { src V int-rep 168 } { loc D 0 } }
-    T{ ##replace { src V int-rep 157 } { loc D 3 } }
-    T{ ##replace { src V int-rep 159 } { loc D 4 } }
-    T{ ##replace { src V int-rep 161 } { loc D 1 } }
-    T{ ##replace { src V int-rep 163 } { loc D 2 } }
-    T{ ##replace { src V int-rep 165 } { loc D 5 } }
+    T{ ##replace { src 168 } { loc D 0 } }
+    T{ ##replace { src 157 } { loc D 3 } }
+    T{ ##replace { src 159 } { loc D 4 } }
+    T{ ##replace { src 161 } { loc D 1 } }
+    T{ ##replace { src 163 } { loc D 2 } }
+    T{ ##replace { src 165 } { loc D 5 } }
     T{ ##epilogue }
     T{ ##return }
 } 6 test-bb
@@ -2277,22 +1360,22 @@ V{
 V{ T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##compare-imm-branch f V int-rep 0 5 cc= }
+    T{ ##peek f 0 D 0 }
+    T{ ##compare-imm-branch f 0 5 cc= }
 } 1 test-bb
 
 V{ T{ ##branch } } 2 test-bb
 
 V{
-    T{ ##peek f V int-rep 1 D 0 }
-    T{ ##peek f V int-rep 2 D 0 }
-    T{ ##replace f V int-rep 1 D 0 }
-    T{ ##replace f V int-rep 2 D 0 }
+    T{ ##peek f 1 D 0 }
+    T{ ##peek f 2 D 0 }
+    T{ ##replace f 1 D 0 }
+    T{ ##replace f 2 D 0 }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 4 test-bb
 
@@ -2312,16 +1395,16 @@ test-diamond
 V{ T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##compare-imm-branch f V int-rep 0 5 cc= }
+    T{ ##peek f 0 D 0 }
+    T{ ##compare-imm-branch f 0 5 cc= }
 } 1 test-bb
 
 V{
-    T{ ##peek f V int-rep 1 D 0 }
-    T{ ##peek f V int-rep 2 D 0 }
-    T{ ##replace f V int-rep 1 D 0 }
-    T{ ##replace f V int-rep 2 D 0 }
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##peek f 1 D 0 }
+    T{ ##peek f 2 D 0 }
+    T{ ##replace f 1 D 0 }
+    T{ ##replace f 2 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##branch }
 } 2 test-bb
 
@@ -2330,7 +1413,7 @@ V{
 } 3 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 4 test-bb
 
@@ -2348,52 +1431,20 @@ test-diamond
 
 [ 0 ] [ 4 get instructions>> [ _reload? ] count ] unit-test
 
-! GC check tests
-
-! Spill slot liveness was computed incorrectly, leading to a FEP
-! early in bootstrap on x86-32
-[ t ] [
-    [
-        T{ basic-block
-           { id 12345 }
-           { instructions
-             V{
-                 T{ ##gc f V int-rep 6 V int-rep 7 }
-                 T{ ##peek f V int-rep 0 D 0 }
-                 T{ ##peek f V int-rep 1 D 1 }
-                 T{ ##peek f V int-rep 2 D 2 }
-                 T{ ##peek f V int-rep 3 D 3 }
-                 T{ ##peek f V int-rep 4 D 4 }
-                 T{ ##peek f V int-rep 5 D 5 }
-                 T{ ##replace f V int-rep 0 D 1 }
-                 T{ ##replace f V int-rep 1 D 2 }
-                 T{ ##replace f V int-rep 2 D 3 }
-                 T{ ##replace f V int-rep 3 D 4 }
-                 T{ ##replace f V int-rep 4 D 5 }
-                 T{ ##replace f V int-rep 5 D 0 }
-             }
-           }
-        } cfg new over >>entry
-        { { int-regs V{ 0 1 2 3 } } } (linear-scan)
-        instructions>> first
-        tagged-values>> assoc-empty?
-    ] with-scope
-] unit-test
-
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##replace f V int-rep 1 D 1 }
+    T{ ##peek f 0 D 0 }
+    T{ ##peek f 1 D 1 }
+    T{ ##replace f 1 D 1 }
     T{ ##branch }
 } 0 test-bb
 
 V{
-    T{ ##gc f V int-rep 2 V int-rep 3 }
+    T{ ##gc f 2 3 }
     T{ ##branch }
 } 1 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 2 test-bb
 
@@ -2404,17 +1455,15 @@ V{
 
 [ { 3 } ] [ 1 get instructions>> first tagged-values>> ] unit-test
 
-
-
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##compare-imm-branch f V int-rep 1 5 cc= }
+    T{ ##peek f 0 D 0 }
+    T{ ##peek f 1 D 1 }
+    T{ ##compare-imm-branch f 1 5 cc= }
 } 0 test-bb
 
 V{
-    T{ ##gc f V int-rep 2 V int-rep 3 }
-    T{ ##replace f V int-rep 0 D 0 }
+    T{ ##gc f 2 3 }
+    T{ ##replace f 0 D 0 }
     T{ ##return }
 } 1 test-bb
 
index 7162c3ef42673c380ddfbf1b53511e143216b42a..d90fd00fdd5519c21707819c1cef193e38e7568b 100644 (file)
@@ -5,6 +5,7 @@ cpu.architecture
 compiler.cfg
 compiler.cfg.rpo
 compiler.cfg.liveness
+compiler.cfg.registers
 compiler.cfg.instructions
 compiler.cfg.linear-scan.numbering
 compiler.cfg.linear-scan.live-intervals
index aef5c1b8cdbadb9a5988b39c34d3f4a087f99bb9..dd0ae4a2703e34ba1c6275a3ae1e15d2f6a1802a 100644 (file)
@@ -5,6 +5,7 @@ combinators.short-circuit fry kernel locals namespaces
 make math sequences hashtables
 compiler.cfg.rpo
 compiler.cfg.liveness
+compiler.cfg.registers
 compiler.cfg.utilities
 compiler.cfg.instructions
 compiler.cfg.parallel-copy
@@ -23,7 +24,7 @@ SYMBOL: spill-temps
 :: resolve-value-data-flow ( bb to vreg -- )
     vreg bb vreg-at-end
     vreg to vreg-at-start
-    2dup = [ 2drop ] [ vreg rep>> add-mapping ] if ;
+    2dup = [ 2drop ] [ vreg rep-of add-mapping ] if ;
 
 : compute-mappings ( bb to -- mappings )
     dup live-in dup assoc-empty? [ 3drop f ] [
index 65ede5c38fecee4e0a841c0a9aca201099ea5380..1f53695d9ef757479a028307c405dd5b4a61bc88 100644 (file)
@@ -12,20 +12,20 @@ IN: compiler.cfg.liveness.tests
 ! Sanity check...
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##replace f V int-rep 0 D 0 }
-    T{ ##replace f V int-rep 1 D 1 }
-    T{ ##peek f V int-rep 1 D 1 }
+    T{ ##peek f 0 D 0 }
+    T{ ##replace f 0 D 0 }
+    T{ ##replace f 1 D 1 }
+    T{ ##peek f 1 D 1 }
     T{ ##branch }
 } 1 test-bb
 
 V{
-    T{ ##replace f V int-rep 2 D 0 }
+    T{ ##replace f 2 D 0 }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##replace f V int-rep 3 D 0 }
+    T{ ##replace f 3 D 0 }
     T{ ##return }
 } 3 test-bb
 
@@ -35,9 +35,9 @@ test-liveness
 
 [
     H{
-        { V int-rep 1 V int-rep 1 }
-        { V int-rep 2 V int-rep 2 }
-        { V int-rep 3 V int-rep 3 }
+        { 1 1 }
+        { 2 2 }
+        { 3 3 }
     }
 ]
 [ 1 get live-in ]
@@ -46,12 +46,12 @@ unit-test
 ! Tricky case; defs must be killed before uses
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
+    T{ ##peek f 0 D 0 }
     T{ ##branch }
 } 1 test-bb
 
 V{
-    T{ ##add-imm f V int-rep 0 V int-rep 0 10 }
+    T{ ##add-imm f 0 0 10 }
     T{ ##return }
 } 2 test-bb
 
@@ -59,4 +59,4 @@ V{
 
 test-liveness
 
-[ H{ { V int-rep 0 V int-rep 0 } } ] [ 2 get live-in ] unit-test
\ No newline at end of file
+[ H{ { 0 0 } } ] [ 2 get live-in ] unit-test
\ No newline at end of file
index f08ce9b4e06dce642e7721aa698b4a1041a74ada..bedfca3c0e65f05a00e9d76ba4ca770c2c35eb34 100644 (file)
@@ -1,12 +1,13 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel namespaces compiler.cfg compiler.cfg.linearization
-compiler.cfg.gc-checks compiler.cfg.linear-scan
-compiler.cfg.build-stack-frame ;
+USING: kernel namespaces accessors compiler.cfg compiler.cfg.registers
+compiler.cfg.linearization compiler.cfg.gc-checks
+compiler.cfg.linear-scan compiler.cfg.build-stack-frame ;
 IN: compiler.cfg.mr
 
 : build-mr ( cfg -- mr )
     dup cfg [
+        cfg get reps>> representations set
         insert-gc-checks
         linear-scan
         flatten-cfg
index 859e1ff106c5e6a62e4b57dde4ccb1e7f8ab7d2d..66cc87beffb6e2032fb5c52563688d623b9e5d35 100644 (file)
@@ -11,53 +11,53 @@ SYMBOL: temp
 
 [
     {
-        T{ ##copy f V int-rep 4 V int-rep 2 int-rep }
-        T{ ##copy f V int-rep 2 V int-rep 1 int-rep }
-        T{ ##copy f V int-rep 1 V int-rep 4 int-rep }
+        T{ ##copy f 4 2 any-rep }
+        T{ ##copy f 2 1 any-rep }
+        T{ ##copy f 1 4 any-rep }
     }
 ] [
     H{
-        { V int-rep 1 V int-rep 2 }
-        { V int-rep 2 V int-rep 1 }
+        { 1 2 }
+        { 2 1 }
     } test-parallel-copy
 ] unit-test
 
 [
     {
-        T{ ##copy f V int-rep 1 V int-rep 2 int-rep }
-        T{ ##copy f V int-rep 3 V int-rep 4 int-rep }
+        T{ ##copy f 1 2 any-rep }
+        T{ ##copy f 3 4 any-rep }
     }
 ] [
     H{
-        { V int-rep 1 V int-rep 2 }
-        { V int-rep 3 V int-rep 4 }
+        { 1 2 }
+        { 3 4 }
     } test-parallel-copy
 ] unit-test
 
 [
     {
-        T{ ##copy f V int-rep 1 V int-rep 3 int-rep }
-        T{ ##copy f V int-rep 2 V int-rep 1 int-rep }
+        T{ ##copy f 1 3 any-rep }
+        T{ ##copy f 2 1 any-rep }
     }
 ] [
     H{
-        { V int-rep 1 V int-rep 3 }
-        { V int-rep 2 V int-rep 3 }
+        { 1 3 }
+        { 2 3 }
     } test-parallel-copy
 ] unit-test
 
 [
     {
-        T{ ##copy f V int-rep 4 V int-rep 3 int-rep }
-        T{ ##copy f V int-rep 3 V int-rep 2 int-rep }
-        T{ ##copy f V int-rep 2 V int-rep 1 int-rep }
-        T{ ##copy f V int-rep 1 V int-rep 4 int-rep }
+        T{ ##copy f 4 3 any-rep }
+        T{ ##copy f 3 2 any-rep }
+        T{ ##copy f 2 1 any-rep }
+        T{ ##copy f 1 4 any-rep }
     }
 ] [
     {
-        { V int-rep 2 V int-rep 1 }
-        { V int-rep 3 V int-rep 2 }
-        { V int-rep 1 V int-rep 3 }
-        { V int-rep 4 V int-rep 3 }
+        { 2 1 }
+        { 3 2 }
+        { 1 3 }
+        { 4 3 }
     } test-parallel-copy
 ] unit-test
\ No newline at end of file
index 348471c955310514f0c05d265982ebf1cacf38e8..ef4bada633508e2a3bce4261d8d0011f38e465b5 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs cpu.architecture compiler.cfg.hats
+USING: assocs cpu.architecture compiler.cfg.registers
 compiler.cfg.instructions deques dlists fry kernel locals namespaces
 sequences hashtables ;
 IN: compiler.cfg.parallel-copy
@@ -57,4 +57,5 @@ PRIVATE>
         ] slurp-deque
     ] with-scope ; inline
 
-: parallel-copy ( mapping -- ) i [ int-rep ##copy ] parallel-mapping ;
\ No newline at end of file
+: parallel-copy ( mapping -- )
+    next-vreg [ any-rep ##copy ] parallel-mapping ;
\ No newline at end of file
index 94ae2117eb1875104b314614fccf1b79b2689c38..0d518735afb337dcd004acca4a297ebc9b5e4f79 100644 (file)
@@ -1,18 +1,32 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors namespaces kernel arrays parser math math.order ;
+USING: accessors namespaces kernel parser assocs ;
 IN: compiler.cfg.registers
 
-! Virtual registers, used by CFG and machine IRs
-TUPLE: vreg rep { n fixnum read-only } ;
+! Virtual registers, used by CFG and machine IRs, are just integers
+SYMBOL: vreg-counter
 
-M: vreg equal? over vreg? [ [ n>> ] bi@ eq? ] [ 2drop f ] if ;
+: next-vreg ( -- vreg )
+    ! This word cannot be called AFTER representation selection has run;
+    ! use next-vreg-rep in that case
+    \ vreg-counter counter ;
 
-M: vreg hashcode* nip n>> ;
+SYMBOL: representations
 
-SYMBOL: vreg-counter
+ERROR: bad-vreg vreg ;
+
+: rep-of ( vreg -- rep )
+    ! This word cannot be called BEFORE representation selection has run;
+    ! use any-rep for ##copy instructions and so on
+    representations get ?at [ bad-vreg ] unless ;
+
+: set-rep-of ( rep vreg -- )
+    representations get set-at ;
 
-: next-vreg ( rep -- vreg ) \ vreg-counter counter vreg boa ;
+: next-vreg-rep ( rep -- vreg )
+    ! This word cannot be called BEFORE representation selection has run;
+    ! use next-vreg in that case
+    next-vreg [ set-rep-of ] keep ;
 
 ! Stack locations -- 'n' is an index starting from the top of the stack
 ! going down. So 0 is the top of the stack, 1 is what would be the top
@@ -28,6 +42,5 @@ C: <ds-loc> ds-loc
 TUPLE: rs-loc < loc ;
 C: <rs-loc> rs-loc
 
-SYNTAX: V scan-word scan-word vreg boa parsed ;
 SYNTAX: D scan-word <ds-loc> parsed ;
 SYNTAX: R scan-word <rs-loc> parsed ;
index d7f8086aa872207384d1645a06269ec31ef651e8..92a69547866b64a0d2783041b7395b3d58de997a 100644 (file)
@@ -10,7 +10,4 @@ SYMBOL: renamings
 : rename-value ( vreg -- vreg' )
     renamings get ?at drop ;
 
-: fresh-value ( vreg -- vreg' )
-    rep>> next-vreg ;
-
-RENAMING: rename [ rename-value ] [ rename-value ] [ fresh-value ]
+RENAMING: rename [ rename-value ] [ rename-value ] [ drop next-vreg ]
diff --git a/basis/compiler/cfg/representations/preferred/preferred-tests.factor b/basis/compiler/cfg/representations/preferred/preferred-tests.factor
new file mode 100644 (file)
index 0000000..e69de29
index 23be9df8c48bbf9b341b10f7d46315674038715c..e9ec7e8835309f580749674a85bcb5103a93c01b 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors sequences arrays fry namespaces
-cpu.architecture compiler.cfg compiler.cfg.rpo
+cpu.architecture compiler.cfg.utilities compiler.cfg compiler.cfg.rpo
 compiler.cfg.instructions compiler.cfg.def-use ;
 IN: compiler.cfg.representations.preferred
 
@@ -73,10 +73,11 @@ M: insn uses-vreg-reps drop f ;
 : with-vreg-reps ( cfg vreg-quot: ( vreg rep -- ) -- )
     '[
         [ basic-block set ] [
-            instructions>> [
-                dup ##phi? [ drop ] [
-                    _ [ each-def-rep ] [ each-use-rep ] [ each-temp-rep ] 2tri
-                ] if
-            ] each
+            [
+                _
+                [ each-def-rep ]
+                [ each-use-rep ]
+                [ each-temp-rep ] 2tri
+            ] each-non-phi
         ] bi
     ] each-basic-block ; inline
index 4345a4abefbc8e6584badce2342547d08ed0ba76..29f0fa064ffbd7c4c477948cd1c21e7888b8e980 100644 (file)
@@ -5,15 +5,15 @@ IN: compiler.cfg.representations
 
 [ { double-float-rep double-float-rep } ] [
     T{ ##add-float
-       { dst V double-float-rep 5 }
-       { src1 V double-float-rep 3 }
-       { src2 V double-float-rep 4 }
+       { dst 5 }
+       { src1 3 }
+       { src2 4 }
     } uses-vreg-reps
 ] unit-test
 
 [ double-float-rep ] [
     T{ ##alien-double
-       { dst V double-float-rep 5 }
-       { src V int-rep 3 }
+       { dst 5 }
+       { src 3 }
     } defs-vreg-rep
 ] unit-test
\ No newline at end of file
index ee72feef23dc6ffc965fcaf9b0ade7fb6815f35b..71f589d3947aa91cb93c853464ad817af1f021f2 100644 (file)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2009 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel fry accessors sequences assocs sets namespaces
-arrays combinators make locals cpu.architecture compiler.utilities
+arrays combinators make locals deques dlists
+cpu.architecture compiler.utilities
 compiler.cfg
 compiler.cfg.rpo
-compiler.cfg.hats
 compiler.cfg.registers
 compiler.cfg.instructions
 compiler.cfg.def-use
@@ -14,8 +14,10 @@ compiler.cfg.renaming.functor
 compiler.cfg.representations.preferred ;
 IN: compiler.cfg.representations
 
-! Virtual register representation selection.
-! Still needs a loop nesting heuristic
+! Virtual register representation selection. Predecessors and loops
+! must be computed first.
+
+<PRIVATE
 
 ! For every vreg, compute possible representations.
 SYMBOL: possibilities
@@ -26,6 +28,23 @@ SYMBOL: possibilities
     H{ } clone [ '[ swap _ conjoin-at ] with-vreg-reps ] keep
     [ keys ] assoc-map possibilities set ;
 
+! Compute vregs which must remain tagged for their lifetime.
+SYMBOL: always-boxed
+
+:: (compute-always-boxed) ( vreg rep assoc -- )
+    rep int-rep eq? [
+        int-rep vreg assoc set-at
+    ] when ;
+
+: compute-always-boxed ( cfg -- assoc )
+    H{ } clone [
+        '[
+            [
+                [ _ (compute-always-boxed) ] each-def-rep
+            ] each-non-phi
+        ] each-basic-block
+    ] keep ;
+
 ! For every vreg, compute the cost of keeping it in every possible
 ! representation.
 
@@ -51,16 +70,18 @@ SYMBOL: costs
     [ '[ _ _ maybe-increase-cost ] ]
     2bi each ;
 
-! For every vreg, compute preferred representation, that minimizes costs.
-SYMBOL: preferred
+: compute-costs ( cfg -- costs )
+    init-costs [ representation-cost ] with-vreg-reps costs get ;
 
-: minimize-costs ( -- )
-    costs get [ >alist alist-min first ] assoc-map preferred set ;
+! For every vreg, compute preferred representation, that minimizes costs.
+: minimize-costs ( costs -- representations )
+    [ >alist alist-min first ] assoc-map ;
 
-: compute-costs ( cfg -- )
-    init-costs
-    [ representation-cost ] with-vreg-reps
-    minimize-costs ;
+: compute-representations ( cfg -- )
+    [ compute-costs minimize-costs ]
+    [ compute-always-boxed ]
+    bi assoc-union
+    representations set ;
 
 ! Insert conversions. This introduces new temporaries, so we need
 ! to rename opearands too.
@@ -70,7 +91,7 @@ SYMBOL: preferred
         { { int-rep int-rep } [ int-rep ##copy ] }
         { { double-float-rep double-float-rep } [ double-float-rep ##copy ] }
         { { double-float-rep int-rep } [ ##unbox-float ] }
-        { { int-rep double-float-rep } [ i ##box-float ] }
+        { { int-rep double-float-rep } [ int-rep next-vreg-rep ##box-float ] }
     } case ;
 
 :: emit-def-conversion ( dst preferred required -- new-dst' )
@@ -78,14 +99,14 @@ SYMBOL: preferred
     ! but the register has preferred representation 'preferred', then
     ! we rename the instruction's definition to a new register, which
     ! becomes the input of a conversion instruction.
-    dst required next-vreg [ preferred required emit-conversion ] keep ;
+    dst required next-vreg-rep [ preferred required emit-conversion ] keep ;
 
 :: emit-use-conversion ( src preferred required -- new-src' )
     ! If an instruction uses a register with representation 'required',
     ! but the register has preferred representation 'preferred', then
     ! we rename the instruction's input to a new register, which
     ! becomes the output of a conversion instruction.
-    required next-vreg [ src required preferred emit-conversion ] keep ;
+    required next-vreg-rep [ src required preferred emit-conversion ] keep ;
 
 SYMBOLS: renaming-set needs-renaming? ;
 
@@ -100,7 +121,7 @@ SYMBOLS: renaming-set needs-renaming? ;
     2array renaming-set get push needs-renaming? on ;
 
 :: (compute-renaming-set) ( vreg required quot: ( vreg preferred required -- ) -- )
-    vreg preferred get at :> preferred
+    vreg rep-of :> preferred
     preferred required eq?
     [ vreg no-renaming ]
     [ vreg vreg preferred required quot call record-renaming ] if ; inline
@@ -128,8 +149,15 @@ RENAMING: convert [ converted-value ] [ converted-value ] [ ]
 
 GENERIC: conversions-for-insn ( insn -- )
 
-! Inserting conversions for a phi is done in compiler.cfg.cssa
-M: ##phi conversions-for-insn , ;
+SYMBOL: phi-mappings
+
+! compiler.cfg.cssa inserts conversions which convert phi inputs into
+!  the representation of the output. However, we still have to do some
+!  processing here, because if the only node that uses the output of
+!  the phi instruction is another phi instruction then this phi node's
+! output won't have a representation assigned.
+M: ##phi conversions-for-insn
+    [ , ] [ [ inputs>> values ] [ dst>> ] bi phi-mappings get set-at ] bi ;
 
 M: vreg-insn conversions-for-insn
     [ compute-renaming-set ] [ perform-renaming ] bi ;
@@ -145,13 +173,54 @@ M: insn conversions-for-insn , ;
         ] change-instructions drop
     ] if ;
 
+! If the output of a phi instruction is only used as the input to another
+! phi instruction, then we want to use the same representation for both
+! if possible.
+SYMBOL: work-list
+
+: add-to-work-list ( vregs -- )
+    work-list get push-all-front ;
+
+: rep-assigned ( vregs -- vregs' )
+    representations get '[ _ key? ] filter ;
+
+: rep-not-assigned ( vregs -- vregs' )
+    representations get '[ _ key? not ] filter ;
+
+: add-ready-phis ( -- )
+    phi-mappings get keys rep-assigned add-to-work-list ;
+
+: process-phi-mapping ( dst -- )
+    ! If dst = phi(src1,src2,...) and dst's representation has been
+    ! determined, assign that representation to each one of src1,...
+    ! that does not have a representation yet, and process those, too.
+    dup phi-mappings get at* [
+        [ rep-of ] [ rep-not-assigned ] bi*
+        [ [ set-rep-of ] with each ] [ add-to-work-list ] bi
+    ] [ 2drop ] if ;
+
+: remaining-phi-mappings ( -- )
+    phi-mappings get keys rep-not-assigned
+    [ [ int-rep ] dip set-rep-of ] each ;
+
+: process-phi-mappings ( -- )
+    <hashed-dlist> work-list set
+    add-ready-phis
+    work-list get [ process-phi-mapping ] slurp-deque
+    remaining-phi-mappings ;
+
 : insert-conversions ( cfg -- )
-    [ conversions-for-block ] each-basic-block ;
+    H{ } clone phi-mappings set
+    [ conversions-for-block ] each-basic-block
+    process-phi-mappings ;
+
+PRIVATE>
 
 : select-representations ( cfg -- cfg' )
     {
         [ compute-possibilities ]
-        [ compute-costs ]
+        [ compute-representations ]
         [ insert-conversions ]
-        [ preferred get [ >>rep drop ] assoc-each ]
-    } cleave ;
\ No newline at end of file
+        [ ]
+    } cleave
+    representations get cfg get (>>reps) ;
\ No newline at end of file
index 6cebf18a15cf22b710433d0e6e644b22aca73dd1..4814aba935b01678e0e94c4830e5d1622910e339 100644 (file)
@@ -13,24 +13,24 @@ IN: compiler.cfg.ssa.construction.tests
 reset-counters
 
 V{
-    T{ ##load-immediate f V int-rep 1 100 }
-    T{ ##add-imm f V int-rep 2 V int-rep 1 50 }
-    T{ ##add-imm f V int-rep 2 V int-rep 2 10 }
+    T{ ##load-immediate f 1 100 }
+    T{ ##add-imm f 2 1 50 }
+    T{ ##add-imm f 2 2 10 }
     T{ ##branch }
 } 0 test-bb
 
 V{
-    T{ ##load-immediate f V int-rep 3 3 }
+    T{ ##load-immediate f 3 3 }
     T{ ##branch }
 } 1 test-bb
 
 V{
-    T{ ##load-immediate f V int-rep 3 4 }
+    T{ ##load-immediate f 3 4 }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##replace f V int-rep 3 D 0 }
+    T{ ##replace f 3 D 0 }
     T{ ##return }
 } 3 test-bb
 
@@ -49,23 +49,23 @@ V{
 
 [
     V{
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 1 50 }
-        T{ ##add-imm f V int-rep 3 V int-rep 2 10 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 1 50 }
+        T{ ##add-imm f 3 2 10 }
         T{ ##branch }
     }
 ] [ 0 get instructions>> ] unit-test
 
 [
     V{
-        T{ ##load-immediate f V int-rep 4 3 }
+        T{ ##load-immediate f 4 3 }
         T{ ##branch }
     }
 ] [ 1 get instructions>> ] unit-test
 
 [
     V{
-        T{ ##load-immediate f V int-rep 5 4 }
+        T{ ##load-immediate f 5 4 }
         T{ ##branch }
     }
 ] [ 2 get instructions>> ] unit-test
@@ -75,8 +75,8 @@ V{
 
 [
     V{
-        T{ ##phi f V int-rep 6 H{ { 1 V int-rep 4 } { 2 V int-rep 5 } } }
-        T{ ##replace f V int-rep 6 D 0 }
+        T{ ##phi f 6 H{ { 1 4 } { 2 5 } } }
+        T{ ##replace f 6 D 0 }
         T{ ##return }
     }
 ] [
@@ -88,9 +88,9 @@ reset-counters
 
 V{ } 0 test-bb
 V{ } 1 test-bb
-V{ T{ ##peek f V int-rep 0 D 0 } } 2 test-bb
-V{ T{ ##peek f V int-rep 0 D 0 } } 3 test-bb
-V{ T{ ##replace f V int-rep 0 D 0 } } 4 test-bb
+V{ T{ ##peek f 0 D 0 } } 2 test-bb
+V{ T{ ##peek f 0 D 0 } } 3 test-bb
+V{ T{ ##replace f 0 D 0 } } 4 test-bb
 V{ } 5 test-bb
 V{ } 6 test-bb
 
@@ -105,8 +105,8 @@ V{ } 6 test-bb
 
 [
     V{
-        T{ ##phi f V int-rep 3 H{ { 2 V int-rep 1 } { 3 V int-rep 2 } } }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##phi f 3 H{ { 2 1 } { 3 2 } } }
+        T{ ##replace f 3 D 0 }
     }
 ] [
     4 get instructions>>
index 21a6cca4006a8ccbd58fe04788739a3f56a58303..d77c45232a37662a3efdbabd6f2c413c80103c69 100644 (file)
@@ -76,7 +76,7 @@ SYMBOLS: stacks pushed ;
     H{ } clone stacks set ;
 
 : gen-name ( vreg -- vreg' )
-    [ fresh-value dup ] keep
+    [ next-vreg dup ] dip
     dup pushed get 2dup key?
     [ 2drop stacks get at set-last ]
     [ conjoin stacks get push-at ]
index e05d54b6b99e2b968039f0313c94224652c853cf..14287e900f7a60539758f562e4d178eae845818d 100644 (file)
@@ -9,15 +9,17 @@ compiler.cfg.instructions
 compiler.cfg.representations ;
 IN: compiler.cfg.ssa.cssa
 
-! Convert SSA to conventional SSA.
+! Convert SSA to conventional SSA. This pass runs after representation
+! selection, so it must keep track of representations when introducing
+! new values.
 
 :: insert-copy ( bb src rep -- bb dst )
-    rep next-vreg :> dst
-    bb [ dst src rep src rep>> emit-conversion ] add-instructions
+    rep next-vreg-rep :> dst
+    bb [ dst src rep src rep-of emit-conversion ] add-instructions
     bb dst ;
 
 : convert-phi ( ##phi -- )
-    dup dst>> rep>> '[ [ _ insert-copy ] assoc-map ] change-inputs drop ;
+    dup dst>> rep-of '[ [ _ insert-copy ] assoc-map ] change-inputs drop ;
 
 : construct-cssa ( cfg -- )
     [ [ convert-phi ] each-phi ] each-basic-block ;
\ No newline at end of file
index d69af0547e9bbdb35395e8f7183e1ea8dd4f3280..c19f615e958f0e21429af8d880c8574fc1d3f5a0 100644 (file)
@@ -49,10 +49,9 @@ SYMBOL: copies
 : eliminate-copy ( vreg1 vreg2 -- )
     [ leader ] bi@
     2dup eq? [ 2drop ] [
-        [ [ rep>> ] bi@ assert= ]
         [ update-leaders ]
         [ merge-classes ]
-        2tri
+        2bi
     ] if ;
 
 : introduce-vreg ( vreg -- )
index fea46787c5205c95ec73534379dace83fe7d6554..cdcacd709160fb2006d5dd6e8850a9da2ebc0d89 100644 (file)
@@ -16,19 +16,19 @@ IN: compiler.cfg.ssa.interference.tests
     compute-live-ranges ;
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##peek f V int-rep 2 D 0 }
-    T{ ##copy f V int-rep 1 V int-rep 0 }
-    T{ ##copy f V int-rep 3 V int-rep 2 }
+    T{ ##peek f 0 D 0 }
+    T{ ##peek f 2 D 0 }
+    T{ ##copy f 1 0 }
+    T{ ##copy f 3 2 }
     T{ ##branch }
 } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 4 D 0 }
-    T{ ##peek f V int-rep 5 D 0 }
-    T{ ##replace f V int-rep 3 D 0 }
-    T{ ##peek f V int-rep 6 D 0 }
-    T{ ##replace f V int-rep 5 D 0 }
+    T{ ##peek f 4 D 0 }
+    T{ ##peek f 5 D 0 }
+    T{ ##replace f 3 D 0 }
+    T{ ##peek f 6 D 0 }
+    T{ ##replace f 5 D 0 }
     T{ ##return }
 } 1 test-bb
 
@@ -36,17 +36,17 @@ V{
 
 [ ] [ test-interference ] unit-test
 
-[ f ] [ V int-rep 0 V int-rep 1 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 1 V int-rep 0 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 2 V int-rep 3 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 3 V int-rep 2 vregs-interfere? ] unit-test
-[ t ] [ V int-rep 0 V int-rep 2 vregs-interfere? ] unit-test
-[ t ] [ V int-rep 2 V int-rep 0 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 1 V int-rep 3 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 3 V int-rep 1 vregs-interfere? ] unit-test
-[ t ] [ V int-rep 3 V int-rep 4 vregs-interfere? ] unit-test
-[ t ] [ V int-rep 4 V int-rep 3 vregs-interfere? ] unit-test
-[ t ] [ V int-rep 3 V int-rep 5 vregs-interfere? ] unit-test
-[ t ] [ V int-rep 5 V int-rep 3 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 3 V int-rep 6 vregs-interfere? ] unit-test
-[ f ] [ V int-rep 6 V int-rep 3 vregs-interfere? ] unit-test
\ No newline at end of file
+[ f ] [ 0 1 vregs-interfere? ] unit-test
+[ f ] [ 1 0 vregs-interfere? ] unit-test
+[ f ] [ 2 3 vregs-interfere? ] unit-test
+[ f ] [ 3 2 vregs-interfere? ] unit-test
+[ t ] [ 0 2 vregs-interfere? ] unit-test
+[ t ] [ 2 0 vregs-interfere? ] unit-test
+[ f ] [ 1 3 vregs-interfere? ] unit-test
+[ f ] [ 3 1 vregs-interfere? ] unit-test
+[ t ] [ 3 4 vregs-interfere? ] unit-test
+[ t ] [ 4 3 vregs-interfere? ] unit-test
+[ t ] [ 3 5 vregs-interfere? ] unit-test
+[ t ] [ 5 3 vregs-interfere? ] unit-test
+[ f ] [ 3 6 vregs-interfere? ] unit-test
+[ f ] [ 6 3 vregs-interfere? ] unit-test
\ No newline at end of file
index c6558b1fb8d0d0b521200bdc605f9a9a39a4c22d..4878dbe3ab6b338ffd48624b014b3bd01c54031c 100644 (file)
@@ -22,7 +22,7 @@ SYMBOLS: peek-sets replace-sets kill-sets ;
 
 SYMBOL: locs>vregs
 
-: loc>vreg ( loc -- vreg ) locs>vregs get [ drop i ] cache ;
+: loc>vreg ( loc -- vreg ) locs>vregs get [ drop next-vreg ] cache ;
 : vreg>loc ( vreg -- loc/f ) locs>vregs get value-at ;
 
 TUPLE: current-height
index 7d8b15d7aab46ec935dcb034d595effc4f0e8687..df355f9d9a9f9ac0738027220c9a0bbd022d9d1f 100644 (file)
@@ -14,14 +14,14 @@ V{
 } 0 test-bb
 
 V{
-    T{ ##replace f V int-rep 0 D 0 }
-    T{ ##replace f V int-rep 0 D 1 }
-    T{ ##replace f V int-rep 0 D 2 }
+    T{ ##replace f 0 D 0 }
+    T{ ##replace f 0 D 1 }
+    T{ ##replace f 0 D 2 }
     T{ ##inc-r f 1 }
 } 1 test-bb
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
+    T{ ##peek f 0 D 0 }
     T{ ##inc-d f 1 }
 } 2 test-bb
 
index b99ea66c94ccce19d94bc4e6b850b7c1fbf0215a..2bc20cee1a7d81f2dc95d93678ac39932ddb3f77 100644 (file)
@@ -1,27 +1,37 @@
 IN: compiler.cfg.two-operand.tests
-USING: compiler.cfg.two-operand compiler.cfg.instructions
+USING: kernel compiler.cfg.two-operand compiler.cfg.instructions
 compiler.cfg.registers cpu.architecture namespaces tools.test ;
 
 3 vreg-counter set-global
 
 [
     V{
-        T{ ##copy f V int-rep 1 V int-rep 2 int-rep }
-        T{ ##sub f V int-rep 1 V int-rep 1 V int-rep 3 }
+        T{ ##copy f 1 2 int-rep }
+        T{ ##sub f 1 1 3 }
     }
 ] [
+    H{
+        { 1 int-rep }
+        { 2 int-rep }
+        { 3 int-rep }
+    } clone representations set
     {
-        T{ ##sub f V int-rep 1 V int-rep 2 V int-rep 3 }
+        T{ ##sub f 1 2 3 }
     } (convert-two-operand)
 ] unit-test
 
 [
     V{
-        T{ ##copy f V double-float-rep 1 V double-float-rep 2 double-float-rep }
-        T{ ##sub-float f V double-float-rep 1 V double-float-rep 1 V double-float-rep 3 }
+        T{ ##copy f 1 2 double-float-rep }
+        T{ ##sub-float f 1 1 3 }
     }
 ] [
+    H{
+        { 1 double-float-rep }
+        { 2 double-float-rep }
+        { 3 double-float-rep }
+    } clone representations set
     {
-        T{ ##sub-float f V double-float-rep 1 V double-float-rep 2 V double-float-rep 3 }
+        T{ ##sub-float f 1 2 3 }
     } (convert-two-operand)
 ] unit-test
index 316390256395a307a5b195763b6addb8074c8910..41e5cb77d8eae1f73770af05145dfe592c467898 100644 (file)
@@ -44,7 +44,7 @@ UNION: two-operand-insn
 GENERIC: convert-two-operand* ( insn -- )
 
 : emit-copy ( dst src -- )
-    dup rep>> ##copy ; inline
+    dup rep-of ##copy ; inline
 
 M: two-operand-insn convert-two-operand*
     [ [ dst>> ] [ src1>> ] bi emit-copy ]
index 9246084325e482be75f550d08f2c1a6fe02ade6d..6d68bca4b9fd9d907754b5b9187cd0bc968b3be6 100644 (file)
@@ -69,6 +69,10 @@ SYMBOL: visited
     [ instructions>> ] dip
     '[ dup ##phi? [ @ t ] [ drop f ] if ] all? drop ; inline
 
+: each-non-phi ( bb quot: ( insn -- ) -- )
+    [ instructions>> ] dip
+    '[ dup ##phi? [ drop ] _ if ] each ; inline
+
 : predecessor ( bb -- pred )
     predecessors>> first ; inline
 
index 4b8ee2a1ae50915328f0db78ce219048d359ba35..50f809cc99ac6e3d6aad33406e79be6892feee47 100755 (executable)
@@ -4,7 +4,7 @@ USING: accessors combinators combinators.short-circuit arrays
 fry kernel layouts math namespaces sequences cpu.architecture
 math.bitwise math.order classes vectors
 compiler.cfg
-compiler.cfg.hats
+compiler.cfg.registers
 compiler.cfg.comparisons
 compiler.cfg.instructions
 compiler.cfg.value-numbering.expressions
@@ -77,7 +77,7 @@ M: ##compare-imm-branch rewrite-tagged-comparison
 
 M: ##compare-imm rewrite-tagged-comparison
     [ dst>> ] [ (rewrite-tagged-comparison) ] bi
-    i \ ##compare-imm new-insn ;
+    next-vreg \ ##compare-imm new-insn ;
 
 : rewrite-redundant-comparison? ( insn -- ? )
     {
@@ -88,9 +88,9 @@ M: ##compare-imm rewrite-tagged-comparison
 
 : rewrite-redundant-comparison ( insn -- insn' )
     [ cc>> ] [ dst>> ] [ src1>> vreg>expr dup op>> ] tri {
-        { \ ##compare [ >compare-expr< i \ ##compare new-insn ] }
-        { \ ##compare-imm [ >compare-imm-expr< i \ ##compare-imm new-insn ] }
-        { \ ##compare-float [ >compare-expr< i \ ##compare-float new-insn ] }
+        { \ ##compare [ >compare-expr< next-vreg \ ##compare new-insn ] }
+        { \ ##compare-imm [ >compare-imm-expr< next-vreg \ ##compare-imm new-insn ] }
+        { \ ##compare-float [ >compare-expr< next-vreg \ ##compare-float new-insn ] }
     } case
     swap cc= eq? [ [ negate-cc ] change-cc ] when ;
 
@@ -169,7 +169,7 @@ M: ##compare-branch rewrite
     ] dip
     swap-compare
     [ vreg>constant ] dip
-    i \ ##compare-imm new-insn ; inline
+    next-vreg \ ##compare-imm new-insn ; inline
 
 : >boolean-insn ( insn ? -- insn' )
     [ dst>> ] dip
index 1cb62c44478dfed991f7bcb419772f3b90a1cf69..583d7730b0b32962bb14f3aa3c2bc171c05a774b 100644 (file)
@@ -1,10 +1,11 @@
-IN: compiler.cfg.value-numbering.tests
 USING: compiler.cfg.value-numbering compiler.cfg.instructions
 compiler.cfg.registers compiler.cfg.debugger compiler.cfg.comparisons
 cpu.architecture tools.test kernel math combinators.short-circuit
-accessors sequences compiler.cfg.predecessors locals
-compiler.cfg.dce compiler.cfg.ssa.destruction
-compiler.cfg assocs vectors arrays layouts namespaces ;
+accessors sequences compiler.cfg.predecessors locals compiler.cfg.dce
+compiler.cfg.ssa.destruction compiler.cfg.loop-detection
+compiler.cfg.representations compiler.cfg assocs vectors arrays
+layouts namespaces ;
+IN: compiler.cfg.value-numbering.tests
 
 : trim-temps ( insns -- insns )
     [
@@ -18,853 +19,853 @@ compiler.cfg assocs vectors arrays layouts namespaces ;
 ! Folding constants together
 [
     {
-        T{ ##load-reference f V int-rep 0 0.0 }
-        T{ ##load-reference f V int-rep 1 -0.0 }
-        T{ ##replace f V int-rep 0 D 0 }
-        T{ ##replace f V int-rep 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##load-reference f 1 -0.0 }
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 1 D 1 }
     }
 ] [
     {
-        T{ ##load-reference f V int-rep 0 0.0 }
-        T{ ##load-reference f V int-rep 1 -0.0 }
-        T{ ##replace f V int-rep 0 D 0 }
-        T{ ##replace f V int-rep 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##load-reference f 1 -0.0 }
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 1 D 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-reference f V int-rep 0 0.0 }
-        T{ ##copy f V int-rep 1 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 0 D 0 }
-        T{ ##replace f V int-rep 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 1 D 1 }
     }
 ] [
     {
-        T{ ##load-reference f V int-rep 0 0.0 }
-        T{ ##load-reference f V int-rep 1 0.0 }
-        T{ ##replace f V int-rep 0 D 0 }
-        T{ ##replace f V int-rep 1 D 1 }
+        T{ ##load-reference f 0 0.0 }
+        T{ ##load-reference f 1 0.0 }
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 1 D 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-reference f V int-rep 0 t }
-        T{ ##copy f V int-rep 1 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 0 D 0 }
-        T{ ##replace f V int-rep 1 D 1 }
+        T{ ##load-reference f 0 t }
+        T{ ##copy f 1 0 any-rep }
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 1 D 1 }
     }
 ] [
     {
-        T{ ##load-reference f V int-rep 0 t }
-        T{ ##load-reference f V int-rep 1 t }
-        T{ ##replace f V int-rep 0 D 0 }
-        T{ ##replace f V int-rep 1 D 1 }
+        T{ ##load-reference f 0 t }
+        T{ ##load-reference f 1 t }
+        T{ ##replace f 0 D 0 }
+        T{ ##replace f 1 D 1 }
     } value-numbering-step
 ] unit-test
 
 ! Compare propagation
 [
     {
-        T{ ##load-reference f V int-rep 1 + }
-        T{ ##peek f V int-rep 2 D 0 }
-        T{ ##compare f V int-rep 4 V int-rep 2 V int-rep 1 cc> }
-        T{ ##copy f V int-rep 6 V int-rep 4 int-rep }
-        T{ ##replace f V int-rep 6 D 0 }
+        T{ ##load-reference f 1 + }
+        T{ ##peek f 2 D 0 }
+        T{ ##compare f 4 2 1 cc> }
+        T{ ##copy f 6 4 any-rep }
+        T{ ##replace f 6 D 0 }
     }
 ] [
     {
-        T{ ##load-reference f V int-rep 1 + }
-        T{ ##peek f V int-rep 2 D 0 }
-        T{ ##compare f V int-rep 4 V int-rep 2 V int-rep 1 cc> }
-        T{ ##compare-imm f V int-rep 6 V int-rep 4 5 cc/= }
-        T{ ##replace f V int-rep 6 D 0 }
+        T{ ##load-reference f 1 + }
+        T{ ##peek f 2 D 0 }
+        T{ ##compare f 4 2 1 cc> }
+        T{ ##compare-imm f 6 4 5 cc/= }
+        T{ ##replace f 6 D 0 }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##load-reference f V int-rep 1 + }
-        T{ ##peek f V int-rep 2 D 0 }
-        T{ ##compare f V int-rep 4 V int-rep 2 V int-rep 1 cc<= }
-        T{ ##compare f V int-rep 6 V int-rep 2 V int-rep 1 cc> }
-        T{ ##replace f V int-rep 6 D 0 }
+        T{ ##load-reference f 1 + }
+        T{ ##peek f 2 D 0 }
+        T{ ##compare f 4 2 1 cc<= }
+        T{ ##compare f 6 2 1 cc> }
+        T{ ##replace f 6 D 0 }
     }
 ] [
     {
-        T{ ##load-reference f V int-rep 1 + }
-        T{ ##peek f V int-rep 2 D 0 }
-        T{ ##compare f V int-rep 4 V int-rep 2 V int-rep 1 cc<= }
-        T{ ##compare-imm f V int-rep 6 V int-rep 4 5 cc= }
-        T{ ##replace f V int-rep 6 D 0 }
+        T{ ##load-reference f 1 + }
+        T{ ##peek f 2 D 0 }
+        T{ ##compare f 4 2 1 cc<= }
+        T{ ##compare-imm f 6 4 5 cc= }
+        T{ ##replace f 6 D 0 }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 8 D 0 }
-        T{ ##peek f V int-rep 9 D -1 }
-        T{ ##unbox-float f V double-float-rep 10 V int-rep 8 }
-        T{ ##unbox-float f V double-float-rep 11 V int-rep 9 }
-        T{ ##compare-float f V int-rep 12 V double-float-rep 10 V double-float-rep 11 cc< }
-        T{ ##compare-float f V int-rep 14 V double-float-rep 10 V double-float-rep 11 cc>= }
-        T{ ##replace f V int-rep 14 D 0 }
+        T{ ##peek f 8 D 0 }
+        T{ ##peek f 9 D -1 }
+        T{ ##unbox-float f 10 8 }
+        T{ ##unbox-float f 11 9 }
+        T{ ##compare-float f 12 10 11 cc< }
+        T{ ##compare-float f 14 10 11 cc>= }
+        T{ ##replace f 14 D 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 8 D 0 }
-        T{ ##peek f V int-rep 9 D -1 }
-        T{ ##unbox-float f V double-float-rep 10 V int-rep 8 }
-        T{ ##unbox-float f V double-float-rep 11 V int-rep 9 }
-        T{ ##compare-float f V int-rep 12 V double-float-rep 10 V double-float-rep 11 cc< }
-        T{ ##compare-imm f V int-rep 14 V int-rep 12 5 cc= }
-        T{ ##replace f V int-rep 14 D 0 }
+        T{ ##peek f 8 D 0 }
+        T{ ##peek f 9 D -1 }
+        T{ ##unbox-float f 10 8 }
+        T{ ##unbox-float f 11 9 }
+        T{ ##compare-float f 12 10 11 cc< }
+        T{ ##compare-imm f 14 12 5 cc= }
+        T{ ##replace f 14 D 0 }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 29 D -1 }
-        T{ ##peek f V int-rep 30 D -2 }
-        T{ ##compare f V int-rep 33 V int-rep 29 V int-rep 30 cc<= }
-        T{ ##compare-branch f V int-rep 29 V int-rep 30 cc<= }
+        T{ ##peek f 29 D -1 }
+        T{ ##peek f 30 D -2 }
+        T{ ##compare f 33 29 30 cc<= }
+        T{ ##compare-branch f 29 30 cc<= }
     }
 ] [
     {
-        T{ ##peek f V int-rep 29 D -1 }
-        T{ ##peek f V int-rep 30 D -2 }
-        T{ ##compare f V int-rep 33 V int-rep 29 V int-rep 30 cc<= }
-        T{ ##compare-imm-branch f V int-rep 33 5 cc/= }
+        T{ ##peek f 29 D -1 }
+        T{ ##peek f 30 D -2 }
+        T{ ##compare f 33 29 30 cc<= }
+        T{ ##compare-imm-branch f 33 5 cc/= }
     } value-numbering-step trim-temps
 ] unit-test
 
 ! Immediate operand conversion
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add f V int-rep 2 V int-rep 0 V int-rep 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add f 2 0 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add f V int-rep 2 V int-rep 1 V int-rep 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add f 2 1 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 -100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 -100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##sub f V int-rep 2 V int-rep 0 V int-rep 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##sub f 2 0 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##sub f V int-rep 1 V int-rep 0 V int-rep 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##sub f 1 0 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul f V int-rep 2 V int-rep 0 V int-rep 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul f 2 0 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul f V int-rep 2 V int-rep 1 V int-rep 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul f 2 1 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 1 D 0 }
-        T{ ##shl-imm f V int-rep 2 V int-rep 1 3 }
+        T{ ##peek f 1 D 0 }
+        T{ ##shl-imm f 2 1 3 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 1 D 0 }
-        T{ ##mul-imm f V int-rep 2 V int-rep 1 8 }
+        T{ ##peek f 1 D 0 }
+        T{ ##mul-imm f 2 1 8 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and f V int-rep 2 V int-rep 0 V int-rep 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and f 2 0 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and f V int-rep 2 V int-rep 1 V int-rep 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and f 2 1 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or f V int-rep 2 V int-rep 0 V int-rep 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or f 2 0 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or f V int-rep 2 V int-rep 1 V int-rep 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or f 2 1 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor f V int-rep 2 V int-rep 0 V int-rep 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor f 2 0 1 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor-imm f V int-rep 2 V int-rep 0 100 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor-imm f 2 0 100 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor f V int-rep 2 V int-rep 1 V int-rep 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor f 2 1 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare-imm f V int-rep 2 V int-rep 0 100 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare-imm f 2 0 100 cc<= }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare f V int-rep 2 V int-rep 0 V int-rep 1 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare f 2 0 1 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare-imm f V int-rep 2 V int-rep 0 100 cc>= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare-imm f 2 0 100 cc>= }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare f V int-rep 2 V int-rep 1 V int-rep 0 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare f 2 1 0 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare-imm-branch f V int-rep 0 100 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare-imm-branch f 0 100 cc<= }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 1 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare-branch f 0 1 cc<= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare-imm-branch f V int-rep 0 100 cc>= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare-imm-branch f 0 100 cc>= }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##compare-branch f V int-rep 1 V int-rep 0 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##compare-branch f 1 0 cc<= }
     } value-numbering-step trim-temps
 ] unit-test
 
 ! Reassociation
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##add-imm f V int-rep 4 V int-rep 0 150 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##add-imm f 4 0 150 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##add f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##add f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##add-imm f V int-rep 4 V int-rep 0 150 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##add-imm f 4 0 150 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add f V int-rep 2 V int-rep 1 V int-rep 0 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##add f V int-rep 4 V int-rep 3 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add f 2 1 0 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##add f 4 3 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##add-imm f V int-rep 4 V int-rep 0 50 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##add-imm f 4 0 50 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##sub f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##sub f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##add-imm f V int-rep 2 V int-rep 0 -100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##add-imm f V int-rep 4 V int-rep 0 -150 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##add-imm f 2 0 -100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##add-imm f 4 0 -150 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##sub f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##sub f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##sub f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##sub f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##mul-imm f V int-rep 4 V int-rep 0 5000 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##mul-imm f 4 0 5000 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##mul f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##mul f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##mul-imm f V int-rep 4 V int-rep 0 5000 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##mul-imm f 4 0 5000 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##mul f V int-rep 2 V int-rep 1 V int-rep 0 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##mul f V int-rep 4 V int-rep 3 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##mul f 2 1 0 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##mul f 4 3 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##and-imm f V int-rep 4 V int-rep 0 32 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##and-imm f 4 0 32 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##and f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##and f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##and-imm f V int-rep 4 V int-rep 0 32 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##and-imm f 4 0 32 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##and f V int-rep 2 V int-rep 1 V int-rep 0 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##and f V int-rep 4 V int-rep 3 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##and f 2 1 0 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##and f 4 3 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##or-imm f V int-rep 4 V int-rep 0 118 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##or-imm f 4 0 118 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##or f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##or f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##or-imm f V int-rep 4 V int-rep 0 118 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##or-imm f 4 0 118 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##or f V int-rep 2 V int-rep 1 V int-rep 0 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##or f V int-rep 4 V int-rep 3 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##or f 2 1 0 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##or f 4 3 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##xor-imm f V int-rep 4 V int-rep 0 86 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##xor-imm f 4 0 86 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##xor f V int-rep 4 V int-rep 2 V int-rep 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor f 2 0 1 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##xor f 4 2 3 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor-imm f V int-rep 2 V int-rep 0 100 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##xor-imm f V int-rep 4 V int-rep 0 86 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor-imm f 2 0 100 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##xor-imm f 4 0 86 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 100 }
-        T{ ##xor f V int-rep 2 V int-rep 1 V int-rep 0 }
-        T{ ##load-immediate f V int-rep 3 50 }
-        T{ ##xor f V int-rep 4 V int-rep 3 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 100 }
+        T{ ##xor f 2 1 0 }
+        T{ ##load-immediate f 3 50 }
+        T{ ##xor f 4 3 2 }
     } value-numbering-step
 ] unit-test
 
 ! Simplification
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##load-immediate f V int-rep 2 0 }
-        T{ ##copy f V int-rep 3 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##load-immediate f 2 0 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##sub f V int-rep 2 V int-rep 1 V int-rep 1 }
-        T{ ##add f V int-rep 3 V int-rep 0 V int-rep 2 }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##sub f 2 1 1 }
+        T{ ##add f 3 0 2 }
+        T{ ##replace f 3 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##load-immediate f V int-rep 2 0 }
-        T{ ##copy f V int-rep 3 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##load-immediate f 2 0 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##sub f V int-rep 2 V int-rep 1 V int-rep 1 }
-        T{ ##sub f V int-rep 3 V int-rep 0 V int-rep 2 }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##sub f 2 1 1 }
+        T{ ##sub f 3 0 2 }
+        T{ ##replace f 3 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##load-immediate f V int-rep 2 0 }
-        T{ ##copy f V int-rep 3 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##load-immediate f 2 0 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##sub f V int-rep 2 V int-rep 1 V int-rep 1 }
-        T{ ##or f V int-rep 3 V int-rep 0 V int-rep 2 }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##sub f 2 1 1 }
+        T{ ##or f 3 0 2 }
+        T{ ##replace f 3 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##load-immediate f V int-rep 2 0 }
-        T{ ##copy f V int-rep 3 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##load-immediate f 2 0 }
+        T{ ##copy f 3 0 any-rep }
+        T{ ##replace f 3 D 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##peek f V int-rep 1 D 1 }
-        T{ ##sub f V int-rep 2 V int-rep 1 V int-rep 1 }
-        T{ ##xor f V int-rep 3 V int-rep 0 V int-rep 2 }
-        T{ ##replace f V int-rep 3 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##peek f 1 D 1 }
+        T{ ##sub f 2 1 1 }
+        T{ ##xor f 3 0 2 }
+        T{ ##replace f 3 D 0 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##copy f V int-rep 2 V int-rep 0 int-rep }
-        T{ ##replace f V int-rep 2 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##copy f 2 0 any-rep }
+        T{ ##replace f 2 D 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##mul f V int-rep 2 V int-rep 0 V int-rep 1 }
-        T{ ##replace f V int-rep 2 D 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##mul f 2 0 1 }
+        T{ ##replace f 2 D 0 }
     } value-numbering-step
 ] unit-test
 
 ! Constant folding
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##load-immediate f V int-rep 3 4 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##load-immediate f 3 4 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##add f V int-rep 3 V int-rep 1 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##add f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##load-immediate f V int-rep 3 -2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##load-immediate f 3 -2 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##sub f V int-rep 3 V int-rep 1 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##sub f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##load-immediate f V int-rep 3 6 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##load-immediate f 3 6 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##mul f V int-rep 3 V int-rep 1 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##mul f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 1 }
-        T{ ##load-immediate f V int-rep 3 0 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 1 }
+        T{ ##load-immediate f 3 0 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 1 }
-        T{ ##and f V int-rep 3 V int-rep 1 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 1 }
+        T{ ##and f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 1 }
-        T{ ##load-immediate f V int-rep 3 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 1 }
+        T{ ##load-immediate f 3 3 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 1 }
-        T{ ##or f V int-rep 3 V int-rep 1 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 1 }
+        T{ ##or f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##load-immediate f V int-rep 3 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##load-immediate f 3 1 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 2 }
-        T{ ##load-immediate f V int-rep 2 3 }
-        T{ ##xor f V int-rep 3 V int-rep 1 V int-rep 2 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 2 }
+        T{ ##load-immediate f 2 3 }
+        T{ ##xor f 3 1 2 }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 3 8 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 3 8 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##shl-imm f V int-rep 3 V int-rep 1 3 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##shl-imm f 3 1 3 }
     } value-numbering-step
 ] unit-test
 
 cell 8 = [
     [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 1 -1 }
-            T{ ##load-immediate f V int-rep 3 HEX: ffffffffffff }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 1 -1 }
+            T{ ##load-immediate f 3 HEX: ffffffffffff }
         }
     ] [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 1 -1 }
-            T{ ##shr-imm f V int-rep 3 V int-rep 1 16 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 1 -1 }
+            T{ ##shr-imm f 3 1 16 }
         } value-numbering-step
     ] unit-test
 ] when
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 -8 }
-        T{ ##load-immediate f V int-rep 3 -4 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 -8 }
+        T{ ##load-immediate f 3 -4 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 -8 }
-        T{ ##sar-imm f V int-rep 3 V int-rep 1 1 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 -8 }
+        T{ ##sar-imm f 3 1 1 }
     } value-numbering-step
 ] unit-test
 
 cell 8 = [
     [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 1 65536 }
-            T{ ##load-immediate f V int-rep 2 140737488355328 }
-            T{ ##add f V int-rep 3 V int-rep 0 V int-rep 2 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 1 65536 }
+            T{ ##load-immediate f 2 140737488355328 }
+            T{ ##add f 3 0 2 }
         }
     ] [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 1 65536 }
-            T{ ##shl-imm f V int-rep 2 V int-rep 1 31 }
-            T{ ##add f V int-rep 3 V int-rep 0 V int-rep 2 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 1 65536 }
+            T{ ##shl-imm f 2 1 31 }
+            T{ ##add f 3 0 2 }
         } value-numbering-step
     ] unit-test
 
     [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 2 140737488355328 }
-            T{ ##add f V int-rep 3 V int-rep 0 V int-rep 2 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 2 140737488355328 }
+            T{ ##add f 3 0 2 }
         }
     ] [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 2 140737488355328 }
-            T{ ##add f V int-rep 3 V int-rep 0 V int-rep 2 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 2 140737488355328 }
+            T{ ##add f 3 0 2 }
         } value-numbering-step
     ] unit-test
 
     [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 2 2147483647 }
-            T{ ##add-imm f V int-rep 3 V int-rep 0 2147483647 }
-            T{ ##add-imm f V int-rep 4 V int-rep 3 2147483647 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 2 2147483647 }
+            T{ ##add-imm f 3 0 2147483647 }
+            T{ ##add-imm f 4 3 2147483647 }
         }
     ] [
         {
-            T{ ##peek f V int-rep 0 D 0 }
-            T{ ##load-immediate f V int-rep 2 2147483647 }
-            T{ ##add f V int-rep 3 V int-rep 0 V int-rep 2 }
-            T{ ##add f V int-rep 4 V int-rep 3 V int-rep 2 }
+            T{ ##peek f 0 D 0 }
+            T{ ##load-immediate f 2 2147483647 }
+            T{ ##add f 3 0 2 }
+            T{ ##add f 4 3 2 }
         } value-numbering-step
     ] unit-test
 ] when
@@ -872,129 +873,129 @@ cell 8 = [
 ! Branch folding
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##load-immediate f V int-rep 3 5 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##load-immediate f 3 5 }
     }
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare f V int-rep 3 V int-rep 1 V int-rep 2 cc= }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare f 3 1 2 cc= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##load-reference f V int-rep 3 t }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##load-reference f 3 t }
     }
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare f V int-rep 3 V int-rep 1 V int-rep 2 cc/= }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare f 3 1 2 cc/= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##load-reference f V int-rep 3 t }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##load-reference f 3 t }
     }
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare f V int-rep 3 V int-rep 1 V int-rep 2 cc< }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare f 3 1 2 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##load-immediate f V int-rep 3 5 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##load-immediate f 3 5 }
     }
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare f V int-rep 3 V int-rep 2 V int-rep 1 cc< }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare f 3 2 1 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 5 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 5 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc< }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc< }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-reference f V int-rep 1 t }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-reference f 1 t }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc<= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 5 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 5 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc> }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc> }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-reference f V int-rep 1 t }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-reference f 1 t }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc>= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc>= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-immediate f V int-rep 1 5 }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-immediate f 1 5 }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc/= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc/= }
     } value-numbering-step
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-reference f V int-rep 1 t }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-reference f 1 t }
     }
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc= }
     } value-numbering-step
 ] unit-test
 
@@ -1005,154 +1006,154 @@ cell 8 = [
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare-branch f V int-rep 1 V int-rep 2 cc= }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare-branch f 1 2 cc= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare-branch f V int-rep 1 V int-rep 2 cc/= }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare-branch f 1 2 cc/= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare-branch f V int-rep 1 V int-rep 2 cc< }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare-branch f 1 2 cc< }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##load-immediate f V int-rep 1 1 }
-        T{ ##load-immediate f V int-rep 2 2 }
-        T{ ##compare-branch f V int-rep 2 V int-rep 1 cc< }
+        T{ ##load-immediate f 1 1 }
+        T{ ##load-immediate f 2 2 }
+        T{ ##compare-branch f 2 1 cc< }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
+        T{ ##peek f 0 D 0 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 0 cc< }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare-branch f 0 0 cc< }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
+        T{ ##peek f 0 D 0 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 0 cc<= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare-branch f 0 0 cc<= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
+        T{ ##peek f 0 D 0 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 0 cc> }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare-branch f 0 0 cc> }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
+        T{ ##peek f 0 D 0 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 0 cc>= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare-branch f 0 0 cc>= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
+        T{ ##peek f 0 D 0 }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 0 cc= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare-branch f 0 0 cc= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
+        T{ ##peek f 0 D 0 }
         T{ ##branch }
     }
     1
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare-branch f V int-rep 0 V int-rep 0 cc/= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare-branch f 0 0 cc/= }
     } test-branch-folding
 ] unit-test
 
 [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##load-reference f V int-rep 1 t }
+        T{ ##peek f 0 D 0 }
+        T{ ##load-reference f 1 t }
         T{ ##branch }
     }
     0
 ] [
     {
-        T{ ##peek f V int-rep 0 D 0 }
-        T{ ##compare f V int-rep 1 V int-rep 0 V int-rep 0 cc<= }
-        T{ ##compare-imm-branch f V int-rep 1 5 cc/= }
+        T{ ##peek f 0 D 0 }
+        T{ ##compare f 1 0 0 cc<= }
+        T{ ##compare-imm-branch f 1 5 cc/= }
     } test-branch-folding
 ] unit-test
 
@@ -1160,32 +1161,34 @@ cell 8 = [
 V{ T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
-    T{ ##compare-branch f V int-rep 0 V int-rep 0 cc< }
+    T{ ##peek f 0 D 0 }
+    T{ ##compare-branch f 0 0 cc< }
 } 1 test-bb
 
 V{
-    T{ ##load-immediate f V int-rep 1 1 }
+    T{ ##load-immediate f 1 1 }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##load-immediate f V int-rep 2 2 }
+    T{ ##load-immediate f 2 2 }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##phi f V int-rep 3 H{ { 2 V int-rep 1 } { 3 V int-rep 2 } } }
-    T{ ##replace f V int-rep 3 D 0 }
+    T{ ##phi f 3 H{ { 2 1 } { 3 2 } } }
+    T{ ##replace f 3 D 0 }
     T{ ##return }
 } 4 test-bb
 
 test-diamond
 
 [ ] [
-    cfg new 0 get >>entry
+    cfg new 0 get >>entry dup cfg set
     value-numbering
     compute-predecessors
+    detect-loops
+    select-representations
     destruct-ssa drop
 ] unit-test
 
@@ -1196,32 +1199,32 @@ test-diamond
 [ 2 ] [ 4 get instructions>> length ] unit-test
 
 V{
-    T{ ##peek f V int-rep 0 D 0 }
+    T{ ##peek f 0 D 0 }
     T{ ##branch }
 } 0 test-bb
 
 V{
-    T{ ##peek f V int-rep 1 D 1 }
-    T{ ##compare-branch f V int-rep 1 V int-rep 1 cc< }
+    T{ ##peek f 1 D 1 }
+    T{ ##compare-branch f 1 1 cc< }
 } 1 test-bb
 
 V{
-    T{ ##copy f V int-rep 2 V int-rep 0 int-rep }
+    T{ ##copy f 2 0 any-rep }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##phi f V int-rep 3 V{ } }
+    T{ ##phi f 3 V{ } }
     T{ ##branch }
 } 3 test-bb
 
 V{
-    T{ ##replace f V int-rep 3 D 0 }
+    T{ ##replace f 3 D 0 }
     T{ ##return }
 } 4 test-bb
 
-1 get V int-rep 1 2array
-2 get V int-rep 0 2array 2array 3 get instructions>> first (>>inputs)
+1 get 1 2array
+2 get 0 2array 2array 3 get instructions>> first (>>inputs)
 
 test-diamond
 
@@ -1241,52 +1244,52 @@ test-diamond
 V{ T{ ##prologue } T{ ##branch } } 0 test-bb
 
 V{
-    T{ ##peek { dst V int-rep 15 } { loc D 0 } }
-    T{ ##copy { dst V int-rep 16 } { src V int-rep 15 } { rep int-rep } }
-    T{ ##copy { dst V int-rep 17 } { src V int-rep 15 } { rep int-rep } }
-    T{ ##copy { dst V int-rep 18 } { src V int-rep 15 } { rep int-rep } }
-    T{ ##copy { dst V int-rep 19 } { src V int-rep 15 } { rep int-rep } }
+    T{ ##peek { dst 15 } { loc D 0 } }
+    T{ ##copy { dst 16 } { src 15 } { rep any-rep } }
+    T{ ##copy { dst 17 } { src 15 } { rep any-rep } }
+    T{ ##copy { dst 18 } { src 15 } { rep any-rep } }
+    T{ ##copy { dst 19 } { src 15 } { rep any-rep } }
     T{ ##compare
-        { dst V int-rep 20 }
-        { src1 V int-rep 18 }
-        { src2 V int-rep 19 }
+        { dst 20 }
+        { src1 18 }
+        { src2 19 }
         { cc cc= }
-        { temp V int-rep 22 }
+        { temp 22 }
     }
-    T{ ##copy { dst V int-rep 21 } { src V int-rep 20 } { rep int-rep } }
+    T{ ##copy { dst 21 } { src 20 } { rep any-rep } }
     T{ ##compare-imm-branch
-        { src1 V int-rep 21 }
+        { src1 21 }
         { src2 5 }
         { cc cc/= }
     }
 } 1 test-bb
 
 V{
-    T{ ##copy { dst V int-rep 23 } { src V int-rep 15 } { rep int-rep } }
-    T{ ##copy { dst V int-rep 24 } { src V int-rep 15 } { rep int-rep } }
-    T{ ##load-reference { dst V int-rep 25 } { obj t } }
+    T{ ##copy { dst 23 } { src 15 } { rep any-rep } }
+    T{ ##copy { dst 24 } { src 15 } { rep any-rep } }
+    T{ ##load-reference { dst 25 } { obj t } }
     T{ ##branch }
 } 2 test-bb
 
 V{
-    T{ ##replace { src V int-rep 25 } { loc D 0 } }
+    T{ ##replace { src 25 } { loc D 0 } }
     T{ ##epilogue }
     T{ ##return }
 } 3 test-bb
 
 V{
-    T{ ##copy { dst V int-rep 26 } { src V int-rep 15 } { rep int-rep } }
-    T{ ##copy { dst V int-rep 27 } { src V int-rep 15 } { rep int-rep } }
+    T{ ##copy { dst 26 } { src 15 } { rep any-rep } }
+    T{ ##copy { dst 27 } { src 15 } { rep any-rep } }
     T{ ##add
-        { dst V int-rep 28 }
-        { src1 V int-rep 26 }
-        { src2 V int-rep 27 }
+        { dst 28 }
+        { src1 26 }
+        { src2 27 }
     }
     T{ ##branch }
 } 4 test-bb
 
 V{
-    T{ ##replace { src V int-rep 28 } { loc D 0 } }
+    T{ ##replace { src 28 } { loc D 0 } }
     T{ ##epilogue }
     T{ ##return }
 } 5 test-bb
index 9b97bb9e50491b73ae5f942c2e92554c4031cbf9..914970f3ada2aea7698ed5db34af42c912d6ca31 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: namespaces assocs kernel accessors
 sorting sets sequences
+cpu.architecture
 compiler.cfg
 compiler.cfg.rpo
 compiler.cfg.instructions
@@ -14,7 +15,7 @@ IN: compiler.cfg.value-numbering
 ! Local value numbering. Predecessors must be recomputed after this
 : >copy ( insn -- insn/##copy )
     dup dst>> dup vreg>vn vn>vreg
-    2dup eq? [ 2drop ] [ dup rep>> \ ##copy new-insn nip ] if ;
+    2dup eq? [ 2drop ] [ any-rep \ ##copy new-insn nip ] if ;
 
 : rewrite-loop ( insn -- insn' )
     dup rewrite [ rewrite-loop ] [ ] ?if ;
index 14197bc3f74830f5cd3f26911d822fe557262f1b..c09f404d4c17db8831550cf700de9dda9642e8c7 100644 (file)
@@ -9,64 +9,64 @@ IN: compiler.cfg.write-barrier.tests
 
 [
     V{
-        T{ ##peek f V int-regs 4 D 0 f }
-        T{ ##allot f V int-regs 7 24 array V int-regs 8 f }
-        T{ ##load-immediate f V int-regs 9 8 f }
-        T{ ##set-slot-imm f V int-regs 9 V int-regs 7 1 3 f }
-        T{ ##set-slot-imm f V int-regs 4 V int-regs 7 2 3 f }
-        T{ ##replace f V int-regs 7 D 0 f }
+        T{ ##peek f 4 D 0 f }
+        T{ ##allot f 7 24 array 8 f }
+        T{ ##load-immediate f 9 8 f }
+        T{ ##set-slot-imm f 9 7 1 3 f }
+        T{ ##set-slot-imm f 4 7 2 3 f }
+        T{ ##replace f 7 D 0 f }
         T{ ##branch }
     }
 ] [
     {
-        T{ ##peek f V int-regs 4 D 0 }
-        T{ ##allot f V int-regs 7 24 array V int-regs 8 }
-        T{ ##load-immediate f V int-regs 9 8 }
-        T{ ##set-slot-imm f V int-regs 9 V int-regs 7 1 3 }
-        T{ ##write-barrier f V int-regs 7 V int-regs 10 V int-regs 11 }
-        T{ ##set-slot-imm f V int-regs 4 V int-regs 7 2 3 }
-        T{ ##write-barrier f V int-regs 7 V int-regs 12 V int-regs 13 }
-        T{ ##replace f V int-regs 7 D 0 }
+        T{ ##peek f 4 D 0 }
+        T{ ##allot f 7 24 array 8 }
+        T{ ##load-immediate f 9 8 }
+        T{ ##set-slot-imm f 9 7 1 3 }
+        T{ ##write-barrier f 7 10 11 }
+        T{ ##set-slot-imm f 4 7 2 3 }
+        T{ ##write-barrier f 7 12 13 }
+        T{ ##replace f 7 D 0 }
     } test-write-barrier
 ] unit-test
 
 [
     V{
-        T{ ##load-immediate f V int-regs 4 24 }
-        T{ ##peek f V int-regs 5 D -1 }
-        T{ ##peek f V int-regs 6 D -2 }
-        T{ ##set-slot-imm f V int-regs 5 V int-regs 6 3 2 }
-        T{ ##write-barrier f V int-regs 6 V int-regs 7 V int-regs 8 }
+        T{ ##load-immediate f 4 24 }
+        T{ ##peek f 5 D -1 }
+        T{ ##peek f 6 D -2 }
+        T{ ##set-slot-imm f 5 6 3 2 }
+        T{ ##write-barrier f 6 7 8 }
         T{ ##branch }
     }
 ] [
     {
-        T{ ##load-immediate f V int-regs 4 24 }
-        T{ ##peek f V int-regs 5 D -1 }
-        T{ ##peek f V int-regs 6 D -2 }
-        T{ ##set-slot-imm f V int-regs 5 V int-regs 6 3 2 }
-        T{ ##write-barrier f V int-regs 6 V int-regs 7 V int-regs 8 }
+        T{ ##load-immediate f 4 24 }
+        T{ ##peek f 5 D -1 }
+        T{ ##peek f 6 D -2 }
+        T{ ##set-slot-imm f 5 6 3 2 }
+        T{ ##write-barrier f 6 7 8 }
     } test-write-barrier
 ] unit-test
 
 [
     V{
-        T{ ##peek f V int-regs 19 D -3 }
-        T{ ##peek f V int-regs 22 D -2 }
-        T{ ##set-slot-imm f V int-regs 22 V int-regs 19 3 2 }
-        T{ ##write-barrier f V int-regs 19 V int-regs 24 V int-regs 25 }
-        T{ ##peek f V int-regs 28 D -1 }
-        T{ ##set-slot-imm f V int-regs 28 V int-regs 19 4 2 }
+        T{ ##peek f 19 D -3 }
+        T{ ##peek f 22 D -2 }
+        T{ ##set-slot-imm f 22 19 3 2 }
+        T{ ##write-barrier f 19 24 25 }
+        T{ ##peek f 28 D -1 }
+        T{ ##set-slot-imm f 28 19 4 2 }
         T{ ##branch }
     }
 ] [
     {
-        T{ ##peek f V int-regs 19 D -3 }
-        T{ ##peek f V int-regs 22 D -2 }
-        T{ ##set-slot-imm f V int-regs 22 V int-regs 19 3 2 }
-        T{ ##write-barrier f V int-regs 19 V int-regs 24 V int-regs 25 }
-        T{ ##peek f V int-regs 28 D -1 }
-        T{ ##set-slot-imm f V int-regs 28 V int-regs 19 4 2 }
-        T{ ##write-barrier f V int-regs 19 V int-regs 30 V int-regs 3 }
+        T{ ##peek f 19 D -3 }
+        T{ ##peek f 22 D -2 }
+        T{ ##set-slot-imm f 22 19 3 2 }
+        T{ ##write-barrier f 19 24 25 }
+        T{ ##peek f 28 D -1 }
+        T{ ##set-slot-imm f 28 19 4 2 }
+        T{ ##write-barrier f 19 30 3 }
     } test-write-barrier
 ] unit-test
index fc5b74c2fdccee9486eaba43de7c6c28b9bda8c1..9d71c237e7d5f4e10d411cb7db97b48cdf059e65 100644 (file)
@@ -12,15 +12,15 @@ IN: compiler.tests.low-level-ir
     [ associate >alist modify-code-heap ] keep ;
 
 : compile-test-cfg ( -- word )
-    cfg new
-    0 get >>entry
+    cfg new 0 get >>entry
+    dup fake-representations representations get >>reps
     compile-cfg ;
 
 : compile-test-bb ( insns -- result )
     V{ T{ ##prologue } T{ ##branch } } 0 test-bb
     V{
         T{ ##inc-d f 1 }
-        T{ ##replace f V int-rep 0 D 0 }
+        T{ ##replace f 0 D 0 }
         T{ ##branch }
     } [ clone ] map append 1 test-bb
     V{
@@ -35,13 +35,13 @@ IN: compiler.tests.low-level-ir
 ! loading immediates
 [ f ] [
     V{
-        T{ ##load-immediate f V int-rep 0 5 }
+        T{ ##load-immediate f 0 5 }
     } compile-test-bb
 ] unit-test
 
 [ "hello" ] [
     V{
-        T{ ##load-reference f V int-rep 0 "hello" }
+        T{ ##load-reference f 0 "hello" }
     } compile-test-bb
 ] unit-test
 
@@ -49,72 +49,72 @@ IN: compiler.tests.low-level-ir
 ! one of the sources
 [ t ] [
     V{
-        T{ ##load-immediate f V int-rep 1 $[ 2 cell log2 shift ] }
-        T{ ##load-reference f V int-rep 0 { t f t } }
-        T{ ##slot f V int-rep 0 V int-rep 0 V int-rep 1 $[ array tag-number ] V int-rep 2 }
+        T{ ##load-immediate f 1 $[ 2 cell log2 shift ] }
+        T{ ##load-reference f 0 { t f t } }
+        T{ ##slot f 0 0 1 $[ array tag-number ] 2 }
     } compile-test-bb
 ] unit-test
 
 [ t ] [
     V{
-        T{ ##load-reference f V int-rep 0 { t f t } }
-        T{ ##slot-imm f V int-rep 0 V int-rep 0 2 $[ array tag-number ] V int-rep 2 }
+        T{ ##load-reference f 0 { t f t } }
+        T{ ##slot-imm f 0 0 2 $[ array tag-number ] 2 }
     } compile-test-bb
 ] unit-test
 
 [ t ] [
     V{
-        T{ ##load-immediate f V int-rep 1 $[ 2 cell log2 shift ] }
-        T{ ##load-reference f V int-rep 0 { t f t } }
-        T{ ##set-slot f V int-rep 0 V int-rep 0 V int-rep 1 $[ array tag-number ] V int-rep 2 }
+        T{ ##load-immediate f 1 $[ 2 cell log2 shift ] }
+        T{ ##load-reference f 0 { t f t } }
+        T{ ##set-slot f 0 0 1 $[ array tag-number ] 2 }
     } compile-test-bb
     dup first eq?
 ] unit-test
 
 [ t ] [
     V{
-        T{ ##load-reference f V int-rep 0 { t f t } }
-        T{ ##set-slot-imm f V int-rep 0 V int-rep 0 2 $[ array tag-number ] }
+        T{ ##load-reference f 0 { t f t } }
+        T{ ##set-slot-imm f 0 0 2 $[ array tag-number ] }
     } compile-test-bb
     dup first eq?
 ] unit-test
 
 [ 8 ] [
     V{
-        T{ ##load-immediate f V int-rep 0 4 }
-        T{ ##shl f V int-rep 0 V int-rep 0 V int-rep 0 }
+        T{ ##load-immediate f 0 4 }
+        T{ ##shl f 0 0 0 }
     } compile-test-bb
 ] unit-test
 
 [ 4 ] [
     V{
-        T{ ##load-immediate f V int-rep 0 4 }
-        T{ ##shl-imm f V int-rep 0 V int-rep 0 3 }
+        T{ ##load-immediate f 0 4 }
+        T{ ##shl-imm f 0 0 3 }
     } compile-test-bb
 ] unit-test
 
 [ 31 ] [
     V{
-        T{ ##load-reference f V int-rep 1 B{ 31 67 52 } }
-        T{ ##unbox-any-c-ptr f V int-rep 0 V int-rep 1 V int-rep 2 }
-        T{ ##alien-unsigned-1 f V int-rep 0 V int-rep 0 }
-        T{ ##shl-imm f V int-rep 0 V int-rep 0 3 }
+        T{ ##load-reference f 1 B{ 31 67 52 } }
+        T{ ##unbox-any-c-ptr f 0 1 2 }
+        T{ ##alien-unsigned-1 f 0 0 }
+        T{ ##shl-imm f 0 0 3 }
     } compile-test-bb
 ] unit-test
 
 [ CHAR: l ] [
     V{
-        T{ ##load-reference f V int-rep 0 "hello world" }
-        T{ ##load-immediate f V int-rep 1 3 }
-        T{ ##string-nth f V int-rep 0 V int-rep 0 V int-rep 1 V int-rep 2 }
-        T{ ##shl-imm f V int-rep 0 V int-rep 0 3 }
+        T{ ##load-reference f 0 "hello world" }
+        T{ ##load-immediate f 1 3 }
+        T{ ##string-nth f 0 0 1 2 }
+        T{ ##shl-imm f 0 0 3 }
     } compile-test-bb
 ] unit-test
 
 [ 1 ] [
     V{
-        T{ ##load-immediate f V int-rep 0 16 }
-        T{ ##add-imm f V int-rep 0 V int-rep 0 -8 }
+        T{ ##load-immediate f 0 16 }
+        T{ ##add-imm f 0 0 -8 }
     } compile-test-bb
 ] unit-test
 
@@ -125,15 +125,15 @@ USE: multiline
 
 [ 100 ] [
     V{
-        T{ ##load-immediate f V int-rep 0 100 }
-        T{ ##integer>bignum f V int-rep 0 V int-rep 0 V int-rep 1 }
+        T{ ##load-immediate f 0 100 }
+        T{ ##integer>bignum f 0 0 1 }
     } compile-test-bb
 ] unit-test
 
 [ 1 ] [
     V{
-        T{ ##load-reference f V int-rep 0 ALIEN: 8 }
-        T{ ##unbox-any-c-ptr f V int-rep 0 V int-rep 0 V int-rep 1 }
+        T{ ##load-reference f 0 ALIEN: 8 }
+        T{ ##unbox-any-c-ptr f 0 0 1 }
     } compile-test-bb
 ] unit-test
 
index 62d56faa191b8c167209c7f2fc341961e9b63523..7bb9caec9b10b9c9843860ab242dc81a0873deeb 100644 (file)
@@ -7,14 +7,20 @@ IN: cpu.architecture
 
 ! Representations -- these are like low-level types
 
-! Integer registers can contain data with one of these two representations
+! Unknown representation; this is used for ##copy instructions which
+! get eliminated later
+SINGLETON: any-rep
+
+! Integer registers can contain data with one of these three representations
+! tagged-rep: tagged pointer or fixnum
+! int-rep: untagged fixnum, not a pointer
 SINGLETONS: tagged-rep int-rep ;
 
 ! Floating point registers can contain data with
 ! one of these representations
 SINGLETONS: single-float-rep double-float-rep ;
 
-UNION: representation tagged-rep int-rep single-float-rep double-float-rep ;
+UNION: representation any-rep tagged-rep int-rep single-float-rep double-float-rep ;
 
 ! Register classes
 SINGLETONS: int-regs float-regs ;