CPU architecture description model


The cpu.architecture vocab contains generic words and hooks that serves as an api for the compiler towards the cpu architecture.

Architecture support checks:
complex-addressing? ( -- ? )

dummy-int-params? ( -- ? )

dummy-fp-params? ( -- ? )

float-right-align-on-stack? ( -- ? )

fused-unboxing? ( -- ? )

test-instruction? ( -- ? )


Arithmetic:
%add ( dst src1 src2 -- )

%add-imm ( dst src1 src2 -- )

%sub ( dst src1 src2 -- )

%sub-imm ( dst src1 src2 -- )

%mul ( dst src1 src2 -- )

%mul-imm ( dst src1 src2 -- )

%neg ( dst src -- )


Bit twiddling:
%and ( dst src1 src2 -- )

%and-imm ( dst src1 src2 -- )

%not ( dst src -- )

%or ( dst src1 src2 -- )

%or-imm ( dst src1 src2 -- )

%sar ( dst src1 src2 -- )

%sar-imm ( dst src1 src2 -- )

%shl ( dst src1 src2 -- )

%shl-imm ( dst src1 src2 -- )

%shr ( dst src1 src2 -- )

%shr-imm ( dst src1 src2 -- )

%xor ( dst src1 src2 -- )

%xor-imm ( dst src1 src2 -- )


Control flow code emitters:
%call ( word -- )

%epilogue ( n -- )

%jump ( word -- )

%jump-label ( label -- )

%prologue ( n -- )

%return ( -- )

%safepoint ( -- )


Foreign function interface:
%c-invoke ( symbols dll gc-map -- )


Garbage collection:
%call-gc ( gc-map -- )

%check-nursery-branch ( label size cc temp1 temp2 -- )


Moving values around:
%clear ( loc -- )

%peek ( vreg loc -- )

%replace ( vreg loc -- )

%replace-imm ( src loc -- )


Register categories:
machine-registers ( -- assoc )

param-regs ( abi -- regs )

return-regs ( -- regs )


Representation metadata:
narrow-vector-rep ( rep -- rep' )

reg-class-of ( rep -- reg-class )

rep-component-type ( rep -- n )

rep-length ( rep -- n )

rep-size ( rep -- n )

scalar-rep-of ( rep -- rep' )

signed-rep ( rep -- rep' )

widen-vector-rep ( rep -- rep' )


Slot access:
%set-slot ( src obj slot scale tag -- )

%set-slot-imm ( src obj slot tag -- )

%slot ( dst obj slot scale tag -- )

%slot-imm ( dst obj slot tag -- )

%write-barrier ( src slot scale tag temp1 temp2 -- )


Spilling & reloading:
%spill ( src rep dst -- )

%reload ( dst rep src -- )

gc-root-offset ( spill-slot -- n )


Value as immediate checks:
immediate-arithmetic? ( n -- ? )

immediate-bitwise? ( n -- ? )

immediate-comparand? ( n -- ? )

immediate-store? ( n -- ? )

immediate-shift-count? ( n -- ? )