gcc: xtensa: allow dynamic configuration
authorMax Filippov <jcmvbkbc@gmail.com>
Mon, 8 May 2017 18:28:21 +0000 (11:28 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Wed, 7 Dec 2022 18:00:48 +0000 (10:00 -0800)
commitecb575d09c0ff5314088214c2bb39f1959ad3318
tree79bd0f681a406b7f465a68f3d0d0741906a8fbb3
parent952c8a1dc6235dc49ab207a7f18f63d2bc97fbc9
gcc: xtensa: allow dynamic configuration

Import include/xtensa-dynconfig.h that defines XCHAL_* macros as fields
of a structure returned from the xtensa_get_config_v<x> function call.
Define that structure and fill it with default parameter values
specified in the include/xtensa-config.h.
Define reusable function xtensa_load_config that tries to load
configuration and return an address of an exported object from it.
Define the function xtensa_get_config_v1 that uses xtensa_load_config
to get structure xtensa_config_v1, either dynamically configured or the
default.

Provide essential XCHAL_* configuration parameters as __XCHAL_* built-in
macros. This way it will be possible to use them in libgcc and libc
without need to patch libgcc or libc source for the specific xtensa core
configuration.

gcc/
* config.gcc (xtensa*-*-*): Add xtensa-dynconfig.o to extra_objs.
* config/xtensa/t-xtensa (TM_H): Add xtensa-dynconfig.h.
(xtensa-dynconfig.o): New rule.
* config/xtensa/xtensa-dynconfig.c: New file.
* config/xtensa/xtensa-protos.h (xtensa_get_config_strings): New
declaration.
* config/xtensa/xtensa.h (xtensa-config.h): Replace #include
with xtensa-dynconfig.h
(XCHAL_HAVE_MUL32_HIGH, XCHAL_HAVE_RELEASE_SYNC)
(XCHAL_HAVE_S32C1I, XCHAL_HAVE_THREADPTR)
(XCHAL_HAVE_FP_POSTINC): Drop definitions.
(TARGET_DIV32): Replace with __XCHAL_HAVE_DIV32.
(TARGET_CPU_CPP_BUILTINS): Add new 'builtin' variable and loop
through string array returned by the xtensa_get_config_strings
function call.

include/
* xtensa-dynconfig.h: New file.
gcc/config.gcc
gcc/config/xtensa/t-xtensa
gcc/config/xtensa/xtensa-dynconfig.c [new file with mode: 0644]
gcc/config/xtensa/xtensa-protos.h
gcc/config/xtensa/xtensa.h
include/xtensa-dynconfig.h [new file with mode: 0644]