target/xtensa: Constify ISA tables
PATCH 1/1 target/xtensa: Constify ISA tables
The generated xtensa-modules.c.inc tables are static ISA metadata. xtensa-isa.c only reads them; runtime writes go to the malloc'ed lookup tables and xtensa_isa_internal fields. Make them const so they are placed in .rodata instead of .data. Make import_core.sh emit const tables for newly imported cores.
--- target/xtensa/import_core.sh | 2 + .../xtensa/core-dc232b/xtensa-modules.c.inc | 2034 ++++---- .../xtensa/core-dc233c/xtensa-modules.c.inc | 2066 ++++---- target/xtensa/core-de212/xtensa-modules.c.inc | 1942 +++---- .../core-de233_fpu/xtensa-modules.c.inc | 2892 +++++----- .../xtensa/core-dsp3400/xtensa-modules.c.inc | 4638 ++++++++--------- target/xtensa/core-fsf/xtensa-modules.c.inc | 1422 ++--- target/xtensa/core-lx106/xtensa-modules.c.inc | 932 ++-- .../xtensa-modules.c.inc | 1536 +++--- .../core-test_kc705_be/xtensa-modules.c.inc | 4616 ++++++++-------- .../core-test_mmuhifi_c3/xtensa-modules.c.inc | 3578 ++++++------- 11 files changed, 12830 insertions(+), 12828 deletions(-)
target/xtensa/import_core.sh +2 -0
@@ -36,6 +36,8 @@ tar -xf "$OVERLAY" -O binutils/xtensa-modules.c | \ -e '/^Slot_[a-zA-Z0-9_]\+_decode (const xtensa_insnbuf insn)/,/^}/s/^ return 0;$/ return XTENSA_UNDEFINED;/' \ -e 's/#include <xtensa-isa.h>/#include "xtensa-isa.h"/' \ -e 's/^\(xtensa_isa_internal xtensa_modules\)/static \1/' \ + -e '/^static [a-zA-Z_]\+ [A-Za-z0-9_]\+\[\] = /s/^static /static const /' \ + -e '/^static xtensa_\(get\|set\)_field_fn$/s/^static /static const /' \ > "$TARGET"/xtensa-modules.c.inc cat <<EOF > "${TARGET}.c"
target/xtensa/core-dc232b/xtensa-modules.c.inc +1017 -1017
2,992 lines not on this page · raw message
target/xtensa/core-dc233c/xtensa-modules.c.inc +1033 -1033
2,066 lines not on this page · raw message
target/xtensa/core-de212/xtensa-modules.c.inc +971 -971
1,942 lines not on this page · raw message
target/xtensa/core-de233_fpu/xtensa-modules.c.inc +1446 -1446
2,892 lines not on this page · raw message
target/xtensa/core-dsp3400/xtensa-modules.c.inc +2319 -2319
4,638 lines not on this page · raw message
target/xtensa/core-fsf/xtensa-modules.c.inc +711 -711
1,422 lines not on this page · raw message
target/xtensa/core-lx106/xtensa-modules.c.inc +466 -466
932 lines not on this page · raw message
target/xtensa/core-sample_controller/xtensa-modules.c.inc +768 -768
1,536 lines not on this page · raw message
target/xtensa/core-test_kc705_be/xtensa-modules.c.inc +2308 -2308
4,616 lines not on this page · raw message
target/xtensa/core-test_mmuhifi_c3/xtensa-modules.c.inc +1789 -1789
3,578 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.55.0
Part of the diff is not shown here. View the raw message.
Hi Philippe,
Quoted 8 lines · Philippe Mathieu-Daudé
The generated xtensa-modules.c.inc tables are static ISA metadata.
xtensa-isa.conly reads them; runtime writes go to the malloc'ed lookup tables andxtensa_isa_internalfields. Make them const so they are placed in .rodata instead of .data. Makeimport_core.shemit const tables for newly imported cores.Inspired-by John Snow <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 13 lines
--- target/xtensa/import_core.sh | 2 + .../xtensa/core-dc232b/xtensa-modules.c.inc | 2034 ++++---- .../xtensa/core-dc233c/xtensa-modules.c.inc | 2066 ++++---- target/xtensa/core-de212/xtensa-modules.c.inc | 1942 +++---- .../core-de233_fpu/xtensa-modules.c.inc | 2892 +++++----- .../xtensa/core-dsp3400/xtensa-modules.c.inc | 4638 ++++++++--------- target/xtensa/core-fsf/xtensa-modules.c.inc | 1422 ++--- target/xtensa/core-lx106/xtensa-modules.c.inc | 932 ++-- .../xtensa-modules.c.inc | 1536 +++--- .../core-test_kc705_be/xtensa-modules.c.inc | 4616 ++++++++-------- .../core-test_mmuhifi_c3/xtensa-modules.c.inc | 3578 ++++++------- 11 files changed, 12830 insertions(+), 12828 deletions(-)
this doesn't build for me without additional changes that I just posted (target/xtensa: constify internal pointers in xtensa-isa).
Together with that patch:
Signature · 2 lines
Thanks. -- Max
Quoted 25 lines · Max Filippov
Hi Philippe,
Quoted 8 lines · Philippe Mathieu-Daudé
The generated xtensa-modules.c.inc tables are static ISA metadata.
xtensa-isa.conly reads them; runtime writes go to the malloc'ed lookup tables andxtensa_isa_internalfields. Make them const so they are placed in .rodata instead of .data. Makeimport_core.shemit const tables for newly imported cores.Inspired-by John Snow <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Quoted 13 lines
--- target/xtensa/import_core.sh | 2 + .../xtensa/core-dc232b/xtensa-modules.c.inc | 2034 ++++---- .../xtensa/core-dc233c/xtensa-modules.c.inc | 2066 ++++---- target/xtensa/core-de212/xtensa-modules.c.inc | 1942 +++---- .../core-de233_fpu/xtensa-modules.c.inc | 2892 +++++----- .../xtensa/core-dsp3400/xtensa-modules.c.inc | 4638 ++++++++--------- target/xtensa/core-fsf/xtensa-modules.c.inc | 1422 ++--- target/xtensa/core-lx106/xtensa-modules.c.inc | 932 ++-- .../xtensa-modules.c.inc | 1536 +++--- .../core-test_kc705_be/xtensa-modules.c.inc | 4616 ++++++++-------- .../core-test_mmuhifi_c3/xtensa-modules.c.inc | 3578 ++++++------- 11 files changed, 12830 insertions(+), 12828 deletions(-)
Quoted 6 lines
this doesn't build for me without additional changes that I just posted (target/xtensa: constify internal pointers in xtensa-isa).
Together with that patch:
Reviewed-by Max Filippov <[email protected]>Tested-by Max Filippov <[email protected]>
Thanks! I extracted this patch from a bigger branch but screwed since huge. I'll queue both for 12.0 :)