chiark / gitweb /
src/: Abolish the special `va-*' instructions.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Dec 2015 17:19:30 +0000 (17:19 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:40:40 +0000 (14:40 +0100)
They can be built easily enough using `call', and `deliver-call' makes
it easier on the fingers than the dedicated instructions.

doc/SYMBOLS
doc/clang.tex
src/codegen-impl.lisp
src/method-impl.lisp
src/method-proto.lisp

index 4d7b384f2d519554c1c61398fd0bcf1268dc7b7b..226ab387a3c090f2922753520ba29c2ca2c77b52 100644 (file)
@@ -325,28 +325,18 @@ codegen-impl.lisp
   do-while-inst                                 class
   if-inst                                       class
   inst-alt                                      generic
-  inst-ap                                       generic
-  inst-arg                                      generic
   inst-args                                     generic
   inst-body                                     generic
   inst-cond                                     generic
   inst-conseq                                   generic
-  inst-from                                     generic
   inst-func                                     generic
-  inst-to                                       generic
   make-call-inst                                function
   make-do-while-inst                            function
   make-if-inst                                  function
-  make-va-copy-inst                             function
-  make-va-end-inst                              function
-  make-va-start-inst                            function
   make-while-inst                               function
   temporary-argument                            class
   temporary-function                            function class
   temporary-variable                            class
-  va-copy-inst                                  class
-  va-end-inst                                   class
-  va-start-inst                                 class
   while-inst                                    class
 
 codegen-proto.lisp
@@ -627,9 +617,6 @@ cl:t
         return-inst
         set-inst
         update-inst
-        va-copy-inst
-        va-end-inst
-        va-start-inst
         var-inst
         while-inst
       islots
@@ -1053,11 +1040,6 @@ ilayout-ichains
   ilayout
 inst-alt
   if-inst
-inst-ap
-  va-end-inst
-  va-start-inst
-inst-arg
-  va-start-inst
 inst-args
   call-inst
 inst-body
@@ -1083,8 +1065,6 @@ inst-expr
   return-inst
   set-inst
   update-inst
-inst-from
-  va-copy-inst
 inst-func
   call-inst
 inst-init
@@ -1105,9 +1085,6 @@ inst-metric
   return-inst
   set-inst
   update-inst
-  va-copy-inst
-  va-end-inst
-  va-start-inst
   var-inst
   while-inst
 inst-name
@@ -1115,8 +1092,6 @@ inst-name
   var-inst
 inst-op
   update-inst
-inst-to
-  va-copy-inst
 inst-type
   function-inst
   var-inst
@@ -1237,9 +1212,6 @@ cl:print-object
   sod-slot t
   temporary-name t
   update-inst t
-  va-copy-inst t
-  va-end-inst t
-  va-start-inst t
   var-inst t
   vtable t
   vtable-pointer t
index 3b692d81cc5ef4d21e4820b12d0f95eeca84a4f1..58b8cd22e904d67dea1f71b46ac1d652d9fe849a 100644 (file)
@@ -904,12 +904,7 @@ Temporary names are represented by objects which implement a simple protocol.
     @|expr|     & @<expr>                  & @<expr>;           \\ \hlx{v}
     @|call|     & @<func> @<args>          & @<func>(@<arg>_1,
                                                      $\ldots$,
-                                                     @<arg>_n)  \\ \hlx{v}
-    @|va-start| & @<ap> @<arg>             & va_start(@<ap>, @<arg>);
-                                                                \\ \hlx{v}
-    @|va-copy|  & @<to> @<from>            & va_copy(@<to>, @<from>);
-                                                                \\ \hlx{v}
-    @|va-end|   & @<ap>                    & va_end(@<ap>);     \\ \hlx{vhv}
+                                                     @<arg>_n)  \\ \hlx{vhv}
     @|block|    & @<decls> @<body>         & \{ @[@<decls>@] @<body> \}
                                                                 \\ \hlx{v}
     @|if|       & @<cond> @<conseq> @<alt> & if (@<cond>) @<conseq>
index 6842b0029e4aaf82c1f03da4b6ecf432e37e3c61..bc6f11d56b72c629d6284c934b27d701614a47a0 100644 (file)
@@ -96,16 +96,6 @@ (definst do-while (stream :export t) (body #1=#:cond)
     (write-string "do" stream))
   (format stream "while (~A);" #1#))
 
-;; Special varargs hacks.
-
-(definst va-start (stream :export t) (ap arg)
-  (format stream "va_start(~@<~A, ~_~A~:>);" ap arg))
-
-(definst va-copy (stream :export t) (to from)
-  (format stream "va_copy(~@<~A, ~_~A~:>);" to from))
-
-(definst va-end (stream :export t) (ap)
-  (format stream "va_end(~A);" ap))
 
 ;; Expressions.
 
index 725a0ec2b817555159fc221ef5112bd995799b2e..366d1dcd8e053a3594f14e036fbf2c2b74766f76 100644 (file)
@@ -455,13 +455,11 @@ (defmethod compute-method-entry-functions ((method basic-effective-method))
                   (ensure-var codegen *sod-ap* c-type-va-list)
                   (convert-stmts codegen entry-target return-type
                                  (lambda (target)
-                                   (emit-inst codegen
-                                              (make-va-start-inst
-                                               *sod-ap*
-                                               (argument-name parm-n)))
+                                   (deliver-call codegen :void "va_start"
+                                                 *sod-ap* parm-n)
                                    (deliver-expr codegen target call)
-                                   (emit-inst codegen
-                                              (make-va-end-inst *sod-ap*))))
+                                   (deliver-call codegen :void "va_end"
+                                                 *sod-ap*)))
                   (codegen-pop-function codegen main main-type))))))
 
       ;; Generate the method body.  We'll work out what to do with it later.
index c8b47ad90d67d674b56f04217c4fc29de3ac5d19..069f7e4d5fb7681776518ac64c2a04fe1c1adaef 100644 (file)
@@ -293,13 +293,11 @@ (defun invoke-method (codegen target arguments-tail direct-method)
                       (c-type-subtype (sod-method-type direct-method))
                       (lambda (var)
                         (ensure-var codegen *sod-tmp-ap* c-type-va-list)
-                        (emit-inst codegen
-                                   (make-va-copy-inst *sod-tmp-ap*
-                                                      *sod-ap*))
+                        (deliver-call codegen :void "va_copy"
+                                      *sod-tmp-ap* *sod-ap*)
                         (apply #'deliver-call codegen var
                                function arguments)
-                        (emit-inst codegen
-                                   (make-va-end-inst *sod-tmp-ap*))))
+                        (deliver-call codegen :void "va_end" *sod-tmp-ap*)))
        (apply #'deliver-call codegen target function arguments))))
 
 (export 'ensure-ilayout-var)