]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.*: more docs
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 22 Apr 2016 11:00:46 +0000 (13:00 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Fri, 22 Apr 2016 11:00:46 +0000 (13:00 +0200)
basis/cpu/architecture/architecture-docs.factor
basis/cpu/x86/assembler/assembler-docs.factor
basis/cpu/x86/assembler/assembler.factor

index 135cf90e5e294ade014ad8fa8312de16f457fe00..b3117afe40e1eb2893d2b16e9deeac901de428e2 100644 (file)
@@ -1,8 +1,7 @@
 USING: alien assocs classes compiler.cfg.instructions
-compiler.cfg.registers compiler.cfg.stack-frame
-cpu.x86.assembler cpu.x86.assembler.operands help.markup
-help.syntax kernel layouts literals math multiline system vm
-words ;
+compiler.cfg.registers compiler.cfg.stack-frame cpu.x86.assembler
+cpu.x86.assembler.operands help.markup help.syntax kernel layouts
+literals math multiline sequences strings system vm words ;
 IN: cpu.architecture
 
 <<
@@ -108,6 +107,21 @@ HELP: param-regs
 { $values { "abi" "a calling convention symbol" } { "regs" assoc } }
 { $description "Retrieves the order in which machine registers are used for parameters for the given calling convention." } ;
 
+HELP: %alien-invoke
+{ $values
+  { "reg-inputs" sequence }
+  { "stack-inputs" sequence }
+  { "reg-outputs" sequence }
+  { "dead-outputs" sequence }
+  { "cleanup" integer }
+  { "stack-size" integer }
+  { "symbols" string }
+  { "dll" { $maybe dll } }
+  { "gc-map" gc-map }
+}
+{ $description "Machine code emitter for the " { $link ##alien-invoke } " instruction." } ;
+
+
 HELP: %allot
 { $values
   { "dst" "destination register symbol" }
@@ -176,6 +190,13 @@ HELP: %horizontal-add-vector
   }
 } ;
 
+HELP: %load-double
+{ $values
+  { "reg" "destination register symbol" }
+  { "val" float }
+} { $description "Loads a literal floating point value into a register. On x86, this corresponds to the " { $link MOVSD } " instruction." }
+{ $see-also ##load-double } ;
+
 HELP: %load-immediate
 { $values { "reg" "a register symbol" } { "val" "a value" } }
 { $description "Emits code for loading an immediate value into a register. On " { $link x86 } ", if val is 0, then an " { $link XOR } " instruction is emitted instead of " { $link MOV } " because the former is shorter." }
@@ -231,6 +252,22 @@ HELP: %save-context
 { $description "Emits machine code for saving pointers to the callstack, datastack and retainstack in the current context field struct." }
 { $examples { $unchecked-example $[ ex-%save-context ] } } ;
 
+HELP: %set-slot
+{ $values
+  { "src" "register containing the element" }
+  { "obj" "register containing the object" }
+  { "slot" "register containing the slot index" }
+  { "scale" fixnum }
+  { "tag" "type tag for the builtin" }
+} { $description "Emits machine code for " { $link ##set-slot } " instructions." }
+{ $examples
+  { $unchecked-example
+    "USING: cpu.architecture prettyprint ;"
+    "[ RAX RBX RCX 3 2 %set-slot ] B{ } make disassemble"
+    "0000000000f1fda0: 488944cbfe  mov [rbx+rcx*8-0x2], rax"
+  }
+} ;
+
 HELP: %store-memory-imm
 { $values
   { "value" "source register" }
index e922e8e4f4335337160bfdae75d096f5f5808863..0c2fa3e292f24f17621f4f7a15c34a77fbf86247 100644 (file)
@@ -1,4 +1,5 @@
-USING: compiler.codegen.labels cpu.x86.assembler help.markup help.syntax ;
+USING: compiler.codegen.labels cpu.x86.assembler.private help.markup
+help.syntax ;
 IN: cpu.x86.assembler
 
 HELP: JE
@@ -11,3 +12,15 @@ HELP: JE
     "000000e9fcc71fe0: 0f8400000000  jz dword 0xe9fcc71fe6"
   }
 } ;
+
+HELP: MOV
+{ $values { "dst" "destination" "src" "source" } }
+{ $description "Moves a value from one place to another." } ;
+
+HELP: (MOV-I)
+{ $values { "dst" "destination" "src" "immediate value" } }
+{ $description "MOV where the src is immediate." } ;
+
+ARTICLE: "cpu.x86.assembler" "x86 assembler" "This vocab implements an assembler for x86 architectures." ;
+
+ABOUT: "cpu.x86.assembler"
index b452b48f7f977dae5d8aad591c001343574005e6..643306013b1af71f554581e58a0219ff4a7c5943 100644 (file)
@@ -210,7 +210,6 @@ GENERIC: POP ( op -- )
 M: register POP f 0x58 short-operand ;
 M: operand POP { 0b000 f 0x8f } 1-operand ;
 
-! MOV where the src is immediate.
 <PRIVATE
 
 GENERIC# (MOV-I) 1 ( dst src -- )