This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Patch] Emit a defs.h file


The following patch represents a first step in separating the ISA-specific
definitions from cpu.h into a defs.h file that can be prefixed (or suffixed,
as Makefiles may dictate) with a qualifiying string.

These changes do not alter the generation of cpu.h when run without the
"with-multiple-isa?" option because I don't think it makes sense to
drastically alter the output files for single-ISA ports.

There are also corresponding sim/ directory Makefile changes to activate
this new option.  I will send them to gdb-patches@.

Could someone else please review these patches and approve them?  Would be
grateful for any feedback.  Thanks.


2000-11-25 Ben Elliston <bje@redhat.com>

        * sim-cpu.scm (cgen-cpu.h): Only emit argbuf, scache and extract
        definitions if run without with-multipla-isa?.
        (cgen-defs.h): New function. Emit an ISA-specific defs file.
        * cgen-sim.scm (sim-arguments): Accept -G option to generate defs.

--- cgen-sim.scm	2000/07/27 04:53:31	1.19
+++ cgen-sim.scm	2000/11/25 01:41:40
@@ -1,6 +1,6 @@
 ; Simulator generator entry point.
 ; This is invoked to build: arch.h, cpu-<cpu>.h, memops.h, semops.h, decode.h,
-; decode.c, extract.c, semantics.c, ops.c, model.c, mainloop.in.
+; decode.c, defs.h, extract.c, semantics.c, ops.c, model.c, mainloop.in.
 ;
 ; memops.h, semops.h, ops.c, mainloop.in are either deprecated or wip.
 ;
@@ -39,6 +39,8 @@
 	 (lambda (arg) (file-write arg cgen-cpuall.h)))
    (list '-F "file" "generate memops.h in <file>"
 	 (lambda (arg) (file-write arg cgen-mem-ops.h)))
+   (list '-G "file" "generate defs.h in <file>"
+	 (lambda (arg) (file-write arg cgen-defs.h)))
    (list '-P "file" "generate semops.h in <file>"
 	 (lambda (arg) (file-write arg cgen-sem-ops.h)))
    (list '-T "file" "generate decode.h in <file>"

--- sim-cpu.scm	2000/11/24 02:21:08	1.59
+++ sim-cpu.scm	2000/11/25 01:41:42
@@ -823,14 +823,50 @@
    -gen-hardware-types
    -gen-cpu-reg-access-decls
    -gen-model-decls
-   (lambda () (gen-argbuf-type #t))
-   (lambda () (gen-scache-type #t))
-   -gen-extract-macros
+
+   (if (not (with-multiple-isa?))
+     (string-list
+       (lambda () (gen-argbuf-type #t))
+       (lambda () (gen-scache-type #t))
+       -gen-extract-macros)
+     "")
+
    (if (and (with-parallel?) (not (with-generic-write?)))
        -gen-parallel-exec-type
        "")
    -gen-trace-record-type
    "#endif /* CPU_@CPU@_H */\n"
+   )
+)
+
+; Generate defs-<isa>.h.
+
+(define (cgen-defs.h)
+  (logit 1 "Generating " (obj:name (current-isa)) " defs.h ...\n")
+
+  (sim-analyze-insns!)
+
+  ; Tell the rtl->c translator we're not the simulator.
+  ; ??? Minimizes changes in generated code until this is changed.
+  ; RTL->C happens for field decoding.
+  (rtl-c-config! #:rtl-cover-fns? #f)
+
+  (string-write
+   (gen-copyright (string-append
+		   "ISA definitions header for "
+		   (obj:name (current-isa))
+		   ".")
+		  CURRENT-COPYRIGHT CURRENT-PACKAGE)
+   "\
+#ifndef DEFS_@PREFIX@_H
+#define DEFS_@PREFIX@_H
+
+"
+   (lambda () (gen-argbuf-type #t))
+   (lambda () (gen-scache-type #t))
+   -gen-extract-macros
+
+   "#endif /* DEFS_@PREFIX@_H */\n"
    )
 )


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]