Docs: for compiler.cfg.regsters
parent
395a490b90
commit
3d7b0dbf0a
|
@ -0,0 +1,25 @@
|
|||
USING: compiler.cfg.instructions cpu.architecture help.markup help.syntax
|
||||
math ;
|
||||
IN: compiler.cfg.registers
|
||||
|
||||
HELP: next-vreg
|
||||
{ $values { "vreg" number } }
|
||||
{ $description "Creates a new virtual register identifier." }
|
||||
{ $notes "This word cannot be called after representation selection has run; use " { $link next-vreg-rep } " in that case." } ;
|
||||
|
||||
HELP: rep-of
|
||||
{ $values { "vreg" number } { "rep" representation } }
|
||||
{ $description "Gets the representation for a virtual register. This word cannot be called before representation selection has run; use any-rep for " { $link ##copy } " instructions and so on." }
|
||||
{ $notes "Throws " { $link bad-vreg } " if the representation for the vreg isn't known." } ;
|
||||
|
||||
HELP: set-rep-of
|
||||
{ $values { "rep" representation } { "vreg" number } }
|
||||
{ $description "Sets the representation for a virtual register." } ;
|
||||
|
||||
HELP: next-vreg-rep
|
||||
{ $values { "rep" representation } { "vreg" number } }
|
||||
{ $description "Creates a new virtual register identifier and sets its representation." }
|
||||
{ $notes "This word cannot be called before representation selection has run; use " { $link next-vreg } " in that case." } ;
|
||||
|
||||
HELP: loc
|
||||
{ $class-description "Represents a location on the stack. 'n' is an index starting from the top of the stack going down. So 0 is the top of the stack, 1 is what would be the top of the stack after a 'drop', and so on. It has two subclasses, " { $link ds-loc } " for data stack location and " { $link rs-loc } " for locations on the retain stack." } ;
|
|
@ -7,8 +7,6 @@ IN: compiler.cfg.registers
|
|||
SYMBOL: vreg-counter
|
||||
|
||||
: next-vreg ( -- vreg )
|
||||
! This word cannot be called AFTER representation selection has run;
|
||||
! use next-vreg-rep in that case
|
||||
vreg-counter counter ;
|
||||
|
||||
SYMBOL: representations
|
||||
|
@ -16,22 +14,14 @@ SYMBOL: representations
|
|||
ERROR: bad-vreg vreg ;
|
||||
|
||||
: rep-of ( vreg -- rep )
|
||||
! This word cannot be called BEFORE representation selection has run;
|
||||
! use any-rep for ##copy instructions and so on
|
||||
representations get ?at [ bad-vreg ] unless ;
|
||||
|
||||
: set-rep-of ( rep vreg -- )
|
||||
representations get set-at ;
|
||||
|
||||
: next-vreg-rep ( rep -- vreg )
|
||||
! This word cannot be called BEFORE representation selection has run;
|
||||
! use next-vreg in that case
|
||||
next-vreg [ set-rep-of ] keep ;
|
||||
|
||||
! Stack locations -- 'n' is an index starting from the top of the stack
|
||||
! going down. So 0 is the top of the stack, 1 is what would be the top
|
||||
! of the stack after a 'drop', and so on.
|
||||
|
||||
! ##inc-d and ##inc-r affect locations as follows. Location D 0 before
|
||||
! an ##inc-d 1 becomes D 1 after ##inc-d 1.
|
||||
TUPLE: loc { n integer read-only } ;
|
||||
|
|
Loading…
Reference in New Issue