[PATCH] [MIPS64] Make __clear_cache more optimal

Petar Jovanovic petarj at mips.com
Tue Dec 16 10:28:20 PST 2014


================
Comment at: lib/builtins/clear_cache.c:27
@@ +26,3 @@
+     */
+    void clear_mips_cache(const void* Addr, size_t Size);
+      asm(
----------------
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]

================
Comment at: lib/builtins/clear_cache.c:31
@@ +30,3 @@
+        ".align 2\n"
+        ".globl clear_mips_cache\n"
+        "clear_mips_cache:\n"
----------------
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"

http://reviews.llvm.org/D6661

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list