OSDN Git Service

* Makefile.am (OPTIONS): Define.
authordevans <devans>
Sat, 22 Aug 2009 23:41:05 +0000 (23:41 +0000)
committerdevans <devans>
Sat, 22 Aug 2009 23:41:05 +0000 (23:41 +0000)
(desc): Just generate <arch>-desc.[ch] files.
* Makefile.in: Regenerate.
* desc-cpu.scm (cgen-desc.h): Skip call to gen-extra-cpu.h if there's
no .opc file.
(cgen-desc.c): Similarly.
* gen-all-desc: New file.
* opcodes.scm (opc-file-provided?): New function.

cgen/ChangeLog
cgen/Makefile.am
cgen/Makefile.in
cgen/desc-cpu.scm
cgen/gen-all-desc [new file with mode: 0644]
cgen/opcodes.scm

index c896e31..a303e4b 100644 (file)
@@ -1,5 +1,14 @@
 2009-08-22  Doug Evans  <dje@sebabeach.org>
 
+       * Makefile.am (OPTIONS): Define.
+       (desc): Just generate <arch>-desc.[ch] files.
+       * Makefile.in: Regenerate.
+       * desc-cpu.scm (cgen-desc.h): Skip call to gen-extra-cpu.h if there's
+       no .opc file.
+       (cgen-desc.c): Similarly.
+       * gen-all-desc: New file.
+       * opcodes.scm (opc-file-provided?): New function.
+
        * mach.scm (current-*-add!): Update calls to parse-error.
        * operand.scm (op:new-mode): Update call to parse-error.
        * utils-cgen.scm (make-obj-context): New function.
index 4736482..208cd6a 100644 (file)
@@ -13,6 +13,9 @@ ARCHFILE = $(srcroot)/cpu/$(ARCH).cpu
 MACHS = all
 ISAS = all
 
+# file generation options
+OPTIONS =
+
 # for the html rule
 INSN_FILE_NAME = $(ARCH)-insn.html
 
@@ -40,12 +43,13 @@ stamp-cgen: $(CGENFILES)
 
 # Build the basic description support.
 # We just stuff them in tmp-* files.
-# Usage: make desc [ARCHFILE=<arch-file>] OPTIONS="<option list>"
+# Usage: make desc [ARCH=<arch>] [ARCHFILE=<arch-file>] OPTIONS="<option list>"
+#
+# -O tmp-opc.h -P tmp-opc.c -OPC $(dirname ${archfile})/${arch}.opc
 
 .PHONY: desc
-# FIXME: needs more dependencies
 desc: desc.scm
-       rm -f tmp-desc.h tmp-desc.c tmp-opinst.c
+       rm -f tmp-desc.h tmp-desc.c
        $(GUILE) $(srcdir)/cgen-opc.scm \
                -s $(srcdir) \
                $(CGENFLAGS) \
@@ -54,6 +58,8 @@ desc: desc.scm
                -i "$(ISAS)" \
                -m "$(MACHS)" \
                -H tmp-desc.h -C tmp-desc.c
+       $(SHELL) $(srcroot)/move-if-change tmp-desc.h $(ARCH)-desc.h
+       $(SHELL) $(srcroot)/move-if-change tmp-desc.c $(ARCH)-desc.c
 
 # Build the machine generated cpu documentation.
 # Usage: make html [ARCH=<arch>] [ARCHFILE=<arch-file>]
@@ -78,7 +84,6 @@ html: desc.scm html.scm cgen-doc.scm
 # Usage: make opcodes [ARCHFILE=<arch-file>] OPTIONS="<option list>"
 
 .PHONY: opcodes
-# FIXME: needs more dependencies
 opcodes: opcodes.scm
        rm -f tmp-opc.h tmp-itab.c
        rm -f tmp-asm.in tmp-dis.in tmp-ibld.h tmp-ibld.in
@@ -100,7 +105,6 @@ opcodes: opcodes.scm
 #          OPTIONS="<option list>"
 
 .PHONY: sim-arch sim-cpu
-# FIXME: needs more dependencies
 sim-arch: sim.scm
        rm -f tmp-arch.h tmp-arch.c tmp-cpuall.h
        $(GUILE) $(srcdir)/cgen-sim.scm \
index 284b790..a4080da 100644 (file)
@@ -146,6 +146,9 @@ ARCHFILE = $(srcroot)/cpu/$(ARCH).cpu
 MACHS = all
 ISAS = all
 
+# file generation options
+OPTIONS = 
+
 # for the html rule
 INSN_FILE_NAME = $(ARCH)-insn.html
 srcroot = $(srcdir)/..
@@ -434,12 +437,13 @@ stamp-cgen: $(CGENFILES)
 
 # Build the basic description support.
 # We just stuff them in tmp-* files.
-# Usage: make desc [ARCHFILE=<arch-file>] OPTIONS="<option list>"
+# Usage: make desc [ARCH=<arch>] [ARCHFILE=<arch-file>] OPTIONS="<option list>"
+#
+# -O tmp-opc.h -P tmp-opc.c -OPC $(dirname ${archfile})/${arch}.opc
 
 .PHONY: desc
-# FIXME: needs more dependencies
 desc: desc.scm
-       rm -f tmp-desc.h tmp-desc.c tmp-opinst.c
+       rm -f tmp-desc.h tmp-desc.c
        $(GUILE) $(srcdir)/cgen-opc.scm \
                -s $(srcdir) \
                $(CGENFLAGS) \
@@ -448,6 +452,8 @@ desc: desc.scm
                -i "$(ISAS)" \
                -m "$(MACHS)" \
                -H tmp-desc.h -C tmp-desc.c
+       $(SHELL) $(srcroot)/move-if-change tmp-desc.h $(ARCH)-desc.h
+       $(SHELL) $(srcroot)/move-if-change tmp-desc.c $(ARCH)-desc.c
 
 # Build the machine generated cpu documentation.
 # Usage: make html [ARCH=<arch>] [ARCHFILE=<arch-file>]
@@ -472,7 +478,6 @@ html: desc.scm html.scm cgen-doc.scm
 # Usage: make opcodes [ARCHFILE=<arch-file>] OPTIONS="<option list>"
 
 .PHONY: opcodes
-# FIXME: needs more dependencies
 opcodes: opcodes.scm
        rm -f tmp-opc.h tmp-itab.c
        rm -f tmp-asm.in tmp-dis.in tmp-ibld.h tmp-ibld.in
@@ -494,7 +499,6 @@ opcodes: opcodes.scm
 #          OPTIONS="<option list>"
 
 .PHONY: sim-arch sim-cpu
-# FIXME: needs more dependencies
 sim-arch: sim.scm
        rm -f tmp-arch.h tmp-arch.c tmp-cpuall.h
        $(GUILE) $(srcdir)/cgen-sim.scm \
index b0354c8..6efa7dd 100644 (file)
@@ -1002,7 +1002,10 @@ init_tables (void)
    -gen-mach-table-decls
    gen-hw-table-decls
    "\n"
-   (lambda () (gen-extra-cpu.h (opc-file-path) (current-arch-name)))
+   (lambda ()
+     (if (opc-file-provided?)
+        (gen-extra-cpu.h (opc-file-path) (current-arch-name))
+        ""))
    "
 
 #endif /* @ARCH@_CPU_H */
@@ -1035,7 +1038,10 @@ init_tables (void)
 #include \"libiberty.h\"
 #include \"xregex.h\"
 \n"
-   (lambda () (gen-extra-cpu.c (opc-file-path) (current-arch-name)))
+   (lambda ()
+     (if (opc-file-provided?)
+        (gen-extra-cpu.c (opc-file-path) (current-arch-name))
+        ""))
    gen-attr-table-defns
    -gen-isa-table-defns
    -gen-mach-table-defns
diff --git a/cgen/gen-all-desc b/cgen/gen-all-desc
new file mode 100644 (file)
index 0000000..501549b
--- /dev/null
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Utility script to generate basic description files for all ports.
+# The main purpose of this script is to have a script that will
+# exercise loading of all the ports.
+
+# Run this script in the src/cgen directory.
+
+# Exit on any error.
+set -e
+
+# For debugging.
+set -x
+
+# List of top-level .cpu files of all ports.
+# ??? Some are missing: ia32, ia64
+# Need to add them after some research.
+# NOTE: Some of these ports are incomplete.
+
+archs="
+cpu/fr30.cpu
+cpu/arm.cpu
+../cpu/cris.cpu
+../cpu/frv.cpu
+cpu/i960.cpu
+cpu/ip2k.cpu
+../cpu/iq2000.cpu
+../cpu/lm32.cpu
+../cpu/m32c.cpu
+../cpu/m32r.cpu
+cpu/m68k.cpu
+cpu/mep.cpu
+../cpu/mt.cpu
+cpu/openrisc.cpu
+cpu/powerpc.cpu
+../cpu/sh.cpu
+cpu/sparc.cpu
+../cpu/xc16x.cpu
+cpu/xstormy16.cpu
+"
+
+archs="$archs cpu/cyclops2.cpu"
+
+if [ ! -f opcodes.scm ]
+then
+    echo "Not in the src/cgen directory." >& 2
+    exit 1
+fi
+
+export builddir=tmp-desc
+
+rm -rf $builddir
+mkdir $builddir
+
+export cgendir=`pwd`
+
+(
+  set -e
+  set -x
+  cd $builddir
+  $cgendir/configure --prefix /tmp/junk --target m32r-elf
+
+  for a in $archs
+  do
+    archfile=../$a
+    arch=$(basename $archfile .cpu)
+
+    # FIXME: Seems like this shouldn't be needed.  Could be wrong though.
+    ISAS="all"
+    MACHS="all"
+    case $arch in
+    arm) ISAS="arm" ;;
+    sh) ISAS="media" ;;
+    sparc) MACHS="sparc-v9" ;; # FIXME: ugh, would rather select on isa
+    esac
+
+    if make desc ARCH=$arch ARCHFILE=$archfile ISAS="$ISAS" MACHS="$MACHS" \
+        CGENFLAGS='-b -v'
+    then
+        echo "File generation for $arch succeeded."
+    else
+        echo "ERROR: File generation for $arch failed."
+    fi
+  done
+)
index 5ed8891..5ed44ff 100644 (file)
   (set! -opc-file-path path)
 )
 
+; Return #t if the -OPC parameter was specified.
+
+(define (opc-file-provided?)
+  (and -opc-file-path #t)
+)
+
 ; Boolean indicating if we're to build the operand instance table.
 ; The default is no, since only the m32r uses it at present.
 ; ??? Simulator tracing support could use it.