From b492babc8de898bd22d638d7c25f24356896a3a9 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 15 Dec 2015 17:19:30 +0000 Subject: [PATCH] src/: Abolish the special `va-*' instructions. Organization: Straylight/Edgeware From: Mark Wooding They can be built easily enough using `call', and `deliver-call' makes it easier on the fingers than the dedicated instructions. --- doc/SYMBOLS | 28 ---------------------------- doc/clang.tex | 7 +------ src/codegen-impl.lisp | 10 ---------- src/method-impl.lisp | 10 ++++------ src/method-proto.lisp | 8 +++----- 5 files changed, 8 insertions(+), 55 deletions(-) diff --git a/doc/SYMBOLS b/doc/SYMBOLS index 4d7b384..226ab38 100644 --- a/doc/SYMBOLS +++ b/doc/SYMBOLS @@ -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 diff --git a/doc/clang.tex b/doc/clang.tex index 3b692d8..58b8cd2 100644 --- a/doc/clang.tex +++ b/doc/clang.tex @@ -904,12 +904,7 @@ Temporary names are represented by objects which implement a simple protocol. @|expr| & @ & @; \\ \hlx{v} @|call| & @ @ & @(@_1, $\ldots$, - @_n) \\ \hlx{v} - @|va-start| & @ @ & va_start(@, @); - \\ \hlx{v} - @|va-copy| & @ @ & va_copy(@, @); - \\ \hlx{v} - @|va-end| & @ & va_end(@); \\ \hlx{vhv} + @_n) \\ \hlx{vhv} @|block| & @ @ & \{ @[@@] @ \} \\ \hlx{v} @|if| & @ @ @ & if (@) @ diff --git a/src/codegen-impl.lisp b/src/codegen-impl.lisp index 6842b00..bc6f11d 100644 --- a/src/codegen-impl.lisp +++ b/src/codegen-impl.lisp @@ -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. diff --git a/src/method-impl.lisp b/src/method-impl.lisp index 725a0ec..366d1dc 100644 --- a/src/method-impl.lisp +++ b/src/method-impl.lisp @@ -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. diff --git a/src/method-proto.lisp b/src/method-proto.lisp index c8b47ad..069f7e4 100644 --- a/src/method-proto.lisp +++ b/src/method-proto.lisp @@ -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) -- [mdw]