From 911f9b495ffd15e772f24a57eb54fb48ec480f17 Mon Sep 17 00:00:00 2001 From: Raymond Toy Date: Mon, 1 Apr 2024 20:19:43 -0700 Subject: [PATCH 1/3] Fix #295: Add docstring for define-assembly-routine Describe the format and options for `define-assembly-routine`. This is pretty rudimentary, but hopefully is enough to get started with writing an assembly routine. --- src/assembly/assemfile.lisp | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/assembly/assemfile.lisp b/src/assembly/assemfile.lisp index 09a887853..bba780dc5 100644 --- a/src/assembly/assemfile.lisp +++ b/src/assembly/assemfile.lisp @@ -209,7 +209,61 @@ ,(reg-spec-temp res)))) results)))))) +;;; Define-assembly-routine -- Public +;;; +;;; Parse the code to produce an assembly routine and create a VOP +;;; that calls the assembly routine. (defmacro define-assembly-routine (name&options vars &rest code) + "Define-assembly-routine (name&options vars Code*) + Define a Lisp assembly routine, and a VOP to that calls the assembly + routine, if enabled. (A VOP is not created if the reader + conditional #+assembler precedes the definition of the assembly + routine.) + + Name&options + A list giving the name of the assembly routine and options + describing the assembly routine options and VOP options. The + format is (Name ({Key Value})*) where Name is the name of the + assembly routine. Options is a list of options: + + Options + + :Cost Cost + The cost of the VOP. This is used in the generated VOP. + + :Policy Policy + The policy for the VOP + + :Translate Name + The translation for the VOP + + :Arg-Types arg-types + :Result-Types result-types + The template restrictions for the arguments of the VOP and the + results of the VOP. + + :Return-Style {:Raw :Full-Call :None} + + Vars is a list of the arguments and returned results and + temporaries used by the assembly routine. + + :Arg Arg-name (Sc*) Sc-Offset + Input argument for the assembly routine with the name + Arg-Name. The argument must be one of the Sc types. The register + assigned to this argument is given by Sc-Offset which must be + the offset for the register holding this argument. + + :Res Res-Name Sc Sc-offset + Result of the assembly routine with the name Res-Name. The + result must be a register of the specified storage class Sc. The + Sc-offset is the register used for the result. + + :Temp Temp-Name Sc Sc-offset + Like :res, except this names a temporary register that the + assembly routine can use. + + Code + The code for the assembly routine." (multiple-value-bind (name options) (if (atom name&options) (values name&options nil) -- GitLab From 7200acc8f06baf993172136b52a59ff16b473999 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Sun, 7 Apr 2024 23:22:29 +0000 Subject: [PATCH 2/3] Apply 12 suggestion(s) to 1 file(s) --- src/assembly/assemfile.lisp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/assembly/assemfile.lisp b/src/assembly/assemfile.lisp index bba780dc5..f431c3328 100644 --- a/src/assembly/assemfile.lisp +++ b/src/assembly/assemfile.lisp @@ -209,18 +209,18 @@ ,(reg-spec-temp res)))) results)))))) -;;; Define-assembly-routine -- Public +;;; Define-Assembly-Routine -- Public ;;; ;;; Parse the code to produce an assembly routine and create a VOP ;;; that calls the assembly routine. (defmacro define-assembly-routine (name&options vars &rest code) - "Define-assembly-routine (name&options vars Code*) + "Define-Assembly-Routine (Name&Options Vars Code*) Define a Lisp assembly routine, and a VOP to that calls the assembly routine, if enabled. (A VOP is not created if the reader conditional #+assembler precedes the definition of the assembly routine.) - Name&options + Name&Options A list giving the name of the assembly routine and options describing the assembly routine options and VOP options. The format is (Name ({Key Value})*) where Name is the name of the @@ -231,11 +231,11 @@ :Cost Cost The cost of the VOP. This is used in the generated VOP. - :Policy Policy - The policy for the VOP + :Policy {:Small | :Fast | :Safe | :Fast-Safe} + The policy for the VOP. :Translate Name - The translation for the VOP + The translation for the VOP. :Arg-Types arg-types :Result-Types result-types @@ -247,19 +247,19 @@ Vars is a list of the arguments and returned results and temporaries used by the assembly routine. - :Arg Arg-name (Sc*) Sc-Offset + :Arg Arg-Name (SC*) SC-Offset Input argument for the assembly routine with the name Arg-Name. The argument must be one of the Sc types. The register - assigned to this argument is given by Sc-Offset which must be + assigned to this argument is given by SC-Offset which must be the offset for the register holding this argument. - :Res Res-Name Sc Sc-offset + :Res Res-Name SC SC-Offset Result of the assembly routine with the name Res-Name. The - result must be a register of the specified storage class Sc. The + result must be a register of the specified storage class SC. The Sc-offset is the register used for the result. - :Temp Temp-Name Sc Sc-offset - Like :res, except this names a temporary register that the + :Temp Temp-Name SC SC-Offset + Like :Res, except this names a temporary register that the assembly routine can use. Code -- GitLab From bc64497dc19a742601e1b7570ba043b2ad2a8080 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Sun, 7 Apr 2024 23:26:05 +0000 Subject: [PATCH 3/3] Apply 1 suggestion(s) to 1 file(s) --- src/assembly/assemfile.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assembly/assemfile.lisp b/src/assembly/assemfile.lisp index f431c3328..73d9af335 100644 --- a/src/assembly/assemfile.lisp +++ b/src/assembly/assemfile.lisp @@ -249,7 +249,7 @@ :Arg Arg-Name (SC*) SC-Offset Input argument for the assembly routine with the name - Arg-Name. The argument must be one of the Sc types. The register + Arg-Name. The argument must be one of the SC types. The register assigned to this argument is given by SC-Offset which must be the offset for the register holding this argument. -- GitLab