[PATCH] [MIPS64] Make __clear_cache more optimal
Joerg Sonnenberger
joerg at NetBSD.org
Wed Dec 17 09:29:07 PST 2014
================
Comment at: lib/builtins/clear_cache.c:27
@@ +26,3 @@
+ */
+ void clear_mips_cache(const void* Addr, size_t Size);
+ asm(
----------------
petarj wrote:
> joerg wrote:
> > Missing static to not pollute global namespace?
> Adding static will trigger a warning:
>
> warning: function 'clear_mips_cache' has internal linkage but is not defined [-Wundefined-internal]
__attribute__((__used__)) should disable the warning again?
================
Comment at: lib/builtins/clear_cache.c:31
@@ +30,3 @@
+ ".align 2\n"
+ ".globl clear_mips_cache\n"
+ "clear_mips_cache:\n"
----------------
petarj wrote:
> joerg wrote:
> > This should go away too. Why do you not use inline asm and let the compiler create the call and/or inline it? I'd prefer that...
> This code needs to clear instruction hazards at its end, and using "jr.hb" is the most appropriate way to do so.
> Making a version that could be inlined would, I believe, require a non-optimal trick to get pc value.
> So, having this in a separate function is more optimal.
> Last, the call to clear_mips_cache() will be accompanied with CALL16 relocations, and removing a .globl directive will trigger an error:
>
> "CALL16 reloc at 0xAB not against global symbol"
OK, so inline is not an option. That doesn't explain why it has to be global -- the warning above can be silenced, so what is the problem with declaring a file-local version?
http://reviews.llvm.org/D6661
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list