Skip to content
comcom.lisp 8.43 KiB
Newer Older
;;; -*- Package: CL-USER -*-
wlott's avatar
wlott committed
;;;
;;; **********************************************************************
;;;
(ext:file-comment
  "$Header: src/tools/comcom.lisp $")
;;;
;;; **********************************************************************
;;;
;;; Loading this file causes the CMUCL compiler to be compiled.
;;;
wlott's avatar
wlott committed

(copy-packages (cons (c::backend-name c::*target-backend*) '("NEW-ASSEM" "C")))
(defvar *load-stuff*
  #+bootstrap t
  #-bootstrap (eq c:*backend* c:*native-backend*))
(defvar *byte-compile* #+small t #-small :maybe)

toy's avatar
toy committed
(unless (find-package "OLD-C")
  (rename-package "C" "C" '("OLD-C")))

;;; Import so that these types which appear in the globaldb are the same...
#+bootstrap
(import '(old-c::approximate-function-type
	  old-c::function-info old-c::defstruct-description
	  old-c::defstruct-slot-description)
	"C")

ram's avatar
ram committed

(with-compiler-log-file
    ("target:compile-compiler.log"
     :optimize
     '(optimize (speed 2) (space 2) (inhibit-warnings 2)
		(safety #+small 0 #-small 1)
ram's avatar
ram committed
		(debug #+small .5 #-small 2))
     :optimize-interface
     '(optimize-interface (safety #+small 1 #-small 2)
ram's avatar
ram committed
			  (debug #+small .5 #-small 2))
     :context-declarations
     '(#+small
       ((:or :macro
	     (:match "$SOURCE-TRANSFORM-" "$IR1-CONVERT-"
		     "$PRIMITIVE-TRANSLATE-" "$PARSE-"))
	(declare (optimize (safety 1))))
ram's avatar
ram committed
       ((:or :macro (:match "$%PRINT-"))
ram's avatar
ram committed
	(declare (optimize (speed 0))))
ram's avatar
ram committed
       (:external (declare (optimize-interface (safety 2) (debug 1))))))
ram's avatar
ram committed

(setf lisp::*enable-package-locked-errors* nil)

(comf "target:compiler/macros"
      :byte-compile #+bootstrap t #-bootstrap *byte-compile*)
(when *load-stuff*
  (load "target:compiler/macros"))
ram's avatar
ram committed

(comf "target:compiler/generic/vm-macs" :proceed t
ram's avatar
ram committed
	:byte-compile #+bootstrap t #-bootstrap nil)
(when *load-stuff*
  (load "target:compiler/generic/vm-macs"))
ram's avatar
ram committed

(comf "target:compiler/backend" :proceed t
ram's avatar
ram committed
	:byte-compile #+bootstrap t #-bootstrap nil)
(when *load-stuff*
  (load "target:compiler/backend"))

(defvar c::*target-backend* (c::make-backend))

(comf (vmdir "target:compiler/parms") :proceed t)
moore's avatar
 
moore committed
;(when *load-stuff*
;  (load (vmdir "target:compiler/parms")))
ram's avatar
ram committed

wlott's avatar
wlott committed
(comf "target:compiler/generic/objdef" :proceed t)
(comf "target:compiler/generic/interr")

(comf "target:code/struct") ; For defstruct description structures.
(comf "target:compiler/proclaim") ; For COOKIE structure.
(comf "target:compiler/globals")

(comf "target:compiler/sset")
ram's avatar
ram committed
(comf "target:compiler/bit-util")
(comf "target:compiler/node")
(comf "target:compiler/ctype")
(comf "target:compiler/vop" :proceed t)
(comf "target:compiler/vmdef")
ram's avatar
ram committed

(comf "target:compiler/meta-vmdef" :proceed t)
ram's avatar
ram committed
#+bootstrap ;; pw adds
(comf "target:compiler/meta-vmdef" :byte-compile t)
(when *load-stuff*
  (load "target:compiler/meta-vmdef"))
(comf "target:compiler/disassem" :byte-compile *byte-compile*)
wlott's avatar
wlott committed
(comf "target:compiler/new-assem")
moore's avatar
 
moore committed
(when *load-stuff*
  (load "target:compiler/new-assem"))
(comf "target:compiler/alloc")
(comf "target:compiler/knownfun")
(comf "target:compiler/fndb")
(comf "target:compiler/generic/vm-fndb")
(comf "target:compiler/main")

    (:optimize '(optimize (safety 1)))
  (comf "target:compiler/ir1tran"))

(with-compilation-unit
    (:optimize '(optimize (debug 2)))
  (comf "target:compiler/ir1util")
  (comf "target:compiler/ir1opt"))

(comf "target:compiler/loop")
(comf "target:compiler/ir1final")
ram's avatar
ram committed
;;try(comf "target:compiler/srctran")
(comf "target:compiler/array-tran" :byte-compile *byte-compile*)
(comf "target:compiler/seqtran" :byte-compile *byte-compile*)
(comf "target:compiler/typetran" :byte-compile *byte-compile*)
(comf "target:compiler/generic/vm-typetran" :byte-compile *byte-compile*)
(comf "target:compiler/float-tran" :byte-compile *byte-compile*)
(comf "target:compiler/saptran" :byte-compile *byte-compile*)
ram's avatar
ram committed
(comf "target:compiler/srctran") ;; try
(comf "target:compiler/locall")
(comf "target:compiler/dfo")
(comf "target:compiler/checkgen")
(comf "target:compiler/constraint")
(comf "target:compiler/envanal")

ram's avatar
ram committed

(comf "target:compiler/tn")
(comf "target:compiler/life")

(comf "target:code/debug-info")

(comf "target:compiler/debug-dump")
(comf "target:compiler/generic/utils")
(comf "target:assembly/assemfile")
ram's avatar
ram committed
#+bootstrap
(comf "target:assembly/assemfile" :byte-compile t)
(when *load-stuff* (load "target:assembly/assemfile"))
    (:optimize '(optimize (safety #+small 0 #-small 1) #+small (debug 0)))

ram's avatar
ram committed
  (progn				; this is distributed order
    (comf (vmdir "target:compiler/insts"))
    (comf (vmdir "target:compiler/macros") :load *load-stuff*)
    (comf (vmdir "target:compiler/vm")))
ram's avatar
ram committed
  (progn				; this works for x86
    (comf (vmdir "target:compiler/vm"))
    (comf (vmdir "target:compiler/macros") :load *load-stuff*)
    (comf (vmdir "target:compiler/insts")))
  #-tryit
  (progn				; this also works - better??
ram's avatar
ram committed
    (comf (vmdir "target:compiler/vm"))
    (comf (vmdir "target:compiler/insts"))
    (comf (vmdir "target:compiler/macros")
ram's avatar
ram committed
	   :byte-compile #+bootstrap t #-bootstrap nil)
    (when *load-stuff*
      (load (vmdir "target:compiler/macros")))
    )
ram's avatar
ram committed
  
(comf "target:compiler/generic/primtype")
(comf (vmdir "target:assembly/support")
ram's avatar
ram committed
       :byte-compile #+bootstrap t #-bootstrap nil) ; pw
(when *load-stuff*
  (load (vmdir "target:assembly/support")))
(comf (vmdir "target:compiler/move"))
(comf (vmdir "target:compiler/float-sse2")
      :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/sap") :byte-compile *byte-compile*)
(when (c:target-featurep :x86)
  (comf (vmdir "target:compiler/sse2-sap")
	:byte-compile *byte-compile*))
(comf (vmdir "target:compiler/system") :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/char") :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/memory"))
(comf (vmdir "target:compiler/static-fn"))
(comf (vmdir "target:compiler/arith"))
(comf (vmdir "target:compiler/subprim") :byte-compile *byte-compile*)
ram's avatar
ram committed

(comf (vmdir "target:compiler/debug") :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/c-call") :byte-compile *byte-compile*)
(when (c:target-featurep :x86)
  (comf (vmdir "target:compiler/sse2-c-call")
	:byte-compile *byte-compile*))
(when (c:target-featurep :alien-callback)
  (comf (vmdir "target:compiler/c-callback")))
(comf (vmdir "target:compiler/cell"))
(comf (vmdir "target:compiler/values") :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/alloc"))
(comf (vmdir "target:compiler/call"))
(comf (vmdir "target:compiler/nlx") :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/print") :byte-compile *byte-compile*)

;; Must come before array.lisp because array.lisp wants to use some
;; vops as templates.
(when (c:target-featurep :x86)
  (comf (vmdir "target:compiler/sse2-array")
	:byte-compile *byte-compile*))

(comf (vmdir "target:compiler/array") :byte-compile *byte-compile*)
(comf (vmdir "target:compiler/pred"))
(comf (vmdir "target:compiler/type-vops") :byte-compile *byte-compile*)

(comf (vmdir "target:assembly/assem-rtns") :byte-compile *byte-compile*)
(comf (vmdir "target:assembly/array") :byte-compile *byte-compile*)
(comf (vmdir "target:assembly/arith"))
(comf (vmdir "target:assembly/alloc"))
wlott's avatar
wlott committed

(comf "target:compiler/pseudo-vops")

); with-compilation-unit for back end.
(comf "target:compiler/aliencomp" :byte-compile *byte-compile*)
ram's avatar
ram committed

(comf "target:compiler/ltv")
(comf "target:compiler/gtn")
    (:optimize '(optimize (debug 2)))
(comf "target:compiler/stack")
(comf "target:compiler/control")
(comf "target:compiler/entry")
    (:optimize '(optimize (debug 2)))
wlott's avatar
wlott committed
  (comf "target:compiler/ir2tran")
  (comf "target:compiler/generic/vm-ir2tran"))
(comf "target:compiler/copyprop")
    (:optimize '(optimize (debug 2)))
  (comf "target:compiler/represent"))
(comf "target:compiler/generic/vm-tran")
    (:optimize '(optimize (debug 2)))
(comf "target:compiler/codegen")
(with-compilation-unit
ram's avatar
ram committed
    (:optimize '(optimize (debug 2) (safety 2)))
  (comf "target:compiler/debug" :byte-compile *byte-compile*)
  (comf "target:compiler/xref" :byte-compile *byte-compile*))
(comf "target:compiler/statcount")
(comf "target:compiler/dyncount")

(comf "target:compiler/dump")

(comf "target:compiler/generic/core")
(comf "target:compiler/generic/new-genesis")

(comf "target:compiler/eval-comp")
(comf "target:compiler/eval")
ram's avatar
ram committed
(comf "target:compiler/byte-comp")
wlott's avatar
wlott committed

); with-compiler-error-log