machine/riscv: Refactor machine specific memcpy/memmove overriding me…#275
Open
RamNalamothu wants to merge 1 commit intoqualcomm:qualcomm-softwarefrom
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.