]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg: remove 'regs' slot from instruction tuples now that register allocation...
authorSlava Pestov <slava@shill.local>
Wed, 29 Jul 2009 11:50:46 +0000 (06:50 -0500)
committerSlava Pestov <slava@shill.local>
Wed, 29 Jul 2009 11:50:46 +0000 (06:50 -0500)
basis/compiler/cfg/instructions/instructions.factor
basis/compiler/cfg/instructions/syntax/syntax.factor
basis/compiler/cfg/linearization/linearization.factor

index 17c46fa0eaed21958836e80ae36375d45ad031e6..e08b3b25bb58b958a8c5bcdd6d00e680bd3fc05d 100644 (file)
@@ -6,7 +6,7 @@ compiler.constants combinators compiler.cfg.registers
 compiler.cfg.instructions.syntax ;
 IN: compiler.cfg.instructions
 
-: new-insn ( ... class -- insn ) [ f f ] dip boa ; inline
+: new-insn ( ... class -- insn ) f swap boa ; inline
 
 ! Virtual CPU instructions, used by CFG and machine IRs
 TUPLE: insn ;
index e8f8641e7dcde1fcdb2ac9e59670c1edd0bfbfef..ab1c9599e5cf90f168cadd36aab4b85b6d4bb734 100644 (file)
@@ -11,12 +11,12 @@ IN: compiler.cfg.instructions.syntax
     "insn" "compiler.cfg.instructions" lookup ;
 
 : insn-effect ( word -- effect )
-    boa-effect in>> 2 head* f <effect> ;
+    boa-effect in>> but-last f <effect> ;
 
 SYNTAX: INSN:
-    parse-tuple-definition { "regs" "insn#" } append
+    parse-tuple-definition "insn#" suffix
     [ dup tuple eq? [ drop insn-word ] when ] dip
     [ define-tuple-class ]
     [ 2drop save-location ]
-    [ 2drop [ ] [ '[ f _ boa , ] ] [ insn-effect ] tri define-inline ]
+    [ 2drop [ ] [ '[ f _ boa , ] ] [ insn-effect ] tri define-inline ]
     3tri ;
index a1d394495661bf975269e4ccd3f347b6e30c3ed7..97fb3205c2b5c3e6b36e81219d54f9fa418af2f5 100755 (executable)
@@ -42,34 +42,31 @@ M: ##branch linearize-insn
     [ drop dup successors>> second useless-branch? ] 2bi
     [ [ swap block-number ] 3dip ] [ [ block-number ] 3dip negate-cc ] if ;
 
-: with-regs ( insn quot -- )
-    over regs>> [ call ] dip building get last (>>regs) ; inline
-
 M: ##compare-branch linearize-insn
-    [ binary-conditional _compare-branch ] with-regs emit-branch ;
+    binary-conditional _compare-branch emit-branch ;
 
 M: ##compare-imm-branch linearize-insn
-    [ binary-conditional _compare-imm-branch ] with-regs emit-branch ;
+    binary-conditional _compare-imm-branch emit-branch ;
 
 M: ##compare-float-branch linearize-insn
-    [ binary-conditional _compare-float-branch ] with-regs emit-branch ;
+    binary-conditional _compare-float-branch emit-branch ;
 
 : overflow-conditional ( bb insn -- bb successor label2 dst src1 src2 )
     [ dup successors block-number ]
     [ [ dst>> ] [ src1>> ] [ src2>> ] tri ] bi* ; inline
 
 M: ##fixnum-add linearize-insn
-    [ overflow-conditional _fixnum-add ] with-regs emit-branch ;
+    overflow-conditional _fixnum-add emit-branch ;
 
 M: ##fixnum-sub linearize-insn
-    [ overflow-conditional _fixnum-sub ] with-regs emit-branch ;
+    overflow-conditional _fixnum-sub emit-branch ;
 
 M: ##fixnum-mul linearize-insn
-    [ overflow-conditional _fixnum-mul ] with-regs emit-branch ;
+    overflow-conditional _fixnum-mul emit-branch ;
 
 M: ##dispatch linearize-insn
     swap
-    [ [ [ src>> ] [ temp>> ] bi _dispatch ] with-regs ]
+    [ [ src>> ] [ temp>> ] bi _dispatch ]
     [ successors>> [ block-number _dispatch-label ] each ]
     bi* ;
 
@@ -101,18 +98,16 @@ M: ##dispatch linearize-insn
 
 M: ##gc linearize-insn
     nip
+    [ temp1>> ]
+    [ temp2>> ]
     [
-        [ temp1>> ]
-        [ temp2>> ]
-        [
-            live-values>>
-            [ compute-gc-roots ]
-            [ count-gc-roots ]
-            [ gc-roots-size ]
-            tri
-        ] tri
-        _gc
-    ] with-regs ;
+        live-values>>
+        [ compute-gc-roots ]
+        [ count-gc-roots ]
+        [ gc-roots-size ]
+        tri
+    ] tri
+    _gc ;
 
 : linearize-basic-blocks ( cfg -- insns )
     [