Add the macro CPU_COUNT as well as a backing function to implement the
functionality.
Details
- Reviewers
sivachandra - Commits
- rG0b790afb0647: [libc] add CPU_COUNT macro and backing function
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/include/llvm-libc-macros/linux/sched-macros.h | ||
---|---|---|
14 | These macros get activated only in the full build mode. So, do we really need a separate helper like CPU_COUNT_S? The internal function can be llvm libc only (as in full build only) and can take a single argument for the set? | |
libc/spec/gnu_ext.td | ||
56 | This should go into https://github.com/llvm/llvm-project/blob/main/libc/spec/llvm_libc_ext.td. Also, the function is really an internal function - it's name should have the __ prefix. | |
libc/src/sched/linux/sched_getcpucount.cpp | ||
33 | We can use __builtin_popcountl here as this function will only be used with LLVM libc's definition of cpu_set_t. |
move function definition into llvm_libc_ext.td
rename function to __sched_getcpucount
libc/include/llvm-libc-macros/linux/sched-macros.h | ||
---|---|---|
14 | CPU_COUNT_S is another macro that linux defines, and given that that exists it makes more sense to have one internal function that takes the same arguments and just chain the macros like this. | |
libc/spec/gnu_ext.td | ||
56 | in that case I should probably also move __llvm_libc_syscall into llvm_libc_ext.td in a followup patch. |
libc/spec/gnu_ext.td | ||
---|---|---|
56 | Yes, I missed that. |
These macros get activated only in the full build mode. So, do we really need a separate helper like CPU_COUNT_S? The internal function can be llvm libc only (as in full build only) and can take a single argument for the set?