MIPS/compiler_rt: use synci to flush icache on r6
syscall makes it failed to build on mips64 for mipsel: ``` compiler-rt/lib/builtins/clear_cache.c:97:3: error: call to undeclared function 'syscall'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE); ``` In this patch, we use `rdhwr` to get synci_step. If synci_step is zero, it means that the hardware will maintain the coherence. We need to do nothing. Then for r6+, `synci` is required to keep icache global. So we can use `synci` to flush icache. The ISA documents ask a `sync` and a `jr.hb` after `synci`. For pre-r6, we can use cacheflush libc function, which is same on Linux and FreeBSD. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D135565
Loading
Please sign in to comment