[RFC 07/14] Use define-macro in rtl.scm
Tom Tromey <[email protected]> Sat, 19 Aug 2023 11:42:06 -0600
| Newsgroups | gmane.comp.tools.cgen.devel |
|---|---|
| Message-ID | <[email protected]> |
rtl.scm uses defmacro:syntax-transformer, but that no longer exists in
more recent versions of Guile.
Replace these uses with define-macro -- which IMO is clearer anyway.
Note that defmacro could not be used here, as Guile's implementation
has a bug that prevents it from being used with non-canonical lists.
---
rtl.scm | 37 +++++++++++++------------------------
1 file changed, 13 insertions(+), 24 deletions(-)
diff --git a/rtl.scm b/rtl.scm
index c74fea1..beda406 100644
--- a/rtl.scm
+++ b/rtl.scm
@@ -283,12 +283,9 @@
*UNSPECIFIED*))
)
-(define define-rtx-node
- ; Written this way so Hobbit can handle it.
- (defmacro:syntax-transformer (lambda arg-list
- (apply def-rtx-node arg-list)
- nil))
-)
+(define-macro (define-rtx-node . args)
+ (cons 'def-rtx-node
+ (map (lambda (arg) `',arg) args)))
; Same as define-rtx-node but don't pre-evaluate the arguments.
; Remember that `mode' must be the first argument.
@@ -314,12 +311,9 @@
*UNSPECIFIED*))
)
-(define define-rtx-syntax-node
- ; Written this way so Hobbit can handle it.
- (defmacro:syntax-transformer (lambda arg-list
- (apply def-rtx-syntax-node arg-list)
- nil))
-)
+(define-macro (define-rtx-syntax-node . args)
+ (cons 'def-rtx-syntax-node
+ (map (lambda (arg) `',arg) args)))
; Same as define-rtx-node but return an operand (usually an <operand> object).
; ??? `mode' must be the first argument?
@@ -345,12 +339,9 @@
*UNSPECIFIED*))
)
-(define define-rtx-operand-node
- ; Written this way so Hobbit can handle it.
- (defmacro:syntax-transformer (lambda arg-list
- (apply def-rtx-operand-node arg-list)
- nil))
-)
+(define-macro (define-rtx-operand-node . args)
+ (cons 'def-rtx-operand-node
+ (map (lambda (arg) `',arg) args)))
; Convert one rtx expression into another.
; NAME-ARGS is a list of the operation name and arguments.
@@ -374,12 +365,10 @@
*UNSPECIFIED*))
)
-(define define-rtx-macro-node
- ; Written this way so Hobbit can handle it.
- (defmacro:syntax-transformer (lambda arg-list
- (apply def-rtx-macro-node arg-list)
- nil))
-)
+(define-macro (define-rtx-macro-node . args)
+ (cons 'def-rtx-macro-node
+ (map (lambda (arg) `',arg) args)))
+
; RTL macro expansion.
; RTL macros are different than pmacros. The difference is that the expansion
--
2.41.0