This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Patch] More thorough cpu.h hardware struct


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

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]