[PATCH] sim: tighten up generated decode tables
Mike Frysinger via Cgen <[email protected]> Thu, 21 Dec 2023 20:00:28 -0500
| Newsgroups | gmane.comp.tools.cgen.devel |
|---|---|
| Message-ID | <[email protected]> |
The use of /* fall through */ with consective case statements doesn't
really add any value, and when generating large files, can take up a
lot of space. In the case of cris, it alone adds ~20k, or ~10%.
Also trim the space before the : with case statements.
---
utils-sim.scm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/utils-sim.scm b/utils-sim.scm
index dca0f0705036..8011bb775933 100644
--- a/utils-sim.scm
+++ b/utils-sim.scm
@@ -684,14 +684,14 @@
(obj:name (dtable-entry-value (car rest)))))
(string-append indent " case "
(number->string (dtable-entry-index entry))
- " : /* fall through */\n"))
+ ":\n"))
(else
(let ((consistent-base-insn? (and (equal? APPLICATION 'SID-SIMULATOR)
(> (state-base-insn-bitsize)
(insn-length insn)))))
(string-append indent " case "
- (number->string (dtable-entry-index entry)) " :"
+ (number->string (dtable-entry-index entry)) ":"
;; Compensate for base-insn-size > current-insn-size by
;; adjusting entire_insn.
;; Activate this logic only for sid simulators; they are
@@ -825,7 +825,7 @@
(string-list
indent " case "
(number->string (dtable-entry-index entry))
- " :\n"
+ ":\n"
(let ((iflds-tracking (/decode-expr-ifield-tracking expr-list))
(indent (string-append indent " ")))
@@ -914,7 +914,7 @@
(string-list
indent " case "
(number->string (dtable-entry-index table))
- " :"
+ ":"
; If table is same as next, just emit a "fall through" to cut down on
; generated code.
(if (and (not (null? rest))
@@ -923,7 +923,7 @@
; Ensure same table.
(eqv? (subdtable-key (dtable-entry-value table))
(subdtable-key (dtable-entry-value (car rest)))))
- " /* fall through */\n"
+ "\n"
(string-list
"\n"
(/gen-decoder-switch switch-num
@@ -1075,7 +1075,7 @@
result))))
;; ??? Can delete if all cases are present.
- indent " default : "
+ indent " default: "
(/gen-decode-default-entry invalid-insn fn?) "\n"
indent " }\n"
indent "}\n"
--
2.43.0