OSDN Git Service

* rtl-c.scm (/use-gcc-stmt-expr?): New function.
[pf3gnuchains/pf3gnuchains4x.git] / cgen / cgen-stest.scm
1 ; CPU description file generator for the simulator testsuite.
2 ; Copyright (C) 2000, 2009 Red Hat, Inc.
3 ; This file is part of CGEN.
4
5 ; This is invoked to build several .s files and a script to run to
6 ; generate the .d files and .exp file.
7 ; This is invoked to build: tmp-build.sh cpu-cpu.exp
8 \f
9 ; Load the various support routines
10 (define (load-files srcdir)
11   (load (string-append srcdir "/read.scm"))
12   (load (string-append srcdir "/desc.scm"))
13   (load (string-append srcdir "/desc-cpu.scm"))
14   (load (string-append srcdir "/opcodes.scm"))
15   (load (string-append srcdir "/opc-asmdis.scm"))
16   (load (string-append srcdir "/opc-ibld.scm"))
17   (load (string-append srcdir "/opc-itab.scm"))
18   (load (string-append srcdir "/opc-opinst.scm"))
19   (load (string-append srcdir "/sim-test.scm"))
20 )
21
22 (define stest-arguments
23   (list
24    (list "-B" "file" "generate build.sh"
25          #f
26          (lambda (arg) (file-write arg cgen-build.sh)))
27    (list "-E" "file" "generate the testsuite .exp"
28          #f
29          (lambda (arg) (file-write arg cgen-allinsn.exp)))
30    )
31 )
32
33 ; Kept global so it's available to the other .scm files.
34 (define srcdir ".")
35
36 ; Scan argv for -s srcdir.
37 ; We can't process any other args until we find the cgen source dir.
38 ; The result is srcdir.
39 ; We assume "-s" isn't the argument to another option.  Unwise, yes.
40 ; Alternatives are to require it to be the first argument or at least preceed
41 ; any option with a "-s" argument, or to put knowledge of the common argument
42 ; set and common argument parsing code in every top level file.
43
44 (define (find-srcdir argv)
45   (let loop ((argv argv))
46     (if (null? argv)
47         (error "`-s srcdir' not present, can't load cgen"))
48     (if (string=? "-s" (car argv))
49         (begin
50           (if (null? (cdr argv))
51               (error "missing srcdir arg to `-s'"))
52           (cadr argv))
53         (loop (cdr argv))))     
54 )
55
56 ; Main routine, parses options and calls generators.
57
58 (define (cgen-stest argv)
59   (let ()
60
61     ; Find and set srcdir, then load all Scheme code.
62     ; Drop the first argument, it is the script name (i.e. argv[0]).
63     (set! srcdir (find-srcdir (cdr argv)))
64     (set! %load-path (cons srcdir %load-path))
65     (load-files srcdir)
66
67     (display-argv argv)
68
69     (cgen #:argv argv
70           #:app-name "sim-test"
71           #:arg-spec stest-arguments
72           #:init sim-test-init!
73           #:finish sim-test-finish!
74           #:analyze sim-test-analyze!)
75     )
76 )
77
78 (cgen-stest (program-arguments))
79
80 ;; FIXME: cgen-all will generate the opcodes files, not what we want