[LLVMdev] __builtin___clear_cache

JF Bastien jfb at google.com
Fri Mar 14 10:06:44 PDT 2014


>
> The builtin was created to call __clear_cache() on platforms that need
> it (like ARM and MIPS), but to be ignored on others (like x86_64).
>
> This builtin should call __clear_cache() from whatever library is
> available at the moment, so there is no overlap, just supporting the
> GCC builtin to avoid calling a noop function when not needed.
>

I see, this makes sense. Agreed it's useful, thanks for explaining.


> That's an idea that might not be a good one. I was thinking if, in
> some occasions, we could emit directly the instructions, but that will
> have to deal with lower level stuff that we don't want on the
> intrinsic level. GCC just emits a call to __clear_cache() and, at the
> very least, we should do the same for now.
>
> That optimisation might come later, at a much lower level, but I have
> my doubts if that's relevant. We shouldn't be clearing the cache on a
> hot loop anyway. ;)


Maybe a naive question, but it seems better to just use inlining instead of
reimplementing the same logic within LLVM. That requires static
linking/LTO, so it's not that workable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140314/d5b27d8d/attachment.html>


More information about the llvm-dev mailing list