.cpu file instead of just the name of the architecture.
* read.scm (arch-path): Remove trailing '/'.
(cpu-load): Set `arch-path' to directory of .cpu file.
(-cgen): Don't set `arch-path' here.
(include): Update.
* doc/porting.texi: Update.
+2009-06-18 Doug Evans <dje@sebabeach.org>
+
+ * dev.scm (cload): Change #:arch argument to take the path to the
+ .cpu file instead of just the name of the architecture.
+ * read.scm (arch-path): Remove trailing '/'.
+ (cpu-load): Set `arch-path' to directory of .cpu file.
+ (-cgen): Don't set `arch-path' here.
+ (include): Update.
+ * doc/porting.texi: Update.
+
2009-06-14 Doug Evans <dje@sebabeach.org>
* gen-all-doc: Use files in ../cpu where possible.
; (load-opc)
; (load-sim)
; (load-sid)
-; (cload #:arch arch #:machs "mach-list" #:isas "isa-list" #:options "options")
+; (cload #:arch path-to-cpu-file #:machs "mach-list" #:isas "isa-list" #:options "options")
\f
; First load guile.scm to coerce guile into something we've been using.
; Guile is always in flux.
; Supply the path name and suffic for the .cpu file and delete the analyzer
; arg from cpu-load to lessen the typing.
(define (cload . args)
- (let ((arch #f)
+ (let ((cpu-file #f)
(keep-mach "all")
(keep-isa "all")
(options ""))
#f ; done
(begin
(case (car args)
- ((#:arch) (set! arch (cadr args)))
+ ((#:arch) (set! cpu-file (cadr args)))
((#:machs) (set! keep-mach (cadr args)))
((#:isas) (set! keep-isa (cadr args)))
((#:options) (set! options (cadr args)))
(case APPLICATION
((UNKNOWN) (error "application not loaded"))
- ((DESC) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((DESC) (cpu-load cpu-file
keep-mach keep-isa options
desc-init!
desc-finish!
desc-analyze!))
- ((DOC) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((DOC) (cpu-load cpu-file
keep-mach keep-isa options
doc-init!
doc-finish!
doc-analyze!))
- ((OPCODES) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((OPCODES) (cpu-load cpu-file
keep-mach keep-isa options
opcodes-init!
opcodes-finish!
opcodes-analyze!))
- ((GAS-TEST) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((GAS-TEST) (cpu-load cpu-file
keep-mach keep-isa options
gas-test-init!
gas-test-finish!
gas-test-analyze!))
- ((SIMULATOR) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((SIMULATOR) (cpu-load cpu-file
keep-mach keep-isa options
sim-init!
sim-finish!
sim-analyze!))
- ((SID-SIMULATOR) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((SID-SIMULATOR) (cpu-load cpu-file
keep-mach keep-isa options
sim-init!
sim-finish!
sim-analyze!))
- ((SIM-TEST) (cpu-load (string-append "./cpu/" arch ".cpu")
+ ((SIM-TEST) (cpu-load cpu-file
keep-mach keep-isa options
sim-test-init!
sim-test-finish!
; ??? Necessary for the following case, dunno why.
; bash$ guile -l dev.scm
; guile> (load-doc)
- ; guile> (cload #:arch "m32r")
+ ; guile> (cload #:arch "./cpu/m32r.cpu")
(set! APPLICATION 'DOC)
)
Then load the .cpu file with:
-(cload #:arch \"arch\" #:machs \"keep-mach\" #:isas \"keep-isa\" #:options \"options\")
+(cload #:arch \"path-to-cpu-file\" #:machs \"keep-mach\" #:isas \"keep-isa\" #:options \"options\")
keep-mach:
comma separated list of machs to keep or `all'
@item Run @code{guile}.
@item @code{(load "dev.scm")}
@item Load application, e.g. @code{(load-opc)} or @code{(load-sim)}
-@item Load CPU description file, e.g. @code{(cload #:arch "m32r")}
+@item Load CPU description file, e.g. @code{(cload #:arch "cpu/m32r")}
@item Run generators until output looks reasonable, e.g. @code{(cgen-opc.c)}
@end enumerate
@example
(define (m32r-opc)
(load-opc)
- (cload #:arch "m32r")
+ (cload #:arch "cpu/m32r.cpu")
)
(define (m32r-sim)
(load-sim)
- (cload #:arch "m32r" #:options "with-scache with-profile=fn")
+ (cload #:arch "cpu/m32r.cpu" #:options "with-scache with-profile=fn")
)
(define (m32rbf-sim)
(load-sim)
- (cload #:arch "m32r" #:machs "m32r" #:options "with-scache with-profile=fn")
+ (cload #:arch "cpu/m32r.cpu" #:machs "m32r" #:options "with-scache with-profile=fn")
)
(define (m32rxf-sim)
(load-sim)
- (cload #:arch "m32r" #:machs "m32rx" #:options "with-scache with-profile=fn")
+ (cload #:arch "cpu/m32r.cpu" #:machs "m32rx" #:options "with-scache with-profile=fn")
)
@end example
@code{cload}. The syntax is:
@example
-(cload #:arch arch
+(cload #:arch "cpu-file-path"
[#:machs "mach-list"]
[#:isas "isa-list"]
[#:options "option-list"])
Only the @code{#:arch} argument is mandatory.
+@samp{cpu-file} is the path to the @file{.cpu} file.
+
@samp{mach-list} is a comma separated string of machines to keep.
@samp{isa-list} is a comma separated string of isas to keep.
@item The @file{.cpu} file is the main description file.
@item The @file{.opc} file provides additional C support code.
@end itemize
-@item @code{(cload #:arch "cpu/<arch>")}
+@item @code{(cload #:arch "cpu/<arch>.cpu")}
@item Run each of:
@itemize @bullet
@item @code{(cgen-desc.h)}
@item @code{(load "dev.scm")}
@item @code{(load-sim)}
@item Edit your @file{cpu/<arch>.cpu} file.
-@item @code{(cload #:arch "cpu/<arch>")}
+@item @code{(cload #:arch "cpu/<arch>.cpu")}
@item Run each of:
@itemize @bullet
@item @code{(cgen-arch.h)}
@end itemize
@item Repeat steps 4,5,6 until the output looks reasonable.
@item Edit your cpu/<arch>.cpu file.
-@item @code{(cload #:arch "cpu/<arch>" #:machs "mach1[,mach2[,...]]")}
+@item @code{(cload #:arch "cpu/<arch>.cpu" #:machs "mach1[,mach2[,...]]")}
@item Run each of:
@itemize @bullet
@item @code{(cgen-cpu.h)}
; Top level file for reading and recording .cpu file contents.
-; Copyright (C) 2000, 2001, 2006 Red Hat, Inc.
+; Copyright (C) 2000, 2001, 2006, 2009 Red Hat, Inc.
; This file is part of CGEN.
; See file COPYING.CGEN for details.
(reader-add-command! 'if
"(if test then . else)\n"
nil '(test then . else) cmd-if
-
)
; Rather than add cgen specific stuff to pmacros.scm, we create
)
; Install any builtin objects.
-; This is defered until define-arch is read.
+; This is deferred until define-arch is read.
; One reason is that attributes MACH and ISA don't exist until then.
(define (reader-install-builtin!)
; .cpu file include mechanism
(define (include file)
- (logit 1 "Including file " (string-append arch-path file) " ...\n")
- (reader-read-file! (string-append arch-path file))
+ (logit 1 "Including file " (string-append arch-path "/" file) " ...\n")
+ (reader-read-file! (string-append arch-path "/" file))
(logit 2 "Resuming previous file ...\n")
)
; ANALYZER! is a zero argument proc to call after loading the .cpu file.
; It is expected to set up various tables and things useful for the application
; in question.
+;
+; This function isn't local because it's used by dev.scm.
(define (cpu-load file keep-mach keep-isa options
app-initer! app-finisher! analyzer!)
(-init-parse-cpu! keep-mach keep-isa options)
(app-initer!)
(logit 1 "Loading cpu description " file "\n")
+ (set! arch-path (dirname file))
(reader-read-file! file)
(logit 2 "Processing cpu description " file "\n")
(-finish-parse-cpu!)
)
)
-(define arch-path (string-append srcdir "/cpu/"))
+; Default place to look.
+; This gets overridden to point to the directory of the loaded .cpu file.
+; ??? Ideally this would be local to this file.
+(define arch-path (string-append srcdir "/cpu"))
; Accessors for application option specs
(define (opt-get-first-pass opt)
(else
(cond ((str=? "-a" (car opt))
(set! arch-file arg)
- (set! arch-path (string-append (dirname arg) "/"))
)
((str=? "-b" (car opt))
(set! debugging #t)
)
; Main entry point called by application file generators.
+
(define cgen
(lambda args
(cgen-debugging-stack-start -cgen args))