[Patch] More thorough cpu.h hardware struct

Frank Ch. Eigler fche@redhat.com
Thu Nov 23 14:41:00 GMT 2000


HI -

On Fri, Nov 24, 2000 at 09:25:36AM +1100, Ben Elliston wrote:
: I'd like to apply the following patch, but would like it reviewed
: first for tastefulness.  [...]



: + ; Subroutine of -gen-hardware-types to generate the struct containing
: + ; hardware elements of one isa.
: + 
: + (define (-gen-hardware-struct hw-list)
: +   [...]
: + )

Okay.


: !    (if (with-multiple-isa?)
: !        (let ((keep-isas (current-keep-isa-name-list))
: ! 	     (candidates (find hw-need-storage? (current-hw-list))))
: ! 	 (-gen-hardware-struct 
: ! 	  (find (lambda (hw)
: ! 		  (>= (count-common
: ! 		       keep-isas
: ! 		       (bitset-attr->list
: ! 			(obj-attr-value hw 'ISA)))
: ! 		      1))
: ! 		candidates)))
: !        (-gen-hardware-struct (find hw-need-storage? (current-hw-list)))
: !    )

The -gen-hardware-struct thingie already filters hw objects for
hw-need-storage?-ness, so it's redundant to do it in the caller too.

Also, I would push the conditional down a few layers, since the two
arms share a lot.  Something like:

  (-gen-hardware-struct 
	(find (lambda (hw)
                      (or (not (with-multiple-isa?))
		          (>= (count-common
                                 (current-keep-isa-name-list)
		                 (bitset-attr->list (obj-attr-value hw 'ISA)) 
                                 1)))))
	(current-hw-list))

looks a little better to me.

(By the way, untabified text survives email editing better.)


- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6HZ0cVZbdDOm/ZT0RAqF4AJ9CfTrbjHsvbopVxnmdkcRA0rTreACeKmM5
uJ/3CwuxX4cStNcpL1c7lyw=
=tXLq
-----END PGP SIGNATURE-----


More information about the Cgen mailing list