[PATCH] D61634: [clang/llvm] Allow efficient implementation of libc's memory functions in C/C++
Guillaume Chatelet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 16 08:59:04 PDT 2019
gchatelet added a comment.
In D61634#1586047 <https://reviews.llvm.org/D61634#1586047>, @tejohnson wrote:
> Checking in to see where we are on this issue. I haven't had any time to work on 4 but hopefully can start on that soon. But it needs the first part done to be effective.
Thx for the heads up @tejohnson.
The patch is missing a bit of documentation but it shouldn't be too far from complete:
- it adds a clang function attribute, e.g. `__attribute__((no_builtin("memcpy")))`
- instructs clang to compose individual IR attributes from the clang attribute above, e.g. `no-builtin-memcpy`, `no-builtin-memset`, `no-builtin-sqrt`...
- adds a specific builtin to clang for the memcpy case `__builtin_memcpy_inline`
- adds an LLVM IR intrinsic `int_memcpy_inline`
- adds an LLVM Instruction `MemCpyInlineInst`
- instructs LLVM to forward the `no-builtin-memcpy` IR attribute from the function declaration to the actual memcpy calls inside the function's body (same for `memset` and `memmove`)
- adds code to turn the `MemCpyInlineInst` into code, using `DAG.getMemcpy` with `always_inline` set.
Left to do:
- finish implementing memset / memmove
- check attributes and reject the one that are not implemented
- add documentation
There's too many things going on in this patch and it may worth splitting it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61634/new/
https://reviews.llvm.org/D61634
More information about the cfe-commits
mailing list