From 3d7b0dbf0abd8ad233711c92000c00f07022c7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sun, 18 May 2014 19:03:37 +0200 Subject: [PATCH] Docs: for compiler.cfg.regsters --- .../cfg/registers/registers-doc.factor | 25 +++++++++++++++++++ basis/compiler/cfg/registers/registers.factor | 10 -------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 basis/compiler/cfg/registers/registers-doc.factor diff --git a/basis/compiler/cfg/registers/registers-doc.factor b/basis/compiler/cfg/registers/registers-doc.factor new file mode 100644 index 0000000000..dddba48334 --- /dev/null +++ b/basis/compiler/cfg/registers/registers-doc.factor @@ -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." } ; diff --git a/basis/compiler/cfg/registers/registers.factor b/basis/compiler/cfg/registers/registers.factor index d70d9316a2..6b93b46be6 100644 --- a/basis/compiler/cfg/registers/registers.factor +++ b/basis/compiler/cfg/registers/registers.factor @@ -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 } ;