OSDN Git Service

* dev-utils.scm: New file.
authordevans <devans>
Sat, 21 Nov 2009 18:34:05 +0000 (18:34 +0000)
committerdevans <devans>
Sat, 21 Nov 2009 18:34:05 +0000 (18:34 +0000)
* dev.scm (srcdir, load-doc, load-opc, load-gtest, load-sid,
load-sim, load-stest, load-testsuite): Moved to dev-utils.scm.
* read.scm (CHECK-LOADED?, libcpu.so, /loaded-file-list, /loaded-file?,
/loaded-file-record!, maybe-load): Delete.
Load cgen files directly instead of via maybe-load.

cgen/ChangeLog
cgen/dev-utils.scm [new file with mode: 0644]
cgen/dev.scm
cgen/read.scm

index 2b25132..245ab9f 100644 (file)
@@ -1,3 +1,12 @@
+2009-11-21  Doug Evans  <dje@sebabeach.org>
+
+       * dev-utils.scm: New file.
+       * dev.scm (srcdir, load-doc, load-opc, load-gtest, load-sid,
+       load-sim, load-stest, load-testsuite): Moved to dev-utils.scm.
+       * read.scm (CHECK-LOADED?, libcpu.so, /loaded-file-list, /loaded-file?,
+       /loaded-file-record!, maybe-load): Delete.
+       Load cgen files directly instead of via maybe-load.
+
 2009-11-14  Doug Evans  <dje@sebabeach.org>
 
        * rtl-traverse.scm (/rtx-canon): Flag an error for non-void
diff --git a/cgen/dev-utils.scm b/cgen/dev-utils.scm
new file mode 100644 (file)
index 0000000..89c1ee1
--- /dev/null
@@ -0,0 +1,77 @@
+;; CGEN Debugging support.
+;; Copyright (C) 2000, 2009 Red Hat, Inc.
+;; This file is part of CGEN.
+;; See file COPYING.CGEN for details.
+
+;; This file contains a collection of utilities for use when
+;; analyzing cpu files from Scheme.
+
+(define srcdir ".")
+(set! %load-path (cons srcdir %load-path))
+
+(define (load-doc)
+  (load "read")
+  (load "desc")
+  (load "desc-cpu")
+  (load "html")
+  ; ??? Necessary for the following case, dunno why.
+  ; bash$ guile -l dev.scm
+  ; guile> (load-doc)
+  ; guile> (cload #:arch "./cpu/m32r.cpu")
+  (set! APPLICATION 'DOC)
+)
+
+(define (load-opc)
+  (load "read")
+  (load "desc")
+  (load "desc-cpu")
+  (load "opcodes")
+  (load "opc-asmdis")
+  (load "opc-ibld")
+  (load "opc-itab")
+  (load "opc-opinst")
+  (set! APPLICATION 'OPCODES)
+)
+
+(define (load-gtest)
+  (load-opc)
+  (load "gas-test")
+  (set! APPLICATION 'GAS-TEST)
+)
+
+(define (load-sid)
+  (load "read")
+  (load "utils-sim")
+  (load "sid")
+  (load "sid-cpu")
+  (load "sid-model")
+  (load "sid-decode")
+  (set! APPLICATION 'SID-SIMULATOR)
+)
+
+(define (load-sim)
+  (load "read")
+  (load "desc")
+  (load "desc-cpu")
+  (load "utils-sim")
+  (load "sim")
+  (load "sim-arch")
+  (load "sim-cpu")
+  (load "sim-model")
+  (load "sim-decode")
+  (set! APPLICATION 'SIMULATOR)
+)
+
+(define (load-stest)
+  (load-opc)
+  (load "sim-test")
+  (set! APPLICATION 'SIM-TEST)
+)
+
+(define (load-testsuite)
+  (load "read")
+  (load "desc")
+  (load "desc-cpu")
+  (load "testsuite.scm")
+  (set! APPLICATION 'TESTSUITE)
+)
index 9dd95c0..2b31688 100644 (file)
@@ -4,35 +4,25 @@
 ; See file COPYING.CGEN for details.
 
 ; This file is loaded in during an interactive guile session to
-; develop and debug CGEN.  The user visible procs are:
-;
-; (use-c)
-; (load-opc)
-; (load-sim)
-; (load-sid)
-; (load-testsuite)
-; (cload #:arch path-to-cpu-file #:machs "mach-list" #:isas "isa-list"
-;        #:options "options" #:trace "trace-options")
-\f
+; develop and debug CGEN.
+
 ; First load guile.scm to coerce guile into something we've been using.
 ; Guile is always in flux.
 (load "guile.scm")
 
-(define srcdir ".")
-(set! %load-path (cons srcdir %load-path))
-
-; Utility to enable/disable compiled-in C code.
-
-(define (use-c) (set! CHECK-LOADED? #t))
-(define (no-c) (set! CHECK-LOADED? #f))
+(load "dev-utils.scm")
 
 ; Also defined in read.scm, but we need it earlier.
 (define APPLICATION 'UNKNOWN)
 
+(define dev-verbose-level 2)
+
 ; 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)
+  (set! verbose-level dev-verbose-level)
+
   (let ((cpu-file #f)
        (keep-mach "all")
        (keep-isa "all")
 (if (not (defined? 'CHECK-LOADED?))
     (define CHECK-LOADED? #f))
 
-(define (load-doc)
-  (load "read")
-  (load "desc")
-  (load "desc-cpu")
-  (load "html")
-  ; ??? Necessary for the following case, dunno why.
-  ; bash$ guile -l dev.scm
-  ; guile> (load-doc)
-  ; guile> (cload #:arch "./cpu/m32r.cpu")
-  (set! verbose-level 2)
-  (set! APPLICATION 'DOC)
-)
-
-(define (load-opc)
-  (load "read")
-  (load "desc")
-  (load "desc-cpu")
-  (load "opcodes")
-  (load "opc-asmdis")
-  (load "opc-ibld")
-  (load "opc-itab")
-  (load "opc-opinst")
-  (set! verbose-level 2)
-  (set! APPLICATION 'OPCODES)
-)
-
-(define (load-gtest)
-  (load-opc)
-  (load "gas-test")
-  (set! verbose-level 2)
-  (set! APPLICATION 'GAS-TEST)
-)
-
-(define (load-sid)
-  (load "read")
-  (load "utils-sim")
-  (load "sid")
-  (load "sid-cpu")
-  (load "sid-model")
-  (load "sid-decode")
-  (set! verbose-level 2)
-  (set! APPLICATION 'SID-SIMULATOR)
-)
-
-(define (load-sim)
-  (load "read")
-  (load "desc")
-  (load "desc-cpu")
-  (load "utils-sim")
-  (load "sim")
-  (load "sim-arch")
-  (load "sim-cpu")
-  (load "sim-model")
-  (load "sim-decode")
-  (set! verbose-level 2)
-  (set! APPLICATION 'SIMULATOR)
-)
-
-(define (load-stest)
-  (load-opc)
-  (load "sim-test")
-  (set! verbose-level 2)
-  (set! APPLICATION 'SIM-TEST)
-)
-
-(define (load-testsuite)
-  (load "read")
-  (load "desc")
-  (load "desc-cpu")
-  (load "testsuite.scm")
-  (set! verbose-level 2)
-  (set! APPLICATION 'TESTSUITE)
-)
-
 (display "
-First enable compiled in C code if desired.
-
-(use-c)
 
-Then choose the application via one of:
+First choose the application via one of:
 
 (load-doc)
 (load-opc)
@@ -212,7 +125,8 @@ Then choose the application via one of:
 
 Then load the .cpu file with:
 
-(cload #:arch \"path-to-cpu-file\" #:machs \"keep-mach\" #:isas \"keep-isa\" #:options \"options\" #:trace \"trace-options\")
+(cload #:arch \"path-to-cpu-file\" #:machs \"keep-mach\" #:isas \"keep-isa\"
+       #:options \"options\" #:trace \"trace-options\" #:diag \"diagnostic-options\")
 
 Only the #:arch parameter is mandatory, the rest are optional.
 
@@ -256,6 +170,12 @@ pmacros - trace pmacro expansion
 all - trace everything
 \n")
 
+(display "\
+diagnostic-options: (comma-separated list of options)
+iformat - do more diagnostics on instruction formats
+all - do all diagnostics
+\n")
+
 ; If ~/.cgenrc exists, load it.
 
 (let ((cgenrc (string-append (getenv "HOME") "/.cgenrc")))
index 25369c6..6e5dfe7 100644 (file)
 ; This is mostly for descriptive purposes.
 (define APPLICATION 'UNKNOWN)
 \f
-; Things are organized so that files can be compiled with Hobbit for
-; experimentation.  Thus we need one file that loads all the other files.
-; This is that file, though it would make sense to move the code in this
-; file to another.
-
-; If a routine to initialize compiled-in code is defined, run it.
-(if (defined? 'cgen-init-c) (cgen-init-c))
-
-; If this is set to #f, the file is always loaded.
-; Don't override any current setting, e.g. from dev.scm.
-(if (not (defined? 'CHECK-LOADED?))
-    (define CHECK-LOADED? #t))
-
-; Unlink file if we're reloaded (say in an interactive session).
-; Dynamic loading is enabled by setting LIBCPU.SO to the pathname of the .so.
-(if (and (defined? 'libcpu.so) (dynamic-object? libcpu.so))
-    (dynamic-unlink libcpu.so))
-(define libcpu.so #f)
-(if (and (defined? 'LIBCPU.SO)
-        (file-exists? LIBCPU.SO))
-    (set! libcpu.so (dynamic-link LIBCPU.SO))
-)
-
-; List of loaded files.
-
-(if (not (defined? '/loaded-file-list))
-    (define /loaded-file-list '()))
-
-; Return non-zero if FILE was loaded last time through.
-
-(define (/loaded-file? file)
-  (->bool (memq (string->symbol file) /loaded-file-list))
-)
-
-; Record FILE as compiled in.
-
-(define (/loaded-file-record! file)
-  (let ((file (string->symbol file)))
-    (if (not (memq file /loaded-file-list))
-       (set! /loaded-file-list (cons file /loaded-file-list))))
-)
-
-; Load FILE if SYM is not compiled in.
-
-(define (maybe-load file init-func sym)
-  ; Return non-#f if FUNC is present in DYNOBJ.
-  (define (dynamic-func? func dynobj)
-    (catch #t
-          (lambda () (dynamic-func func dynobj))
-          (lambda args #f))
-    )
-
-  (let ((init-func (string-append "init_" (if init-func init-func file))))
-    (cond ((and libcpu.so
-               (dynamic-func? init-func libcpu.so))
-          (dynamic-call init-func libcpu.so)
-          (display (string-append "Skipping " file ", dynamically loaded.\n")))
-         ((or (not CHECK-LOADED?)
-              (not (defined? sym))
-              (/loaded-file? file))
-          (/loaded-file-record! file)
-          (load file))
-         (else
-          (display (string-append "Skipping " file ", already loaded.\n")))))
-)
+;; Load the base cgen files.
 
-(maybe-load "pmacros" #f 'define-pmacro)
-(maybe-load "cos" #f 'make)
-(maybe-load "slib/logical" #f 'logical:logand)
-(maybe-load "slib/sort" #f 'sort)
+(load "pmacros")
+(load "cos")
+(load "slib/logical")
+(load "slib/sort")
 ; Used to pretty-print debugging messages.
-(maybe-load "slib/pp" #f 'pretty-print)
+(load "slib/pp")
 ; Used by pretty-print.
-(maybe-load "slib/random" #f 'random)
-(maybe-load "slib/genwrite" #f 'generic-write)
-(maybe-load "utils" #f 'logit)
-(maybe-load "utils-cgen" "utils_cgen" 'obj:name)
-(maybe-load "attr" #f '<attribute>)
-(maybe-load "enum" #f '<enum>)
-(maybe-load "mach" #f '<mach>)
-(maybe-load "model" #f '<model>)
-(maybe-load "types" #f '<scalar>)
-(maybe-load "mode" #f '<mode>)
-(maybe-load "ifield" #f '<ifield>)
-(maybe-load "iformat" #f '<iformat>)
-(maybe-load "hardware" #f '<hardware-base>)
-(maybe-load "operand" #f '<operand>)
-(maybe-load "insn" #f '<insn>)
-(maybe-load "minsn" #f '<macro-insn>)
-(maybe-load "decode" #f 'decode-build-table)
-(maybe-load "rtl" "rtl" '<rtx-func>)
-(maybe-load "rtl-traverse" "rtl_traverse" 'rtx-traverse)
-(maybe-load "rtl-xform" "rtx_simplify" 'rtx-simplify)
-(maybe-load "rtx-funcs" "rtx_funcs" 'def-rtx-funcs)
-(maybe-load "rtl-c" "rtl_c" '<c-expr>)
-(maybe-load "semantics" #f 'semantic-compile)
-(maybe-load "sem-frags" "sem_frags" 'gen-threaded-engine)
-(maybe-load "utils-gen" "utils_gen" 'attr-gen-decl)
-(maybe-load "pgmr-tools" "pgmr_tools" 'pgmr-pretty-print-insn-format)
+(load "slib/random")
+(load "slib/genwrite")
+(load "utils")
+(load "utils-cgen")
+(load "attr")
+(load "enum")
+(load "mach")
+(load "model")
+(load "types")
+(load "mode")
+(load "ifield")
+(load "iformat")
+(load "hardware")
+(load "operand")
+(load "insn")
+(load "minsn")
+(load "decode")
+(load "rtl")
+(load "rtl-traverse")
+(load "rtl-xform")
+(load "rtx-funcs")
+(load "rtl-c")
+(load "semantics")
+(load "sem-frags")
+(load "utils-gen")
+(load "pgmr-tools")
 \f
 ; Reader state data.
 ; All state regarding the reading of a .cpu file is kept in an object of