Skip to content

machine/riscv: Refactor machine specific memcpy/memmove overriding me…#275

Open
RamNalamothu wants to merge 1 commit intoqualcomm:qualcomm-softwarefrom
RamNalamothu:riscv-lib-api-overriding-refactor
Open

machine/riscv: Refactor machine specific memcpy/memmove overriding me…#275
RamNalamothu wants to merge 1 commit intoqualcomm:qualcomm-softwarefrom
RamNalamothu:riscv-lib-api-overriding-refactor

Conversation

@RamNalamothu
Copy link
Copy Markdown
Contributor

…chanism

For RISC-V, it is possible to have several optimized implementations of library routines depending on which hardware extensions are enabled and the current mechanism to choose the appropriate implementation will quickly become messy when dealing with many implementations.

With the refactor, the idea is, for e.g., 'newlib/libc/machine/riscv/memcpy.c' will override the generic 'newlib/libc/string/memcpy.c' through the 'srcs_machine' scheme and conditions in 'newlib/libc/machine/riscv/memcpy.c' will decide which implementation gets compiled and used for a given scenario.

Put all the related changes into one header, e.g. 'rv_string.h' for all 'string.h' related API specializations, to avoid the potential header file clutter as we specialize more and more APIs from several headers. This mechanism is simple and scalable.

The existing 'rv_string.h' is renamed to 'rv_strcpy.h'.

This patch file is a squashed commit of all the changes from upstream PRs:
picolibc/picolibc#1090
picolibc/picolibc#1092
picolibc/picolibc#1098

These changes are available in Picolibc v1.8.11 and this patch file can be deleted when we upgrade picolibc to v1.8.11.

…chanism

For RISC-V, it is possible to have several optimized implementations
of library routines depending on which hardware extensions are enabled
and the current mechanism to choose the appropriate implementation
will quickly become messy when dealing with many implementations.

With the refactor, the idea is, for e.g., 'newlib/libc/machine/riscv/memcpy.c'
will override the generic 'newlib/libc/string/memcpy.c' through the
'srcs_machine' scheme and conditions in 'newlib/libc/machine/riscv/memcpy.c'
will decide which implementation gets compiled and used for a given scenario.

Put all the related changes into one header, e.g. 'rv_string.h' for all
'string.h' related API specializations, to avoid the potential header
file clutter as we specialize more and more APIs from several headers.
This mechanism is simple and scalable.

The existing 'rv_string.h' is renamed to 'rv_strcpy.h'.

This patch file is a squashed commit of all the changes from upstream PRs:
    picolibc/picolibc#1090
    picolibc/picolibc#1092
    picolibc/picolibc#1098

These changes are available in Picolibc v1.8.11 and this patch file can
be deleted when we upgrade picolibc to v1.8.11.

Signed-off-by: Venkata Ramanaiah Nalamothu <vnalamot@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant