From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 028933858D28 for ; Tue, 22 Aug 2023 19:05:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 028933858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYWgW-0005PH-0J; Tue, 22 Aug 2023 15:05:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=qWsJOWKrpErDNyBYH7VWlxgN7Ep3jB/fg7D9RbKUs/c=; b=ZVnw4Pr7sQP1gXiL7w3v woLhGXz3Wel5ZHVObt5IJihtHYMXCYhqvSSVHev7GWPaocgBqAJuI+IZUb8sO+k77Cmdc3B4KkQgI m0xP8vJD8jF9H/mhYm/BgTS/Xa6fKwzhsHEHgtDfF+U2yVwntaPG65ciI+IcqmkVZQDBttAyEMOSL k07WCBtlzGMI0zaOT/Xjfv8+MHerr0iVvu7kEOERzAFMQvg0J7ixwr7w941Kl6JmzCep2F27nF9p7 kWWblO1AqJIjvuMukIskXQraUJzxCxXW4wOOqyDM05lvYWeK7Hofq7eeSGuj/QJtqQzYIkef+XKut QLUcfQ5TRgQCew==; From: "Jose E. Marchesi" To: Tom Tromey Cc: cgen@sourceware.org Subject: Re: [PATCH] Enable the Guile compiler In-Reply-To: <20230822185153.1291550-1-tom@tromey.com> (Tom Tromey's message of "Tue, 22 Aug 2023 12:51:53 -0600") References: <20230822185153.1291550-1-tom@tromey.com> Date: Tue, 22 Aug 2023 21:04:26 +0200 Message-ID: <875y56gapx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_ASCII_DIVIDERS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Tom. > This patch changes cgen so that the Guile compiler can be used. > Mainly this is done by using eval-when to ensure that files are loaded > during the compilation process. However, "-s" handling and > srcdir-setting are also cleaned up, using Guile's (current-filename) > feature. > > The main benefit of using the compiler is that it is much faster, once > the scripts have been compiled. Also it simplifies the use of cgen, > as users don't need to remember to set an environment variable before > invoking it. Does this work with the current way binutils Makefiles use to invoke cgen, or it needs an accompanying binutils patch? > --- > cgen-doc.scm | 47 +++++------------------------- > cgen-gas.scm | 56 +++++++++-------------------------- > cgen-intrinsics.scm | 47 +++++------------------------- > cgen-opc.scm | 55 ++++++++--------------------------- > cgen-sid.scm | 51 +++++++------------------------- > cgen-sim.scm | 53 +++++++-------------------------- > cgen-stest.scm | 57 ++++++++++-------------------------- > cgen-testsuite.scm | 49 +++++++------------------------ > dev-utils.scm | 4 +-- > dev.scm | 10 +++---- > guile.scm | 2 -- > read.scm | 71 +++++++++++++++++++++++---------------------- > 12 files changed, 131 insertions(+), 371 deletions(-) > > diff --git a/cgen-doc.scm b/cgen-doc.scm > index 83af463..5aa751b 100644 > --- a/cgen-doc.scm > +++ b/cgen-doc.scm > @@ -2,18 +2,16 @@ > ; This is invoked to build: $arch.html. > ; Copyright (C) 2003, 2009 Doug Evans > ; This file is part of CGEN. > -; > -; This is a standalone script, we don't load anything until we parse the > -; -s argument (keeps reliance off of environment variables, etc.). > > -; Load the various support routines. > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/desc.scm")) > - (load (string-append srcdir "/desc-cpu.scm")) > - (load (string-append srcdir "/html.scm")) > -) > + (load-from-path "read") > + (load-from-path "desc") > + (load-from-path "desc-cpu") > + (load-from-path "html")) > > (define doc-arguments > (list > @@ -29,40 +27,11 @@ > ) > ) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-doc argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-gas.scm b/cgen-gas.scm > index 3d33e92..1e12819 100644 > --- a/cgen-gas.scm > +++ b/cgen-gas.scm > @@ -5,19 +5,20 @@ > ; This is invoked to build several .s files and a "build script", > ; which generates the .d files and .exp DejaGNU test case. > > -; Load the various support routines. > - > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/desc.scm")) > - (load (string-append srcdir "/desc-cpu.scm")) > - (load (string-append srcdir "/opcodes.scm")) > - (load (string-append srcdir "/opc-asmdis.scm")) > - (load (string-append srcdir "/opc-ibld.scm")) > - (load (string-append srcdir "/opc-itab.scm")) > - (load (string-append srcdir "/opc-opinst.scm")) > - (load (string-append srcdir "/gas-test.scm")) > -) > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > + > + (load-from-path "read") > + (load-from-path "desc") > + (load-from-path "desc-cpu") > + (load-from-path "opcodes") > + (load-from-path "opc-asmdis") > + (load-from-path "opc-ibld") > + (load-from-path "opc-itab") > + (load-from-path "opc-opinst") > + (load-from-path "gas-test")) > > (define gas-arguments > (list > @@ -30,40 +31,11 @@ > ) > ) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-gas argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-intrinsics.scm b/cgen-intrinsics.scm > index 16e0338..1e5f882 100644 > --- a/cgen-intrinsics.scm > +++ b/cgen-intrinsics.scm > @@ -6,19 +6,15 @@ > ; > ; Copyright (C) 2000, 2009 Red Hat, Inc. > ; This file is part of CGEN. > -; > -; This is a standalone script, we don't load anything until we parse the > -; -s argument (keeps reliance off of environment variables, etc.). > - > -; Load the various support routines. > > -(define (load-files srcdir) > - ; Fix up Scheme to be what we use (guile is always in flux). > - (primitive-load-path (string-append srcdir "/guile.scm")) > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/intrinsics.scm")) > -) > + (load-from-path "guile") > + (load-from-path "read") > + (load-from-path "intrinsics")) > > (define intrinsics-isas '()) > > @@ -38,40 +34,11 @@ > (list "-T" "file" "generate intrinsic-testsuite.c in " #f > (lambda (arg) (file-write arg intrinsic-testsuite.c))))) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-intrinsics argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-opc.scm b/cgen-opc.scm > index 276fdb8..cac5115 100644 > --- a/cgen-opc.scm > +++ b/cgen-opc.scm > @@ -3,22 +3,20 @@ > ; $arch-opc.h, $arch-opc.c, $arch-asm.in, $arch-dis.in, and $arch-ibld.[ch]. > ; Copyright (C) 2000, 2009 Red Hat, Inc. > ; This file is part of CGEN. > -; > -; This is a standalone script, we don't load anything until we parse the > -; -s argument (keeps reliance off of environment variables, etc.). > > -; Load the various support routines. > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/desc.scm")) > - (load (string-append srcdir "/desc-cpu.scm")) > - (load (string-append srcdir "/opcodes.scm")) > - (load (string-append srcdir "/opc-asmdis.scm")) > - (load (string-append srcdir "/opc-ibld.scm")) > - (load (string-append srcdir "/opc-itab.scm")) > - (load (string-append srcdir "/opc-opinst.scm")) > -) > + (load-from-path "read") > + (load-from-path "desc") > + (load-from-path "desc-cpu") > + (load-from-path "opcodes") > + (load-from-path "opc-asmdis") > + (load-from-path "opc-ibld") > + (load-from-path "opc-itab") > + (load-from-path "opc-opinst")) > > (define opc-arguments > (list > @@ -60,40 +58,11 @@ > ; ((-R) (file-write *arg* cgen-reloc.c)) > ; ((-S) (file-write *arg* cgen-bfdcpu.c)) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-opc argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-sid.scm b/cgen-sid.scm > index bb74a7b..ab9e505 100644 > --- a/cgen-sid.scm > +++ b/cgen-sid.scm > @@ -3,20 +3,18 @@ > ; semantics.cxx, sem-switch.cxx, model.h, model.cxx > ; Copyright (C) 2000, 2003, 2009 Red Hat, Inc. > ; This file is part of CGEN. > -; > -; This is a standalone script, we don't load anything until we parse the > -; -s argument (keeps reliance off of environment variables, etc.). > > -; Load the various support routines. > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/utils-sim.scm")) > - (load (string-append srcdir "/sid.scm")) > - (load (string-append srcdir "/sid-cpu.scm")) > - (load (string-append srcdir "/sid-model.scm")) > - (load (string-append srcdir "/sid-decode.scm")) > -) > + (load-from-path "read") > + (load-from-path "utils-sim") > + (load-from-path "sid") > + (load-from-path "sid-cpu") > + (load-from-path "sid-model") > + (load-from-path "sid-decode")) > > (define sim-arguments > (list > @@ -53,40 +51,11 @@ > ) > ) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-sim argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-sim.scm b/cgen-sim.scm > index 2b9f962..ec7b84c 100644 > --- a/cgen-sim.scm > +++ b/cgen-sim.scm > @@ -6,21 +6,19 @@ > ; > ; Copyright (C) 2000, 2009 Red Hat, Inc. > ; This file is part of CGEN. > -; > -; This is a standalone script, we don't load anything until we parse the > -; -s argument (keeps reliance off of environment variables, etc.). > > -; Load the various support routines. > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/utils-sim.scm")) > - (load (string-append srcdir "/sim.scm")) > - (load (string-append srcdir "/sim-arch.scm")) > - (load (string-append srcdir "/sim-cpu.scm")) > - (load (string-append srcdir "/sim-model.scm")) > - (load (string-append srcdir "/sim-decode.scm")) > -) > + (load-from-path "read") > + (load-from-path "utils-sim") > + (load-from-path "sim") > + (load-from-path "sim-arch") > + (load-from-path "sim-cpu") > + (load-from-path "sim-model") > + (load-from-path "sim-decode")) > > (define sim-arguments > (list > @@ -81,40 +79,11 @@ > ) > ) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-sim argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-stest.scm b/cgen-stest.scm > index 10f62a8..7214f82 100644 > --- a/cgen-stest.scm > +++ b/cgen-stest.scm > @@ -6,18 +6,22 @@ > ; generate the .d files and .exp file. > ; This is invoked to build: tmp-build.sh cpu-cpu.exp > > -; Load the various support routines > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/desc.scm")) > - (load (string-append srcdir "/desc-cpu.scm")) > - (load (string-append srcdir "/opcodes.scm")) > - (load (string-append srcdir "/opc-asmdis.scm")) > - (load (string-append srcdir "/opc-ibld.scm")) > - (load (string-append srcdir "/opc-itab.scm")) > - (load (string-append srcdir "/opc-opinst.scm")) > - (load (string-append srcdir "/sim-test.scm")) > -) > +(use-modules (ice-9 slib)) > + > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > + > + (load-from-path "read") > + (load-from-path "desc") > + (load-from-path "desc-cpu") > + (load-from-path "opcodes") > + (load-from-path "opc-asmdis") > + (load-from-path "opc-ibld") > + (load-from-path "opc-itab") > + (load-from-path "opc-opinst") > + (load-from-path "sim-test")) > > (define stest-arguments > (list > @@ -30,40 +34,11 @@ > ) > ) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-stest argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/cgen-testsuite.scm b/cgen-testsuite.scm > index 0c37be3..ae78cff 100644 > --- a/cgen-testsuite.scm > +++ b/cgen-testsuite.scm > @@ -1,18 +1,18 @@ > ; CGEN testsuite driver. > ; Copyright (C) 2009 Doug Evans > ; This file is part of CGEN. > -; > -; This is a standalone script, we don't load anything until we parse the > -; -s argument (keeps reliance off of environment variables, etc.). > > -; Load the various support routines. > +(eval-when (expand load eval) > + ;; Kept global so it's available to the other .scm files. > + (define srcdir (dirname (current-filename))) > + (add-to-load-path srcdir) > > -(define (load-files srcdir) > - (load (string-append srcdir "/read.scm")) > - (load (string-append srcdir "/desc.scm")) > - (load (string-append srcdir "/desc-cpu.scm")) > - (load (string-append srcdir "/testsuite.scm")) > -) > + (use-modules (ice-9 slib)) > + > + (load-from-path "read") > + (load-from-path "desc") > + (load-from-path "desc-cpu") > + (load-from-path "testsuite")) > > (define testsuite-arguments > (list > @@ -22,40 +22,11 @@ > ) > ) > > -; Kept global so it's available to the other .scm files. > -(define srcdir ".") > - > -; Scan argv for -s srcdir. > -; We can't process any other args until we find the cgen source dir. > -; The result is srcdir. > -; We assume "-s" isn't the argument to another option. Unwise, yes. > -; Alternatives are to require it to be the first argument or at least preceed > -; any option with a "-s" argument, or to put knowledge of the common argument > -; set and common argument parsing code in every top level file. > - > -(define (find-srcdir argv) > - (let loop ((argv argv)) > - (if (null? argv) > - (error "`-s srcdir' not present, can't load cgen")) > - (if (string=? "-s" (car argv)) > - (begin > - (if (null? (cdr argv)) > - (error "missing srcdir arg to `-s'")) > - (cadr argv)) > - (loop (cdr argv)))) > -) > - > ; Main routine, parses options and calls generators. > > (define (cgen-testsuite argv) > (let () > > - ; Find and set srcdir, then load all Scheme code. > - ; Drop the first argument, it is the script name (i.e. argv[0]). > - (set! srcdir (find-srcdir (cdr argv))) > - (set! %load-path (cons srcdir %load-path)) > - (load-files srcdir) > - > (display-argv argv) > > (cgen #:argv argv > diff --git a/dev-utils.scm b/dev-utils.scm > index 89c1ee1..fe7cd7a 100644 > --- a/dev-utils.scm > +++ b/dev-utils.scm > @@ -6,8 +6,8 @@ > ;; 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 srcdir (dirname (current-filename))) > +(add-to-load-path srcdir) > > (define (load-doc) > (load "read") > diff --git a/dev.scm b/dev.scm > index 2b31688..12be288 100644 > --- a/dev.scm > +++ b/dev.scm > @@ -6,11 +6,11 @@ > ; This file is loaded in during an interactive guile session to > ; 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") > - > -(load "dev-utils.scm") > +(eval-when (expand load eval) > + ;; First load guile.scm to coerce guile into something we've been using. > + ;; Guile is always in flux. > + (load-from-path "guile") > + (load-from-path "dev-utils")) > > ; Also defined in read.scm, but we need it earlier. > (define APPLICATION 'UNKNOWN) > diff --git a/guile.scm b/guile.scm > index 5899f15..274264a 100644 > --- a/guile.scm > +++ b/guile.scm > @@ -6,8 +6,6 @@ > (define (eval1 expr) > (eval expr (current-module))) > > -(define load primitive-load-path) > - > (define %stat stat) > > (debug-enable 'backtrace) > diff --git a/read.scm b/read.scm > index e6c2bde..392e7ba 100644 > --- a/read.scm > +++ b/read.scm > @@ -62,41 +62,42 @@ > > ;; Variables representing misc. global constants. > > -;; Load the base cgen files. > - > -(load "pmacros") > -(load "cos") > -(load "slib/logical") > -(load "slib/sort") > -;; Used to pretty-print debugging messages. > -(load "slib/pp") > -;; Used by pretty-print. > -(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") > +(eval-when (expand load eval) > + ;; Load the base cgen files. > + > + (load-from-path "pmacros") > + (load-from-path "cos") > + (load-from-path "slib/logical") > + (load-from-path "slib/sort") > + ;; Used to pretty-print debugging messages. > + (load-from-path "slib/pp") > + ;; Used by pretty-print. > + (load-from-path "slib/random") > + (load-from-path "slib/genwrite") > + (load-from-path "utils") > + (load-from-path "utils-cgen") > + (load-from-path "attr") > + (load-from-path "enum") > + (load-from-path "mach") > + (load-from-path "model") > + (load-from-path "types") > + (load-from-path "mode") > + (load-from-path "ifield") > + (load-from-path "iformat") > + (load-from-path "hardware") > + (load-from-path "operand") > + (load-from-path "insn") > + (load-from-path "minsn") > + (load-from-path "decode") > + (load-from-path "rtl") > + (load-from-path "rtl-traverse") > + (load-from-path "rtl-xform") > + (load-from-path "rtx-funcs") > + (load-from-path "rtl-c") > + (load-from-path "semantics") > + (load-from-path "sem-frags") > + (load-from-path "utils-gen") > + (load-from-path "pgmr-tools")) > > ;; A list of three numbers designating the cgen version: major minor fixlevel. > ;; The "50" is a generic indicator that we're between 1.1 and 1.2.