cmp: cxx: move the cxx code generator to cmppass2-top

This commit is contained in:
Daniel Kochmański 2023-11-07 11:26:28 +01:00
parent e287445b98
commit 6722d4b9da
2 changed files with 31 additions and 27 deletions

View file

@ -528,33 +528,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
")
;;; Code generation
(defun compiler-pass/generate-cxx (c-pathname h-pathname data-pathname init-name source)
(with-cxx-env ()
;; After this step we still can add new objects, but objects that are
;; already stored in VV or VVtemp must not change the location.
(optimize-cxx-data *referenced-objects*)
(setq *compiler-phase* 't2)
(with-open-file (*compiler-output1* c-pathname :direction :output
:if-does-not-exist :create
:if-exists :supersede)
(wt-comment-nl "Compiler: ~A ~A" (lisp-implementation-type) (lisp-implementation-version))
#-ecl-min
(multiple-value-bind (second minute hour day month year)
(get-decoded-time)
(declare (ignore second))
(wt-comment-nl "Date: ~D/~D/~D ~2,'0D:~2,'0D (yyyy/mm/dd)" year month day hour minute)
(wt-comment-nl "Machine: ~A ~A ~A" (software-type) (software-version) (machine-type)))
(wt-comment-nl "Source: ~A" source)
(with-open-file (*compiler-output2* h-pathname :direction :output
:if-does-not-exist :create
:if-exists :supersede)
(wt-nl1 "#include " *cmpinclude*)
(ctop-write init-name h-pathname data-pathname)
(terpri *compiler-output1*)
(terpri *compiler-output2*)))
(data-c-dump data-pathname)))
;;; Code assembly
(defun compiler-pass/assemble-cxx (input-file output-file
&key

View file

@ -1,6 +1,36 @@
(in-package #:compiler)
(defun wt-print-header (source)
(wt-comment-nl "Compiler: ~A ~A" (lisp-implementation-type) (lisp-implementation-version))
#-ecl-min
(multiple-value-bind (second minute hour day month year)
(get-decoded-time)
(declare (ignore second))
(wt-comment-nl "Date: ~D/~D/~D ~2,'0D:~2,'0D (yyyy/mm/dd)" year month day hour minute)
(wt-comment-nl "Machine: ~A ~A ~A" (software-type) (software-version) (machine-type)))
(wt-comment-nl "Source: ~A" source))
(defun compiler-pass/generate-cxx (c-pathname h-pathname data-pathname init-name source)
(with-cxx-env ()
;; After this step we still can add new objects, but objects that are
;; already stored in VV or VVtemp must not change the location.
(optimize-cxx-data *referenced-objects*)
(setq *compiler-phase* 't2)
(with-open-file (*compiler-output1* c-pathname :direction :output
:if-does-not-exist :create
:if-exists :supersede)
(with-open-file (*compiler-output2* h-pathname :direction :output
:if-does-not-exist :create
:if-exists :supersede)
(wt-print-header source)
(wt-nl1 "#include " *cmpinclude*)
(ctop-write init-name h-pathname data-pathname)
(terpri *compiler-output1*)
(terpri *compiler-output2*)))
(data-c-dump data-pathname)))
;;;; CMPTOP -- Compiler top-level.
(defun t2expr (form)