1 ; CPU description file generator for the GAS testsuite.
2 ; Copyright (C) 2000, 2001, 2009 Red Hat, Inc.
3 ; This file is part of CGEN.
5 ; This is invoked to build several .s files and a "build script",
6 ; which generates the .d files and .exp DejaGNU test case.
8 ; 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 "/gas-test.scm"))
24 (list "-B" "file" "generate build script in <file>"
26 (lambda (arg) (file-write arg cgen-build.sh)))
27 (list "-E" "file" "generate allinsn.exp in <file>"
29 (lambda (arg) (file-write arg cgen-allinsn.exp)))
33 ; Kept global so it's available to the other .scm files.
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.
44 (define (find-srcdir argv)
45 (let loop ((argv argv))
47 (error "`-s srcdir' not present, can't load cgen"))
48 (if (string=? "-s" (car argv))
50 (if (null? (cdr argv))
51 (error "missing srcdir arg to `-s'"))
56 ; Main routine, parses options and calls generators.
58 (define (cgen-gas argv)
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))
71 #:arg-spec gas-arguments
73 #:finish gas-test-finish!
74 #:analyze gas-test-analyze!)
78 (cgen-gas (program-arguments))
80 ;; FIXME: cgen-all will generate the opcodes files, not what we want