]> sourceware.org Git - cgen.git/commitdiff
Change internal representation of rtx attribute values.
authorDoug Evans <xdje42@gmail.com>
Sun, 25 Oct 2009 16:30:42 +0000 (16:30 +0000)
committerDoug Evans <xdje42@gmail.com>
Sun, 25 Oct 2009 16:30:42 +0000 (16:30 +0000)
* attr.scm (/attr-val-is-rtx?): New function.
(attr-value): Call it.
(atlist-attr-value-no-default, attr-lookup-default): Ditto.

ChangeLog
attr.scm

index d9f08644762f8360f78379a6191df1a08aa32c2b..ff4690bcc81f495280f47a6bcf8ca4111e592f9b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-25  Doug Evans  <dje@sebabeach.org>
+
+       Change internal representation of rtx attribute values.
+       * attr.scm (/attr-val-is-rtx?): New function.
+       (attr-value): Call it.
+       (atlist-attr-value-no-default, attr-lookup-default): Ditto.
+
 2009-10-24  Doug Evans  <dje@sebabeach.org>
 
        * gen-all-doc: Add sh.cpu.
index dab76339f2725f35cbe77afb068776c4511efc9a..24297b0eb6df5739c17cc55d1651a63b0b70dbf9 100644 (file)
--- a/attr.scm
+++ b/attr.scm
 
 (define (enum-attr-make name value) (cons name value))
 
-;;; Return a procedure to parse an attribute.
-;;; RIGHT-TYPE? is a procedure that verifies the value is the right type.
-;;; MESSAGE is printed if there is an error.
+;; Return a procedure to parse an attribute.
+;; RIGHT-TYPE? is a procedure that verifies the value is the right type.
+;; MESSAGE is printed if there is an error.
+;; The result of the parsed attribute is (name . value).
 
 (define (/parse-simple-attribute right-type? message)
   (lambda (self context val)
   (send atlist 'attr-present? attr)
 )
 
+;; Return #t if attribute value VAL is an rtx expression.
+;; RTXs in attributes are recorded as a list of one element
+;; which is the rtx.
+;; I.e., ((rtx foo bar)).
+
+(define (/attr-val-is-rtx? val)
+  (and (pair? val)
+       (null? (cdr val))
+       (pair? (car val))) ;; pair? -> cheap non-null-list?
+)
+
 ; Expand attribute value ATVAL, which is an rtx expression.
 ; OWNER is the containing object or #f if there is none.
 ; OWNER is needed if an attribute is defined in terms of other attributes.
 (define (attr-value alist attr owner)
   (let ((a (assq-ref alist attr)))
     (if a
-       (if (pair? a) ; pair? -> cheap non-null-list?
+       (if (/attr-val-is-rtx? a)
            (/attr-eval a owner)
            a)
        (attr-lookup-default attr owner)))
 (define (atlist-attr-value-no-default atlist attr owner)
   (let ((a (assq-ref (atlist-attrs atlist) attr)))
     (if a
-       (if (pair? a) ; pair? -> cheap non-null-list?
+       (if (/attr-val-is-rtx? a)
            (/attr-eval a owner)
            a)
        nil))
            #f
            (let ((deflt (attr-default at)))
              (if deflt
-                 (if (pair? deflt) ; pair? -> cheap non-null-list?
+                 (if (/attr-val-is-rtx? deflt)
                      (/attr-eval deflt owner)
                      deflt)
                  ; If no default was provided, use the first value.
This page took 0.036434 seconds and 5 git commands to generate.