This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
[patch][commit] New (if (...) (...) (...)) Test Allowed at Top Level of the Input
- From: Dave Brolley <brolley at redhat dot com>
- To: cgen at sources dot redhat dot com
- Date: Wed, 10 May 2006 13:57:26 -0400
- Subject: [patch][commit] New (if (...) (...) (...)) Test Allowed at Top Level of the Input
Hi,
I've committed the attach patch. I allows the psecification of
(if (application-is? <appname>)
(true expr)
(false expr))
at the top level of the CGEN input. This test corresponds to (eq?
application <appname>) which is found in many places in the CGEN source.
For example
(if (application-is? SID-SIMULATOR)
(include "sid-macros.cpu")
(include "sim-macros.cpu"))
Dave
2006-05-10 Dave Brolley <brolley@redhat.com>
* read.scm (cmd-if): Provide the correct argument to reader-error. Add
support for (if (application-is? <appname>) (...) (...)).
Index: cgen/read.scm
===================================================================
RCS file: /cvs/src/src/cgen/read.scm,v
retrieving revision 1.13
diff -c -p -r1.13 read.scm
*** cgen/read.scm 10 May 2006 16:24:53 -0000 1.13
--- cgen/read.scm 10 May 2006 17:45:17 -0000
*************** Define a preprocessor-style macro.
*** 796,803 ****
(cons 'if (cons test (cons then else)))
""))
; ??? rtx-eval test
! (if (not (memq (car test) '(keep-isa? keep-mach?)))
! (reader-error "only (if (keep-mach?|keep-isa? ...) ...) is currently supported"))
(case (car test)
((keep-isa?)
(if (keep-isa? (cadr test))
--- 796,803 ----
(cons 'if (cons test (cons then else)))
""))
; ??? rtx-eval test
! (if (not (memq (car test) '(keep-isa? keep-mach? application-is?)))
! (reader-error "only (if (keep-mach?|keep-isa?|application-is? ...) ...) are currently supported" test ""))
(case (car test)
((keep-isa?)
(if (keep-isa? (cadr test))
*************** Define a preprocessor-style macro.
*** 810,815 ****
--- 810,821 ----
(eval1 then)
(if (null? else)
#f
+ (eval1 (car else)))))
+ ((application-is?)
+ (if (eq? APPLICATION (cadr test))
+ (eval1 then)
+ (if (null? else)
+ #f
(eval1 (car else))))))
)