This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: [Patch] More thorough cpu.h hardware struct
- To: Ben Elliston <bje at redhat dot com>
- Subject: Re: [Patch] More thorough cpu.h hardware struct
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Thu, 23 Nov 2000 17:41:32 -0500
- Cc: cgen at sources dot redhat dot com
- References: <200011232225.eANMPao15302@scooby.cygnus.com>
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