Rename a few symbols for consistency

slava 2006-10-28 06:43:33 +00:00
parent fe1420ae9e
commit cd1ee7daf7
5 changed files with 119 additions and 119 deletions

View File

@ -94,7 +94,7 @@ M: #if generate-node
end-basic-block
<label> dup %jump-t
] H{
{ +input { { f "flag" } } }
{ +input+ { { f "flag" } } }
} with-template generate-if ;
! #call
@ -141,8 +141,8 @@ M: #call-label generate-node
#! Output the jump table insn and return a list of
#! label/branch pairs.
[ end-basic-block %dispatch ] H{
{ +input { { f "n" } } }
{ +scratch { { f "scratch" } } }
{ +input+ { { f "n" } } }
{ +scratch+ { { f "scratch" } } }
} with-template
node-children [ <label> dup %target 2array ] map ;

View File

@ -206,21 +206,21 @@ SYMBOL: phantom-r
: phantom-append ( seq stack -- )
over length over adjust-phantom swap nappend ;
SYMBOL: +input
SYMBOL: +output
SYMBOL: +scratch
SYMBOL: +clobber
SYMBOL: +input+
SYMBOL: +output+
SYMBOL: +scratch+
SYMBOL: +clobber+
: fix-spec ( spec -- spec )
H{
{ +input { } }
{ +output { } }
{ +scratch { } }
{ +clobber { } }
{ +input+ { } }
{ +output+ { } }
{ +scratch+ { } }
{ +clobber+ { } }
} swap hash-union ;
: output-vregs ( -- seq seq )
+output +clobber [ get [ get ] map ] 2apply ;
+output+ +clobber+ [ get [ get ] map ] 2apply ;
: outputs-clash? ( -- ? )
output-vregs append phantoms append
@ -241,8 +241,8 @@ SYMBOL: +clobber
[ second reg-spec>class eq? ] contains-with? ;
: requests-class? ( class -- ? )
dup +input get (requests-class?) swap
+scratch get (requests-class?) or ;
dup +input+ get (requests-class?) swap
+scratch+ get (requests-class?) or ;
: ?fp-scratch ( -- n )
T{ float-regs f 8 } requests-class? 1 0 ? ;
@ -253,11 +253,11 @@ SYMBOL: +clobber
] unless* ;
: guess-vregs ( -- int# float# )
+input get { } additional-vregs ?fp-scratch +
+scratch get 0 <column> requested-vregs >r + r> ;
+input+ get { } additional-vregs ?fp-scratch +
+scratch+ get 0 <column> requested-vregs >r + r> ;
: alloc-scratch ( -- )
+scratch get [ first2 >r spec>vreg r> set ] each ;
+scratch+ get [ first2 >r spec>vreg r> set ] each ;
: template-inputs ( -- )
! Ensure we have enough to hold any new stack elements we
@ -265,12 +265,12 @@ SYMBOL: +clobber
guess-vregs ensure-vregs
! Split the template into available (fast) parts and those
! that require allocating registers and reading the stack
+input get match-template fast-input slow-input
+input+ get match-template fast-input slow-input
! Finally allocate scratch registers
alloc-scratch ;
: template-outputs ( -- )
+output get [ get ] map phantom-d get phantom-append ;
+output+ get [ get ] map phantom-d get phantom-append ;
: with-template ( quot spec -- )
fix-spec [ template-inputs call template-outputs ] bind

View File

@ -44,8 +44,8 @@ M: float-regs (%replace)
! Floats
: define-float-op ( word op -- )
[ [ "x" operand "y" operand ] % , ] [ ] make H{
{ +input { { float "x" } { float "y" } } }
{ +output { "x" } }
{ +input+ { { float "x" } { float "y" } } }
{ +output+ { "x" } }
} define-intrinsic ;
{
@ -61,7 +61,7 @@ M: float-regs (%replace)
[
[ end-basic-block "x" operand "y" operand UCOMISD ] % ,
] [ ] make H{
{ +input { { float "x" } { float "y" } } }
{ +input+ { { float "x" } { float "y" } } }
} define-if-intrinsic ;
{

View File

@ -23,16 +23,16 @@ math-internals namespaces sequences words ;
"obj" operand dup untag
cell log2 [ 0 LWZ ] generate-slot
] H{
{ +input { { f "obj" } { f "n" } } }
{ +output { "obj" } }
{ +input+ { { f "obj" } { f "n" } } }
{ +output+ { "obj" } }
} define-intrinsic
\ char-slot [
1 [ string-offset LHZ ] generate-slot
"obj" operand dup tag-fixnum
] H{
{ +input { { f "n" } { f "obj" } } }
{ +output { "obj" } }
{ +input+ { { f "n" } { f "obj" } } }
{ +output+ { "obj" } }
} define-intrinsic
: generate-set-slot ( size quot -- )
@ -56,9 +56,9 @@ math-internals namespaces sequences words ;
"obj" operand dup untag
cell log2 [ 0 STW ] generate-set-slot generate-write-barrier
] H{
{ +input { { f "val" } { f "obj" } { f "slot" } } }
{ +scratch { { f "x" } } }
{ +clobber { "obj" "slot" } }
{ +input+ { { f "val" } { f "obj" } { f "slot" } } }
{ +scratch+ { { f "x" } } }
{ +clobber+ { "obj" "slot" } }
} define-intrinsic
\ set-char-slot [
@ -66,15 +66,15 @@ math-internals namespaces sequences words ;
"val" operand dup untag-fixnum
1 [ string-offset STH ] generate-set-slot
] H{
{ +input { { f "val" } { f "slot" } { f "obj" } } }
{ +scratch { { f "x" } } }
{ +clobber { "val" "slot" "obj" } }
{ +input+ { { f "val" } { f "slot" } { f "obj" } } }
{ +scratch+ { { f "x" } } }
{ +clobber+ { "val" "slot" "obj" } }
} define-intrinsic
: define-fixnum-op ( word op -- )
[ [ "x" operand "y" operand "x" operand ] % , ] [ ] make H{
{ +input { { f "x" } { f "y" } } }
{ +output { "x" } }
{ +input+ { { f "x" } { f "y" } } }
{ +output+ { "x" } }
} define-intrinsic ;
{
@ -98,23 +98,23 @@ math-internals namespaces sequences words ;
"r" operand "x" operand "y" operand DIVW
generate-fixnum-mod
] H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } }
{ +output { "s" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "r" } { f "s" } } }
{ +output+ { "s" } }
} define-intrinsic
\ fixnum-bitnot [
"x" operand dup NOT
"x" operand dup untag
] H{
{ +input { { f "x" } } }
{ +output { "x" } }
{ +input+ { { f "x" } } }
{ +output+ { "x" } }
} define-intrinsic
: define-fixnum-jump ( word op -- )
[
[ end-basic-block "x" operand 0 "y" operand CMP ] % ,
] [ ] make H{ { +input { { f "x" } { f "y" } } } }
] [ ] make H{ { +input+ { { f "x" } { f "y" } } } }
define-if-intrinsic ;
{
@ -144,10 +144,10 @@ math-internals namespaces sequences words ;
"r" operand "y" operand "x" operand ADDO.
\ ADD simple-overflow
] H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "r" } } }
{ +output { "r" } }
{ +clobber { "x" "y" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "r" } } }
{ +output+ { "r" } }
{ +clobber+ { "x" "y" } }
} define-intrinsic
\ fixnum- [
@ -156,10 +156,10 @@ math-internals namespaces sequences words ;
"r" operand "y" operand "x" operand SUBFO.
\ SUBF simple-overflow
] H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "r" } } }
{ +output { "r" } }
{ +clobber { "x" "y" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "r" } } }
{ +output+ { "r" } }
{ +clobber+ { "x" "y" } }
} define-intrinsic
\ fixnum* [
@ -181,10 +181,10 @@ math-internals namespaces sequences words ;
"end" get resolve-label
"s" operand 12 MR
] H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } }
{ +output { "s" } }
{ +clobber { "x" "y" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "r" } { f "s" } } }
{ +output+ { "s" } }
{ +clobber+ { "x" "y" } }
} define-intrinsic
: generate-fixnum/i
@ -213,10 +213,10 @@ math-internals namespaces sequences words ;
"r" operand "x" operand tag-fixnum
"end" get resolve-label
] H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } }
{ +output { "x" } }
{ +clobber { "y" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "r" } { f "s" } } }
{ +output+ { "x" } }
{ +clobber+ { "y" } }
} define-intrinsic
\ fixnum/mod [
@ -229,16 +229,16 @@ math-internals namespaces sequences words ;
"r" operand "x" operand tag-fixnum
"end" get resolve-label
] H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } }
{ +output { "x" "s" } }
{ +clobber { "y" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "r" } { f "s" } } }
{ +output+ { "x" "s" } }
{ +clobber+ { "y" } }
} define-intrinsic
: define-float-op ( word op -- )
[ [ "x" operand "x" operand "y" operand ] % , ] [ ] make H{
{ +input { { float "x" } { float "y" } } }
{ +output { "x" } }
{ +input+ { { float "x" } { float "y" } } }
{ +output+ { "x" } }
} define-intrinsic ;
{
@ -253,7 +253,7 @@ math-internals namespaces sequences words ;
: define-float-jump ( word op -- )
[
[ end-basic-block "x" operand 0 "y" operand FCMPU ] % ,
] [ ] make H{ { +input { { float "x" } { float "y" } } } }
] [ ] make H{ { +input+ { { float "x" } { float "y" } } } }
define-if-intrinsic ;
{
@ -270,9 +270,9 @@ math-internals namespaces sequences words ;
"in" operand "out" operand tag-mask ANDI
"out" operand dup tag-fixnum
] H{
{ +input { { f "in" } } }
{ +scratch { { f "out" } } }
{ +output { "out" } }
{ +input+ { { f "in" } } }
{ +scratch+ { { f "out" } } }
{ +output+ { "out" } }
} define-intrinsic
\ type [
@ -299,9 +299,9 @@ math-internals namespaces sequences words ;
f type tag-bits shift "x" operand LI
"end" get resolve-label
] H{
{ +input { { f "obj" } } }
{ +scratch { { f "x" } { f "y" } } }
{ +output { "x" } }
{ +input+ { { f "obj" } } }
{ +scratch+ { { f "x" } { f "y" } } }
{ +output+ { "x" } }
} define-intrinsic
: userenv ( reg -- )
@ -314,10 +314,10 @@ math-internals namespaces sequences words ;
"x" operand "n" operand "x" operand ADD
"x" operand dup 0 LWZ
] H{
{ +input { { f "n" } } }
{ +scratch { { f "x" } } }
{ +output { "x" } }
{ +clobber { "n" } }
{ +input+ { { f "n" } } }
{ +scratch+ { { f "x" } } }
{ +output+ { "x" } }
{ +clobber+ { "n" } }
} define-intrinsic
\ setenv [
@ -326,7 +326,7 @@ math-internals namespaces sequences words ;
"x" operand "n" operand "x" operand ADD
"val" operand "x" operand 0 STW
] H{
{ +input { { f "val" } { f "n" } } }
{ +scratch { { f "x" } } }
{ +clobber { "n" } }
{ +input+ { { f "val" } { f "n" } } }
{ +scratch+ { { f "x" } } }
{ +clobber+ { "n" } }
} define-intrinsic

View File

@ -9,8 +9,8 @@ IN: compiler
"in" operand tag-mask AND
"in" operand tag-bits SHL
] H{
{ +input { { f "in" } } }
{ +output { "in" } }
{ +input+ { { f "in" } } }
{ +output+ { "in" } }
} define-intrinsic
\ type [
@ -44,9 +44,9 @@ IN: compiler
"obj" operand f type tag-bits shift MOV
"end" get resolve-label
] H{
{ +input { { f "obj" } } }
{ +scratch { { f "x" } { f "y" } } }
{ +output { "obj" } }
{ +input+ { { f "obj" } } }
{ +scratch+ { { f "x" } { f "y" } } }
{ +output+ { "obj" } }
} define-intrinsic
! Slots
@ -61,9 +61,9 @@ IN: compiler
! load slot value
"obj" operand dup [] MOV
] H{
{ +input { { f "obj" } { f "n" } } }
{ +output { "obj" } }
{ +clobber { "n" } }
{ +input+ { { f "obj" } { f "n" } } }
{ +output+ { "obj" } }
{ +clobber+ { "n" } }
} define-intrinsic
: card-offset 1 getenv ; inline
@ -84,8 +84,8 @@ IN: compiler
"slot" operand [] "val" operand MOV
generate-write-barrier
] H{
{ +input { { f "val" } { f "obj" } { f "slot" } } }
{ +clobber { "obj" "slot" } }
{ +input+ { { f "val" } { f "obj" } { f "slot" } } }
{ +clobber+ { "obj" "slot" } }
} define-intrinsic
: char-reg cell 8 = RBX EBX ? ; inline
@ -101,9 +101,9 @@ IN: compiler
"obj" operand char-reg MOV
char-reg POP
] H{
{ +input { { f "n" } { f "obj" } } }
{ +output { "obj" } }
{ +clobber { "n" } }
{ +input+ { { f "n" } { f "obj" } } }
{ +output+ { "obj" } }
{ +clobber+ { "n" } }
} define-intrinsic
\ set-char-slot [
@ -115,15 +115,15 @@ IN: compiler
"obj" operand string-offset [+] char-reg-16 MOV
char-reg POP
] H{
{ +input { { f "val" } { f "slot" } { f "obj" } } }
{ +clobber { "val" "slot" "obj" } }
{ +input+ { { f "val" } { f "slot" } { f "obj" } } }
{ +clobber+ { "val" "slot" "obj" } }
} define-intrinsic
! Fixnums
: define-fixnum-op ( word op -- )
[ [ "x" operand "y" operand ] % , ] [ ] make H{
{ +input { { f "x" } { f "y" } } }
{ +output { "x" } }
{ +input+ { { f "x" } { f "y" } } }
{ +output+ { "x" } }
} define-intrinsic ;
{
@ -140,8 +140,8 @@ IN: compiler
"x" operand NOT
"x" operand tag-mask XOR
] H{
{ +input { { f "x" } } }
{ +output { "x" } }
{ +input+ { { f "x" } } }
{ +output+ { "x" } }
} define-intrinsic
! This has specific register requirements. Inputs are in
@ -150,9 +150,9 @@ IN: compiler
prepare-division
"y" operand IDIV
] H{
{ +input { { 0 "x" } { 1 "y" } } }
{ +scratch { { 2 "out" } } }
{ +output { "out" } }
{ +input+ { { 0 "x" } { 1 "y" } } }
{ +scratch+ { { 2 "out" } } }
{ +output+ { "out" } }
} define-intrinsic
: ?MOV ( dst src -- ) 2dup = [ 2drop ] [ MOV ] if ;
@ -179,10 +179,10 @@ IN: compiler
: simple-overflow-template ( word insn -- )
[ simple-overflow ] curry H{
{ +input { { f "x" } { f "y" } } }
{ +scratch { { f "z" } } }
{ +output { "z" } }
{ +clobber { "x" "y" } }
{ +input+ { { f "x" } { f "y" } } }
{ +scratch+ { { f "z" } } }
{ +output+ { "z" } }
{ +clobber+ { "x" "y" } }
} define-intrinsic ;
\ fixnum+ \ ADD simple-overflow-template
@ -204,8 +204,8 @@ IN: compiler
T{ int-regs } return-reg bignum-tag OR
"end" get resolve-label
] H{
{ +input { { 0 "x" } { 1 "y" } } }
{ +output { "x" } }
{ +input+ { { 0 "x" } { 1 "y" } } }
{ +output+ { "x" } }
} define-intrinsic
: generate-fixnum/mod
@ -238,22 +238,22 @@ IN: compiler
"end" get resolve-label ;
\ fixnum/i [ generate-fixnum/mod ] H{
{ +input { { 0 "x" } { 1 "y" } } }
{ +scratch { { 2 "out" } } }
{ +output { "x" } }
{ +clobber { "x" "y" } }
{ +input+ { { 0 "x" } { 1 "y" } } }
{ +scratch+ { { 2 "out" } } }
{ +output+ { "x" } }
{ +clobber+ { "x" "y" } }
} define-intrinsic
\ fixnum/mod [ generate-fixnum/mod ] H{
{ +input { { 0 "x" } { 1 "y" } } }
{ +scratch { { 2 "out" } } }
{ +output { "x" "out" } }
{ +clobber { "x" "y" } }
{ +input+ { { 0 "x" } { 1 "y" } } }
{ +scratch+ { { 2 "out" } } }
{ +output+ { "x" "out" } }
{ +clobber+ { "x" "y" } }
} define-intrinsic
: define-fixnum-jump ( word op -- )
[ end-basic-block "x" operand "y" operand CMP ] swap add
H{ { +input { { f "x" } { f "y" } } } } define-if-intrinsic ;
H{ { +input+ { { f "x" } { f "y" } } } } define-if-intrinsic ;
{
{ fixnum< JL }
@ -275,15 +275,15 @@ IN: compiler
\ getenv [
%userenv "n" operand dup [] MOV
] H{
{ +input { { f "n" } } }
{ +scratch { { f "x" } } }
{ +output { "n" } }
{ +input+ { { f "n" } } }
{ +scratch+ { { f "x" } } }
{ +output+ { "n" } }
} define-intrinsic
\ setenv [
%userenv "n" operand [] "val" operand MOV
] H{
{ +input { { f "val" } { f "n" } } }
{ +scratch { { f "x" } } }
{ +clobber { "n" } }
{ +input+ { { f "val" } { f "n" } } }
{ +scratch+ { { f "x" } } }
{ +clobber+ { "n" } }
} define-intrinsic