compiler.cfg: remove 'regs' slot from instruction tuples now that register allocation doesn't use it anymore

db4
Slava Pestov 2009-07-29 06:50:46 -05:00
parent 639a1cbb1f
commit cb7735ddf4
3 changed files with 20 additions and 25 deletions

View File

@ -6,7 +6,7 @@ compiler.constants combinators compiler.cfg.registers
compiler.cfg.instructions.syntax ; compiler.cfg.instructions.syntax ;
IN: compiler.cfg.instructions 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 ! Virtual CPU instructions, used by CFG and machine IRs
TUPLE: insn ; TUPLE: insn ;

View File

@ -11,12 +11,12 @@ IN: compiler.cfg.instructions.syntax
"insn" "compiler.cfg.instructions" lookup ; "insn" "compiler.cfg.instructions" lookup ;
: insn-effect ( word -- effect ) : insn-effect ( word -- effect )
boa-effect in>> 2 head* f <effect> ; boa-effect in>> but-last f <effect> ;
SYNTAX: INSN: SYNTAX: INSN:
parse-tuple-definition { "regs" "insn#" } append parse-tuple-definition "insn#" suffix
[ dup tuple eq? [ drop insn-word ] when ] dip [ dup tuple eq? [ drop insn-word ] when ] dip
[ define-tuple-class ] [ define-tuple-class ]
[ 2drop save-location ] [ 2drop save-location ]
[ 2drop [ ] [ '[ f f _ boa , ] ] [ insn-effect ] tri define-inline ] [ 2drop [ ] [ '[ f _ boa , ] ] [ insn-effect ] tri define-inline ]
3tri ; 3tri ;

View File

@ -42,34 +42,31 @@ M: ##branch linearize-insn
[ drop dup successors>> second useless-branch? ] 2bi [ drop dup successors>> second useless-branch? ] 2bi
[ [ swap block-number ] 3dip ] [ [ block-number ] 3dip negate-cc ] if ; [ [ 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 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 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 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 ) : overflow-conditional ( bb insn -- bb successor label2 dst src1 src2 )
[ dup successors block-number ] [ dup successors block-number ]
[ [ dst>> ] [ src1>> ] [ src2>> ] tri ] bi* ; inline [ [ dst>> ] [ src1>> ] [ src2>> ] tri ] bi* ; inline
M: ##fixnum-add linearize-insn M: ##fixnum-add linearize-insn
[ overflow-conditional _fixnum-add ] with-regs emit-branch ; overflow-conditional _fixnum-add emit-branch ;
M: ##fixnum-sub linearize-insn M: ##fixnum-sub linearize-insn
[ overflow-conditional _fixnum-sub ] with-regs emit-branch ; overflow-conditional _fixnum-sub emit-branch ;
M: ##fixnum-mul linearize-insn M: ##fixnum-mul linearize-insn
[ overflow-conditional _fixnum-mul ] with-regs emit-branch ; overflow-conditional _fixnum-mul emit-branch ;
M: ##dispatch linearize-insn M: ##dispatch linearize-insn
swap swap
[ [ [ src>> ] [ temp>> ] bi _dispatch ] with-regs ] [ [ src>> ] [ temp>> ] bi _dispatch ]
[ successors>> [ block-number _dispatch-label ] each ] [ successors>> [ block-number _dispatch-label ] each ]
bi* ; bi* ;
@ -101,7 +98,6 @@ M: ##dispatch linearize-insn
M: ##gc linearize-insn M: ##gc linearize-insn
nip nip
[
[ temp1>> ] [ temp1>> ]
[ temp2>> ] [ temp2>> ]
[ [
@ -111,8 +107,7 @@ M: ##gc linearize-insn
[ gc-roots-size ] [ gc-roots-size ]
tri tri
] tri ] tri
_gc _gc ;
] with-regs ;
: linearize-basic-blocks ( cfg -- insns ) : linearize-basic-blocks ( cfg -- insns )
[ [