OSDN Git Service

* utils-cgen.scm: Follow commenting convention.
authordevans <devans>
Sun, 24 Jan 2010 23:48:37 +0000 (23:48 +0000)
committerdevans <devans>
Sun, 24 Jan 2010 23:48:37 +0000 (23:48 +0000)
cgen/ChangeLog
cgen/utils-cgen.scm

index 0d660f7..36746b5 100644 (file)
@@ -2,6 +2,7 @@
 
        * cos.scm: Follow commenting convention.  Why did a single ; have to
        get indented like it does? :-(
+       * utils-cgen.scm: Ditto.
 
 2010-01-23  Doug Evans  <dje@sebabeach.org>
 
index 6851125..35b7402 100644 (file)
@@ -1,23 +1,23 @@
-; CGEN Utilities.
-; Copyright (C) 2000, 2002, 2003, 2009 Red Hat, Inc.
-; This file is part of CGEN.
-; See file COPYING.CGEN for details.
-;
-; This file contains utilities specific to cgen.
-; Generic utilities should go in utils.scm.
-
-; True if text of sanitize markers are to be emitted.
-; This is a debugging tool only, though it could have use in sanitized trees.
+;;CGEN Utilities.
+;;Copyright (C) 2000, 2002, 2003, 2009 Red Hat, Inc.
+;;This file is part of CGEN.
+;;See file COPYING.CGEN for details.
+;;
+;;This file contains utilities specific to cgen.
+;;Generic utilities should go in utils.scm.
+
+;;True if text of sanitize markers are to be emitted.
+;;This is a debugging tool only, though it could have use in sanitized trees.
 (define include-sanitize-marker? #t)
 
-; Utility to display command line invocation for debugging purposes.
+;;Utility to display command line invocation for debugging purposes.
 
 (define (display-argv argv)
   (let ((cep (current-error-port)))
     (display "cgen -s " cep)
     (for-each (lambda (arg)
-               ; Output double-quotes if string has a space for better
-               ; correspondence to how to specify string to shell.
+               ;; Output double-quotes if string has a space for better
+               ;; correspondence to how to specify string to shell.
                (if (string-index arg #\space)
                    (write arg cep)
                    (display arg cep))
     (newline cep))
 )
 \f
-; COS utilities.
-; Perhaps these should be provided with cos (cgen-object-system), but for
-; now they live here.
+;;COS utilities.
+;;Perhaps these should be provided with cos (cgen-object-system), but for
+;;now they live here.
 
-; Define the getter for a list of elements of a class.
+;;Define the getter for a list of elements of a class.
 
 (defmacro define-getters (class class-prefix elm-names)
   (cons 'begin
@@ -43,7 +43,7 @@
             elm-names))
 )
 
-; Define the setter for a list of elements of a class.
+;;Define the setter for a list of elements of a class.
 
 (defmacro define-setters (class class-prefix elm-names)
   (cons 'begin
@@ -56,8 +56,8 @@
             elm-names))
 )
 
-; Make an object, specifying values for particular elements.
-; ??? Eventually move to cos.scm/cos.c.
+;;Make an object, specifying values for particular elements.
+;;??? Eventually move to cos.scm/cos.c.
 
 (define (vmake class . args)
   (let ((obj (new class)))
   *UNSPECIFIED*
 )
 \f
-; Each named entry in the description file typically has these three members:
-; name, comment attrs.
+;;Each named entry in the description file typically has these three members:
+;;name, comment attrs.
 
 (define <ident> (class-make '<ident> '() '(name comment attrs) '()))
 
 (method-make! <ident> 'set-atlist!
              (lambda (self newval) (elm-set! self 'attrs newval)))
 
-; All objects defined in the .cpu file have these elements.
-; Where in the class hierarchy they're recorded depends on the object.
-; Additionally most objects have `name', `comment' and `attrs' elements.
+;;All objects defined in the .cpu file have these elements.
+;;Where in the class hierarchy they're recorded depends on the object.
+;;Additionally most objects have `name', `comment' and `attrs' elements.
 
 (define (obj:name obj) (send obj 'get-name))
 (define (obj-set-name! obj name) (send obj 'set-name! name))
 (define (obj:comment obj) (send obj 'get-comment))
 
-; Utility to return the name as a string.
+;;Utility to return the name as a string.
 
 (define (obj:str-name obj) (symbol->string (obj:name obj)))
 
               obj-list))
 )
 
-; Subclass of <ident> for use by description file objects.
-;
-; Records the source location of the object.
-;
-; We also record an internally generated entry, ordinal, to record the
-; relative position within the description file.  It's generally more efficient
-; to record some kinds of objects (e.g. insns) in a hash table.  But we also
-; want to emit these objects in file order.  Recording the object's relative
-; position lets us generate an ordered list when we need to.
-; We can't just use the line number because we want an ordering over multiple
-; input files.
+;;Subclass of <ident> for use by description file objects.
+;;
+;;Records the source location of the object.
+;;
+;;We also record an internally generated entry, ordinal, to record the
+;;relative position within the description file.  It's generally more efficient
+;;to record some kinds of objects (e.g. insns) in a hash table.  But we also
+;;want to emit these objects in file order.  Recording the object's relative
+;;position lets us generate an ordered list when we need to.
+;;We can't just use the line number because we want an ordering over multiple
+;;input files.
 
 (define <source-ident>
   (class-make '<source-ident> '(<ident>)
 (define (obj-ordinal obj) (send obj 'get-ordinal))
 (define (obj-set-ordinal! obj ordinal) (send obj 'set-ordinal! ordinal))
 
-; Return a boolean indicating if X is a <source-ident>.
+;;Return a boolean indicating if X is a <source-ident>.
 
 (define (source-ident? x) (class-instance? <source-ident> x))
 \f
-; Parsing utilities
+;;Parsing utilities
 
 ;;; A parsing/processing context, used to give better error messages.
 ;;; LOCATION must be an object created with make-location.
              nil)
 )
 
-; Accessors.
+;;Accessors.
 
 (define-getters <context> context (location prefix))
 
-; Create a <context> object that is just a prefix.
+;;Create a <context> object that is just a prefix.
 
 (define (make-prefix-context prefix)
   (make <context> #f prefix)
 )
 
-; Create a <context> object that (current-reader-location) with PREFIX.
+;;Create a <context> object that (current-reader-location) with PREFIX.
 
 (define (make-current-context prefix)
   (make <context> (current-reader-location) prefix)
 )
 
-; Create a <context> object from <source-ident> object OBJ.
+;;Create a <context> object from <source-ident> object OBJ.
 
 (define (make-obj-context obj prefix)
   (make <context> (obj-location obj) prefix)
 )
 
-; Create a new context from CONTEXT with TEXT appended to the prefix.
+;;Create a new context from CONTEXT with TEXT appended to the prefix.
 
 (define (context-append context text)
   (make <context> (context-location context)
        (string-append (context-prefix context) text))
 )
 
-; Create a new context from CONTEXT with NAME appended to the prefix.
+;;Create a new context from CONTEXT with NAME appended to the prefix.
 
 (define (context-append-name context name)
   (context-append context (stringsym-append ":" name))
 )
 
-; Call this to issue an error message when all you have is a context.
-; CONTEXT is a <context> object or #f if there is none.
-; INTRO is a general introduction to what cgen was doing.
-; ERRMSG is, yes, you guessed it, the error message.
-; EXPR is the value that had the error if there is one.
+;;Call this to issue an error message when all you have is a context.
+;;CONTEXT is a <context> object or #f if there is none.
+;;INTRO is a general introduction to what cgen was doing.
+;;ERRMSG is, yes, you guessed it, the error message.
+;;EXPR is the value that had the error if there is one.
 
 (define (context-error context intro errmsg . expr)
   (apply context-owner-error
                           (cons errmsg expr)))))
 )
 
-; Call this to issue an error message when you have a context and an
-; <ident> or <source-ident> object (we call the "owner").
-; CONTEXT is a <context> object or #f if there is none.
-; OWNER is an <ident> or <source-ident> object or #f if there is none.
-; INTRO is a general introduction to what cgen was doing.
-;   If OWNER is non-#f, the text " of <object-name>" is appended.
-; ERRMSG is, yes, you guessed it, the error message.
-; EXPR is the value that had the error if there is one.
+;;Call this to issue an error message when you have a context and an
+;;<ident> or <source-ident> object (we call the "owner").
+;;CONTEXT is a <context> object or #f if there is none.
+;;OWNER is an <ident> or <source-ident> object or #f if there is none.
+;;INTRO is a general introduction to what cgen was doing.
+;;  If OWNER is non-#f, the text " of <object-name>" is appended.
+;;ERRMSG is, yes, you guessed it, the error message.
+;;EXPR is the value that had the error if there is one.
 
 (define (context-owner-error context owner intro errmsg . expr)
   ;; If we don't have a context, look at the owner to try to find one.
                expr))))
 )
 
-; Parse an object name.
-; NAME is either a symbol or a list of symbols which are concatenated
-; together.  Each element can in turn be a list of symbols, and so on.
-; This supports symbol concatenation in the description file without having
-; to using string-append or some such.
+;;Parse an object name.
+;;NAME is either a symbol or a list of symbols which are concatenated
+;;together.  Each element can in turn be a list of symbols, and so on.
+;;This supports symbol concatenation in the description file without having
+;;to using string-append or some such.
 
 (define (parse-name context name)
   (string->symbol
       (else (parse-error context "improper name" name)))))
 )
 
-; Parse an object comment.
-; COMMENT is either a string or a list of strings, each element of which may
-; in turn be a list of strings.
+;;Parse an object comment.
+;;COMMENT is either a string or a list of strings, each element of which may
+;;in turn be a list of strings.
 
 (define (parse-comment context comment)
   (cond ((string? comment) comment)
        (else (parse-error context "improper comment" comment)))
 )
 
-; Parse a symbol.
+;;Parse a symbol.
 
 (define (parse-symbol context value)
   (if (and (not (symbol? value)) (not (string? value)))
   (->symbol value)
 )
 
-; Parse a string.
+;;Parse a string.
 
 (define (parse-string context value)
   (if (and (not (symbol? value)) (not (string? value)))
   (->string value)
 )
 
-; Parse a number.
-; VALID-VALUES is a list of numbers and (min . max) pairs.
+;;Parse a number.
+;;VALID-VALUES is a list of numbers and (min . max) pairs.
 
 (define (parse-number context value . valid-values)
   (if (not (number? value))
       (parse-error context "invalid number" value valid-values))
 )
 
-; Parse a boolean value
+;;Parse a boolean value
 
 (define (parse-boolean context value)
   (if (boolean? value)
       (parse-error context "not a boolean (#f/#t)" value))
 )
 
-; Parse a list of handlers.
-; Each entry is (symbol "string").
-; These map function to a handler for it.
-; The meaning is up to the application but generally the handler is a
-; C/C++ function name.
-; ALLOWED is a list valid values for the symbol or #f if anything is allowed.
-; The result is handlers unchanged.
+;;Parse a list of handlers.
+;;Each entry is (symbol "string").
+;;These map function to a handler for it.
+;;The meaning is up to the application but generally the handler is a
+;;C/C++ function name.
+;;ALLOWED is a list valid values for the symbol or #f if anything is allowed.
+;;The result is handlers unchanged.
 
 (define (parse-handlers context allowed handlers)
   (if (not (list? handlers))
   handlers
 )
 
-; Return a boolean indicating if X is a keyword.
-; This also handles symbols named :foo because Guile doesn't stablely support
-; :keywords (how does one enable :keywords? read-options doesn't appear to
-; work).
+;;Return a boolean indicating if X is a keyword.
+;;This also handles symbols named :foo because Guile doesn't stablely support
+;;:keywords (how does one enable :keywords? read-options doesn't appear to
+;;work).
 
 (define (keyword-list? x)
   (and (list? x)
                (char=? (string-ref (symbol->string (car x)) 0) #\:))))
 )
 
-; Convert a list like (#:key1 val1 #:key2 val2 ...) to
-; ((#:key1 val1) (#:key2 val2) ...).
-; Missing values are specified with an empty list.
-; This also supports (:sym1 val1 ...) because Guile doesn't stablely support
-; :keywords (#:keywords work, but #:foo shouldn't appear in the description
-; language).
+;;Convert a list like (#:key1 val1 #:key2 val2 ...) to
+;;((#:key1 val1) (#:key2 val2) ...).
+;;Missing values are specified with an empty list.
+;;This also supports (:sym1 val1 ...) because Guile doesn't stablely support
+;;:keywords (#:keywords work, but #:foo shouldn't appear in the description
+;;language).
 
 (define (keyword-list->arg-list kl)
-  ; Scan KL backwards, building up each element as we go.
+  ;; Scan KL backwards, building up each element as we go.
   (let loop ((result nil) (current nil) (rkl (reverse kl)))
     (cond ((null? rkl)
           result)
                 (cdr rkl)))))
 )
 
-; Signal an error if the argument name is not a symbol.
-; This is done by each of the argument validation routines so the caller
-; doesn't need to make two calls.
+;;Signal an error if the argument name is not a symbol.
+;;This is done by each of the argument validation routines so the caller
+;;doesn't need to make two calls.
 
 (define (arg-list-validate-name context arg-spec)
   (if (null? arg-spec)
   *UNSPECIFIED*
 )
 
-; Signal a parse error if an argument was specified with a value.
-; ARG-SPEC is (name value).
+;;Signal a parse error if an argument was specified with a value.
+;;ARG-SPEC is (name value).
 
 (define (arg-list-check-no-args context arg-spec)
   (arg-list-validate-name context arg-spec)
   *UNSPECIFIED*
 )
 
-; Validate and return a symbol argument.
-; ARG-SPEC is (name value).
+;;Validate and return a symbol argument.
+;;ARG-SPEC is (name value).
 
 (define (arg-list-symbol-arg context arg-spec)
   (arg-list-validate-name context arg-spec)
   (cadr arg-spec)
 )
 \f
-; Sanitization
+;;Sanitization
 
-; Sanitization is handled via attributes.  Anything that must be sanitized
-; has a `sanitize' attribute with the value being the keyword to sanitize on.
-; Ideally most, if not all, of the guts of the generated sanitization is here.
+;;Sanitization is handled via attributes.  Anything that must be sanitized
+;;has a `sanitize' attribute with the value being the keyword to sanitize on.
+;;Ideally most, if not all, of the guts of the generated sanitization is here.
 
-; Utility to simplify expression in .cpu file.
-; Usage: (sanitize isa-name-list keyword entry-type entry-name1 [entry-name2 ...])
-; Enum attribute `(sanitize keyword)' is added to the entry.
+;;Utility to simplify expression in .cpu file.
+;;Usage: (sanitize isa-name-list keyword entry-type entry-name1 [entry-name2 ...])
+;;Enum attribute `(sanitize keyword)' is added to the entry.
 
 (define (sanitize isa-name-list keyword entry-type . entry-names)
   (for-each (lambda (entry-name)
                  (else (parse-error (make-prefix-context "sanitize")
                                     "unknown entry type" entry-type)))
 
-               ; ENTRY is #f in the case where the element was discarded
-               ; because its mach wasn't selected.  But in the case where
-               ; we're keeping everything, ensure ENTRY is not #f to
-               ; catch spelling errors.
+               ;; ENTRY is #f in the case where the element was discarded
+               ;; because its mach wasn't selected.  But in the case where
+               ;; we're keeping everything, ensure ENTRY is not #f to
+               ;; catch spelling errors.
 
                (if entry
 
                    (begin
                      (obj-cons-attr! entry (enum-attr-make 'sanitize keyword))
-                     ; Propagate the sanitize attribute to class members
-                     ; as necessary.
+                     ;; Propagate the sanitize attribute to class members
+                     ;; as necessary.
                      (case entry-type
                        ((hardware)
                         (if (hw-indices entry)
                                     entry-name)))))
            entry-names)
 
-  #f ; caller eval's our result, so return a no-op
+  #f ;; caller eval's our result, so return a no-op
 )
 
-; Return TEXT sanitized with KEYWORD.
-; TEXT must exist on a line (or lines) by itself.
-; i.e. it is assumed that it begins at column 1 and ends with a newline.
-; If KEYWORD is #f, no sanitization is generated.
+;;Return TEXT sanitized with KEYWORD.
+;;TEXT must exist on a line (or lines) by itself.
+;;i.e. it is assumed that it begins at column 1 and ends with a newline.
+;;If KEYWORD is #f, no sanitization is generated.
 
 (define (gen-sanitize keyword text)
   (cond ((null? text) "")
-       ((pair? text) ; pair? -> cheap list?
+       ((pair? text) ;; pair? -> cheap list?
         (if (and keyword include-sanitize-marker?)
             (string-list
-             ; split string to avoid removal
+             ;; split string to avoid removal
              "/* start-"
              "sanitize-" keyword " */\n"
              text
             ""
             (if (and keyword include-sanitize-marker?)
                 (string-append
-                 ; split string to avoid removal
+                 ;; split string to avoid removal
                  "/* start-"
                  "sanitize-" keyword " */\n"
                  text
                 text))))
 )
 
-; Return TEXT sanitized with OBJ's sanitization, if it has any.
-; OBJ may be #f.
+;;Return TEXT sanitized with OBJ's sanitization, if it has any.
+;;OBJ may be #f.
 
 (define (gen-obj-sanitize obj text)
   (if obj
       (gen-sanitize #f text))
 )
 \f
-; Cover procs to handle generation of object declarations and definitions.
-; All object output should be routed through gen-decl and gen-defn.
+;;Cover procs to handle generation of object declarations and definitions.
+;;All object output should be routed through gen-decl and gen-defn.
 
-; Send the gen-decl message to OBJ, and sanitize the output if necessary.
+;;Send the gen-decl message to OBJ, and sanitize the output if necessary.
 
 (define (gen-decl obj)
   (logit 3 "Generating decl for "
        (else ""))
 )
 
-; Send the gen-defn message to OBJ, and sanitize the output if necessary.
+;;Send the gen-defn message to OBJ, and sanitize the output if necessary.
 
 (define (gen-defn obj)
   (logit 3 "Generating defn for "
        (else ""))
 )
 \f
-; Attributes
+;;Attributes
 
-; Return the C/C++ type to use to hold a value for attribute ATTR.
+;;Return the C/C++ type to use to hold a value for attribute ATTR.
 
 (define (gen-attr-type attr)
   (if (string=? (string-downcase (gen-sym attr)) "isa")
        ))
 )
 
-; Return C macros for accessing an object's attributes ATTRS.
-; PREFIX is one of "cgen_ifld", "cgen_hw", "cgen_operand", "cgen_insn".
-; ATTRS is an alist of attribute values.  The value is unimportant except that
-; it is used to determine bool/non-bool.
-; Non-bools need to be separated from bools as they're each recorded
-; differently.  Non-bools are recorded in an int for each.  All bools are
-; combined into one int to save space.
-; ??? We assume there is at least one bool.
+;;Return C macros for accessing an object's attributes ATTRS.
+;;PREFIX is one of "cgen_ifld", "cgen_hw", "cgen_operand", "cgen_insn".
+;;ATTRS is an alist of attribute values.  The value is unimportant except that
+;;it is used to determine bool/non-bool.
+;;Non-bools need to be separated from bools as they're each recorded
+;;differently.  Non-bools are recorded in an int for each.  All bools are
+;;combined into one int to save space.
+;;??? We assume there is at least one bool.
 
 (define (gen-attr-accessors prefix attrs)
   (string-append
               attrs)
    "\n")
 )
-; Return C code to declare an enum of attributes ATTRS.
-; PREFIX is one of "cgen_ifld", "cgen_hw", "cgen_operand", "cgen_insn".
-; ATTRS is an alist of attribute values.  The value is unimportant except that
-; it is used to determine bool/non-bool.
-; Non-bools need to be separated from bools as they're each recorded
-; differently.  Non-bools are recorded in an int for each.  All bools are
-; combined into one int to save space.
-; ??? We assume there is at least one bool.
+;;Return C code to declare an enum of attributes ATTRS.
+;;PREFIX is one of "cgen_ifld", "cgen_hw", "cgen_operand", "cgen_insn".
+;;ATTRS is an alist of attribute values.  The value is unimportant except that
+;;it is used to determine bool/non-bool.
+;;Non-bools need to be separated from bools as they're each recorded
+;;differently.  Non-bools are recorded in an int for each.  All bools are
+;;combined into one int to save space.
+;;??? We assume there is at least one bool.
 
 (define (gen-attr-enum-decl prefix attrs)
   (string-append
    "\n")
 )
 
-; Return name of symbol ATTR-NAME.
-; PREFIX is the prefix arg to gen-attr-enum-decl.
+;;Return name of symbol ATTR-NAME.
+;;PREFIX is the prefix arg to gen-attr-enum-decl.
 
 (define (gen-attr-name prefix attr-name)
   (string-upcase (gen-c-symbol (string-append prefix "_"
                                              (symbol->string attr-name))))
 )
 
-; Normal gen-mask argument to gen-bool-attrs.
-; Returns "(1<< PREFIX_NAME)" where PREFIX is from atlist-prefix and
-; NAME is the name of the attribute.
-; ??? This used to return PREFIX_NAME-CGEN_ATTR_BOOL_OFFSET.
-; The tradeoff is simplicity vs perceived maximum number of boolean attributes
-; needed.  In the end the maximum number needn't be fixed, and the simplicity
-; of the current way is good.
+;;Normal gen-mask argument to gen-bool-attrs.
+;;Returns "(1<< PREFIX_NAME)" where PREFIX is from atlist-prefix and
+;;NAME is the name of the attribute.
+;;??? This used to return PREFIX_NAME-CGEN_ATTR_BOOL_OFFSET.
+;;The tradeoff is simplicity vs perceived maximum number of boolean attributes
+;;needed.  In the end the maximum number needn't be fixed, and the simplicity
+;;of the current way is good.
 
 (define (gen-attr-mask prefix name)
   (string-append "(1<<" (gen-attr-name prefix name) ")")
 )
 
-; Return C expression of bitmasks of boolean attributes in ATTRS.
-; ATTRS is an <attr-list> object, it need not be pre-sorted.
-; GEN-MASK is a procedure that returns the C code of the mask.
+;;Return C expression of bitmasks of boolean attributes in ATTRS.
+;;ATTRS is an <attr-list> object, it need not be pre-sorted.
+;;GEN-MASK is a procedure that returns the C code of the mask.
 
 (define (gen-bool-attrs attrs gen-mask)
   (let loop ((result "0")
     (cond ((null? alist) result)
          ((and (boolean? (cdar alist)) (cdar alist))
           (loop (string-append result
-                               ; `|' is used here instead of `+' so we don't
-                               ; have to care about duplicates.
+                               ;; `|' is used here instead of `+' so we don't
+                               ;; have to care about duplicates.
                                "|" (gen-mask (atlist-prefix attrs)
                                              (caar alist)))
                 (cdr alist)))
          (else (loop result (cdr alist)))))
 )
 
-; Return the C definition of OBJ's attributes.
-; TYPE is one of 'ifld, 'hw, 'operand, 'insn.
-; [Other objects have attributes but these are the only ones we currently
-; emit definitions for.]
-; OBJ is any object that supports the 'get-atlist message.
-; ALL-ATTRS is an ordered alist of all attributes.
-; "ordered" means all the non-boolean attributes are at the front and
-; duplicate entries have been removed.
-; GEN-MASK is the gen-mask arg to gen-bool-attrs.
+;;Return the C definition of OBJ's attributes.
+;;TYPE is one of 'ifld, 'hw, 'operand, 'insn.
+;;[Other objects have attributes but these are the only ones we currently
+;;emit definitions for.]
+;;OBJ is any object that supports the 'get-atlist message.
+;;ALL-ATTRS is an ordered alist of all attributes.
+;;"ordered" means all the non-boolean attributes are at the front and
+;;duplicate entries have been removed.
+;;GEN-MASK is the gen-mask arg to gen-bool-attrs.
 
 (define (gen-obj-attr-defn type obj all-attrs num-non-bools gen-mask)
   (let* ((attrs (obj-atlist obj))
    "{ "
    (gen-bool-attrs attrs gen-mask)
    ", {"
-   ; For the boolean case, we can (currently) get away with only specifying
-   ; the attributes that are used since they all fit in one int and the
-   ; default is currently always #f (and won't be changed without good
-   ; reason).  In the non-boolean case order is important since each value
-   ; has a specific spot in an array, all of them must be specified.
+   ;; For the boolean case, we can (currently) get away with only specifying
+   ;; the attributes that are used since they all fit in one int and the
+   ;; default is currently always #f (and won't be changed without good
+   ;; reason).  In the non-boolean case order is important since each value
+   ;; has a specific spot in an array, all of them must be specified.
    (if (null? all-non-bools)
        " 0"
-       (string-drop1 ; drop the leading ","
+       (string-drop1 ;; drop the leading ","
        (string-map (lambda (attr)
                      (let ((val (or (assq-ref non-bools (obj:name attr))
                                     (attr-default attr))))
-                       ; FIXME: Are we missing attr-prefix here?
+                       ;; FIXME: Are we missing attr-prefix here?
                        (string-append ", "
                                       (send attr 'gen-value-for-defn val))))
                    all-non-bools)))
    ))
 )
 
-; Return the C definition of the terminating entry of an object's attributes.
-; ALL-ATTRS is an ordered alist of all attributes.
-; "ordered" means all the non-boolean attributes are at the front and
-; duplicate entries have been removed.
+;;Return the C definition of the terminating entry of an object's attributes.
+;;ALL-ATTRS is an ordered alist of all attributes.
+;;"ordered" means all the non-boolean attributes are at the front and
+;;duplicate entries have been removed.
 
 (define (gen-obj-attr-end-defn all-attrs num-non-bools)
   (let ((all-non-bools (list-take num-non-bools all-attrs)))
      "{ 0, {"
      (if (null? all-non-bools)
         " { 0, 0 }"
-        (string-drop1 ; drop the leading ","
+        (string-drop1 ;; drop the leading ","
          (string-map (lambda (attr)
                        (let ((val (attr-default attr)))
-                                       ; FIXME: Are we missing attr-prefix here?
+                         ;; FIXME: Are we missing attr-prefix here?
                          (string-append ", "
                                         (send attr 'gen-value-for-defn val))))
                      all-non-bools)))
      ))
 )
 
-; Return a boolean indicating if ATLIST indicates a CTI insn.
+;;Return a boolean indicating if ATLIST indicates a CTI insn.
 
 (define (atlist-cti? atlist)
   (or (atlist-has-attr? atlist 'UNCOND-CTI)
       (atlist-has-attr? atlist 'COND-CTI))
 )
 \f
-; Misc. gen-* procs
+;;Misc. gen-* procs
 
-; Return name of obj as a C symbol.
+;;Return name of obj as a C symbol.
 
 (define (gen-sym obj) (gen-c-symbol (obj:name obj)))
 
-; Return the name of the selected cpu family.
-; An error is signalled if more than one has been selected.
+;;Return the name of the selected cpu family.
+;;An error is signalled if more than one has been selected.
 
 (define (gen-cpu-name)
-  ; FIXME: error checking
+  ;; FIXME: error checking
   (gen-sym (current-cpu))
 )
 
-; Return HAVE_CPU_<CPU>.
+;;Return HAVE_CPU_<CPU>.
 
 (define (gen-have-cpu cpu)
   (string-append "HAVE_CPU_"
                 (string-upcase (gen-sym cpu)))
 )
 
-; Return the bfd mach name for MACH.
+;;Return the bfd mach name for MACH.
 
 (define (gen-mach-bfd-name mach)
   (string-append "bfd_mach_" (gen-c-symbol (mach-bfd-name mach)))
          (symbol<? (obj:name o1) (obj:name o2))))
 )
 \f
-; Called before loading the .cpu file to initialize.
+;;Called before loading the .cpu file to initialize.
 
 (define (utils-init!)
   (reader-add-command! 'sanitize
@@ -991,12 +991,12 @@ Mark an entry as being sanitized.
   *UNSPECIFIED*
 )
 
-; Return a pair of definitions for a C macro that concatenates its
-; argument symbols.  The definitions are conditional on ANSI C
-; semantics: one contains ANSI concat operators (##), and the other
-; uses the empty-comment trick (/**/).  We must do this, rather than
-; use CONCATn(...) as defined in include/symcat.h, in order to avoid
-; spuriously expanding our macro's args.
+;;Return a pair of definitions for a C macro that concatenates its
+;;argument symbols.  The definitions are conditional on ANSI C
+;;semantics: one contains ANSI concat operators (##), and the other
+;;uses the empty-comment trick (/**/).  We must do this, rather than
+;;use CONCATn(...) as defined in include/symcat.h, in order to avoid
+;;spuriously expanding our macro's args.
 
 (define (gen-define-with-symcat head . args)
   (string-append