From cb14cc4f17b88920c4bfdbb20a354c379cd8910e Mon Sep 17 00:00:00 2001 From: devans Date: Tue, 8 Jul 2003 16:19:35 +0000 Subject: [PATCH] misc. whitespace and comment cleanup --- cgen/decode.scm | 18 +++++++++--------- cgen/html.scm | 2 -- cgen/insn.scm | 1 - cgen/sid-decode.scm | 6 ++---- cgen/sim-decode.scm | 3 --- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/cgen/decode.scm b/cgen/decode.scm index 57c87d4031..f1894727d2 100644 --- a/cgen/decode.scm +++ b/cgen/decode.scm @@ -212,13 +212,13 @@ )) ) - ; Compute population counts for each bit. Return it as a vector indexed by bit number. ; Rather than computing raw popularity, attempt to compute "disinguishing value" or ; inverse-entropy for each bit. The idea is that the larger the number for any particular ; bit slot, the more instructions it can be used to distinguish. Raw mask popularity ; is not enough -- popular masks may include useless "reserved" fields whose values ; don't change, and thus are useless in distinguishing. + (define (-distinguishing-bit-population masks mask-lens values lsb0?) (let* ((max-length (apply max mask-lens)) (0-population (make-vector max-length 0)) @@ -263,8 +263,8 @@ (vector->list 0-population) (vector->list 1-population)))) ) - ; Return a list (0 ... limit-1) + (define (-range limit) (let loop ((i 0) (indices (list))) @@ -272,14 +272,16 @@ ) ; Return a list (base ... base+size-1) + (define (-range2 base size) (let loop ((i base) (indices (list))) (if (= i (+ base size)) (reverse indices) (loop (+ i 1) (cons i indices)))) ) +; Return a copy of given vector, with all entries with given indices set +; to `value' -; Return a copy of given vector, with all entries with given indices set to `value' (define (-vector-copy-set-all vector indices value) (let ((new-vector (make-vector (vector-length vector)))) (for-each (lambda (index) @@ -290,9 +292,10 @@ new-vector) ) - -; Return a list of indices whose counts in the given vector exceed the given threshold. +; Return a list of indices whose counts in the given vector exceed the given +; threshold. ; Sort them in decreasing order of populatority. + (define (-population-above-threshold population threshold) (let* ((unsorted (find (lambda (index) (if (vector-ref population index) @@ -305,10 +308,10 @@ sorted) ) - ; Return the top few most popular indices in the population vector, ; ignoring any that are already used (marked by #f). Don't exceed ; `size' unless the clustering is just too good to pass up. + (define (-population-top-few population size) (let loop ((old-picks (list)) (remaining-population population) @@ -346,8 +349,6 @@ (* 0.75 count-threshold)))))) ) - - ; Given list of insns, return list of bit numbers of constant bits in opcode ; that they all share (or mostly share), up to MAX elements. ; ALREADY-USED is a list of bitnums we can't use. @@ -397,7 +398,6 @@ sorted-indices) ) - (define (OLDdecode-get-best-bits insn-list already-used startbit max decode-bitsize lsb0?) (let ((masks (map insn-base-mask insn-list)) ; ??? We assume mask lengths are repeatedly used for insns longer diff --git a/cgen/html.scm b/cgen/html.scm index 58335e1133..8fb1833f8a 100644 --- a/cgen/html.scm +++ b/cgen/html.scm @@ -24,8 +24,6 @@ ; including generic cgen documentation here ; - function units, timing, etc. ; - instruction framing -; - ARM docs mix arm/thumb, should be separate, -; first try to split using keep-isa ; Global state variables. diff --git a/cgen/insn.scm b/cgen/insn.scm index f3ec793569..6cb606a578 100644 --- a/cgen/insn.scm +++ b/cgen/insn.scm @@ -705,7 +705,6 @@ (find (lambda (insn) (not (multi-insn? insn))) insn-list) ) - ; Filter out instructions whose ifield patterns are strict supersets of ; another, keeping the less general cousin. Used to resolve ambiguity ; when there are no more bits to consider. diff --git a/cgen/sid-decode.scm b/cgen/sid-decode.scm index b07c272dcb..d1d3280d69 100644 --- a/cgen/sid-decode.scm +++ b/cgen/sid-decode.scm @@ -617,9 +617,6 @@ static void ; build the first decode table. If nil, we compute 8 bits of it (FIXME) ; ourselves. ; LSB0? is non-#f if bit number 0 is the least significant bit. -; FIXME: Need to be perfect for every subtable, or allow target more control. -; Leave for later (and don't give target more control until oodles of effort -; have been spent trying to be perfect! ... or close enough). (define (-gen-decode-fn insn-list initial-bitnums lsb0?) (assert (with-scache?)) @@ -635,7 +632,8 @@ static void ; 0 is passed for the start bit (it is independent of lsb0?) (if (null? initial-bitnums) (set! initial-bitnums - (if (= 0 (length insn-list)) (list 0) ; dummy value + (if (= 0 (length insn-list)) + (list 0) ; dummy value (decode-get-best-bits insn-list nil 0 ; startbit 8 ; max diff --git a/cgen/sim-decode.scm b/cgen/sim-decode.scm index 8759f6d0a1..a4e620aa03 100644 --- a/cgen/sim-decode.scm +++ b/cgen/sim-decode.scm @@ -466,9 +466,6 @@ void ; build the first decode table. If nil, we compute 8 bits of it (FIXME) ; ourselves. ; LSB0? is non-#f if bit number 0 is the least significant bit. -; FIXME: Need to be perfect for every subtable, or allow target more control. -; Leave for later (and don't give target more control until oodles of effort -; have been spent trying to be perfect! ... or close enough). (define (-gen-decode-fn insn-list initial-bitnums lsb0?) -- 2.11.0