RicE
parent
998637109a
commit
d11a779fdd
|
@ -32,3 +32,13 @@ M: ##alien-setter uses-vregs [ src>> ] [ value>> ] bi 2array ;
|
||||||
M: _conditional-branch uses-vregs [ src1>> ] [ src2>> ] bi 2array ;
|
M: _conditional-branch uses-vregs [ src1>> ] [ src2>> ] bi 2array ;
|
||||||
M: _compare-imm-branch uses-vregs src1>> 1array ;
|
M: _compare-imm-branch uses-vregs src1>> 1array ;
|
||||||
M: insn uses-vregs drop f ;
|
M: insn uses-vregs drop f ;
|
||||||
|
|
||||||
|
UNION: vreg-insn
|
||||||
|
##flushable
|
||||||
|
##write-barrier
|
||||||
|
##dispatch
|
||||||
|
##effect
|
||||||
|
##conditional-branch
|
||||||
|
##compare-imm-branch
|
||||||
|
_conditional-branch
|
||||||
|
_compare-imm-branch ;
|
||||||
|
|
|
@ -59,13 +59,17 @@ SYMBOL: unhandled-intervals
|
||||||
] [ 2drop ] if
|
] [ 2drop ] if
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: (assign-registers) ( insn -- )
|
GENERIC: (assign-registers) ( insn -- )
|
||||||
|
|
||||||
|
M: vreg-insn (assign-registers)
|
||||||
dup
|
dup
|
||||||
[ defs-vregs ] [ uses-vregs ] bi append
|
[ defs-vregs ] [ uses-vregs ] bi append
|
||||||
active-intervals get swap '[ vreg>> _ member? ] filter
|
active-intervals get swap '[ vreg>> _ member? ] filter
|
||||||
[ [ vreg>> ] [ reg>> ] bi ] { } map>assoc
|
[ [ vreg>> ] [ reg>> ] bi ] { } map>assoc
|
||||||
>>regs drop ;
|
>>regs drop ;
|
||||||
|
|
||||||
|
M: insn (assign-registers) drop ;
|
||||||
|
|
||||||
: init-assignment ( live-intervals -- )
|
: init-assignment ( live-intervals -- )
|
||||||
V{ } clone active-intervals set
|
V{ } clone active-intervals set
|
||||||
<min-heap> unhandled-intervals set
|
<min-heap> unhandled-intervals set
|
||||||
|
|
|
@ -40,7 +40,9 @@ SYMBOL: live-intervals
|
||||||
|
|
||||||
GENERIC# compute-live-intervals* 1 ( insn n -- )
|
GENERIC# compute-live-intervals* 1 ( insn n -- )
|
||||||
|
|
||||||
M: insn compute-live-intervals*
|
M: insn compute-live-intervals* 2drop ;
|
||||||
|
|
||||||
|
M: vreg-insn compute-live-intervals*
|
||||||
live-intervals get
|
live-intervals get
|
||||||
[ [ uses-vregs ] 2dip '[ _ swap _ at add-use ] each ]
|
[ [ uses-vregs ] 2dip '[ _ swap _ at add-use ] each ]
|
||||||
[ [ defs-vregs ] 2dip '[ _ swap _ new-live-interval ] each ]
|
[ [ defs-vregs ] 2dip '[ _ swap _ new-live-interval ] each ]
|
||||||
|
|
Loading…
Reference in New Issue