[RFC 13/14] Load macros before uses

Tom Tromey <[email protected]> Sat, 19 Aug 2023 11:42:12 -0600
Newsgroups gmane.comp.tools.cgen.devel
Message-ID <[email protected]>
This hoists the various calls to 'load' to an earlier spot in
read.scm.  Without this patch, the call to logit
/cmd-define-rtl-version would not be expanded, leading to a mysterious
error about trying to 'apply' a syntax transformer.  That is, this is
another situation where the old code assumed that macro expansion
could be interleaved with evaluation.
---
 read.scm | 72 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/read.scm b/read.scm
index 8856da0..e6c2bde 100644
--- a/read.scm
+++ b/read.scm
@@ -62,6 +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")
+
 ;; 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.
 (define /CGEN-VERSION '(1 1 50))
@@ -122,42 +158,6 @@
 ;; This is mostly for descriptive purposes.
 (define APPLICATION 'UNKNOWN)
 
-;; 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")
-
 ;; Reader state data.
 ;; All state regarding the reading of a .cpu file is kept in an object of
 ;; class <reader>.
-- 
2.41.0