]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler,cpu: more docs
authorBjörn Lindqvist <bjourne@gmail.com>
Tue, 14 Oct 2014 15:37:46 +0000 (17:37 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Fri, 17 Oct 2014 21:18:57 +0000 (23:18 +0200)
basis/compiler/cfg/builder/alien/params/params-docs.factor [new file with mode: 0644]
basis/cpu/architecture/architecture-docs.factor
basis/cpu/x86/x86-docs.factor

diff --git a/basis/compiler/cfg/builder/alien/params/params-docs.factor b/basis/compiler/cfg/builder/alien/params/params-docs.factor
new file mode 100644 (file)
index 0000000..f6599eb
--- /dev/null
@@ -0,0 +1,17 @@
+USING: cpu.architecture help.markup help.syntax math ;
+IN: compiler.cfg.builder.alien.params
+
+HELP: stack-params
+{ $var-description "Count of the number of bytes of stack allocation required to store the current call frames parameters." } ;
+
+HELP: alloc-stack-param
+{ $values { "rep" representation } { "n" integer } }
+{ $description "Allocates space for a stack parameter value of the given representation and returns the previous stack parameter offset." }
+{ $examples
+  "On 32-bit architectures, the offsets will be aligned to four byte boundaries."
+  { $unchecked-example
+    "0 stack-params set float-rep alloc-stack-param stack-params get . ."
+    "4"
+    "0"
+  }
+} ;
index 6e2f8aa89c6d02a9cba927d0ad6233ff8028021b..c8e29dc13f581007477e4b17a18afe410b870b95 100644 (file)
@@ -1,4 +1,4 @@
-USING: assocs compiler.cfg.instructions cpu.x86.assembler
+USING: assocs alien compiler.cfg.instructions cpu.x86.assembler
 cpu.x86.assembler.operands help.markup help.syntax kernel
 layouts literals math multiline system words ;
 IN: cpu.architecture
@@ -134,3 +134,30 @@ HELP: fused-unboxing?
 HELP: return-regs
 { $values { "regs" assoc } }
 { $description "What registers that will be used for function return values of which class." } ;
+
+HELP: stack-cleanup
+{ $values { "stack-size" integer } { "return" "a c type" } { "abi" abi } }
+{ $description "Calculates how many bytes of stack space the caller of the procedure being constructed need to cleanup. For modern abi's the value is almost always 0." }
+{ $examples
+  { $unchecked-example
+    "USING: cpu.architecture prettyprint ;"
+    "20 void stdcall stack-cleanup ."
+    "20"
+  }
+} ;
+
+ARTICLE: "cpu.architecture" "CPU architecture description model"
+"The " { $vocab-link "cpu.architecture" } " vocab generic words and hooks that serves as an api for the compiler towards the cpu architecture."
+$nl
+"Register categories:"
+{ $subsections machine-registers param-regs return-regs }
+"Architecture support checks:"
+{ $subsections
+  complex-addressing?
+  float-on-stack?
+  float-right-align-on-stack?
+  fused-unboxing?
+  test-instruction?
+}
+"Control flow code emitters:"
+{ $subsections %call %jump %jump-label %return } ;
index 5b0f72b2cdac234760a733135fcbad1dadb3e3d6..9e904eac7a9ff6bf15a4e360d1b05cf08a397351 100644 (file)
@@ -7,6 +7,10 @@ HELP: stack-reg
   "Symbol of the machine register that holds the (cpu) stack address."
 } ;
 
+HELP: reserved-stack-space
+{ $values { "n" integer } }
+{ $description "Size in bytes of the register parameter area. It only exists on the windows x86.64 architecture, where it is 32 bytes and allocated by the caller. On all other platforms it is 0." } ;
+
 HELP: ds-reg
 { $values { "reg" "a register symbol" } }
 { $description