[compiler-rt] r228767 - [mips] Add __clear_cache() definition for non-Android systems

Petar Jovanovic petar.jovanovic at imgtec.com
Tue Feb 10 15:36:20 PST 2015


Author: petarj
Date: Tue Feb 10 17:36:19 2015
New Revision: 228767

URL: http://llvm.org/viewvc/llvm-project?rev=228767&view=rev
Log:
[mips] Add __clear_cache() definition for non-Android systems

Make sure clear_cache() builtin has an appropriate definition for Linux.
Call syscall(NR_cacheflush, ...).

Differential Revision: http://reviews.llvm.org/D7205

Modified:
    compiler-rt/trunk/lib/builtins/clear_cache.c

Modified: compiler-rt/trunk/lib/builtins/clear_cache.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/clear_cache.c?rev=228767&r1=228766&r2=228767&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/clear_cache.c (original)
+++ compiler-rt/trunk/lib/builtins/clear_cache.c Tue Feb 10 17:36:19 2015
@@ -22,10 +22,10 @@
   #include <machine/sysarch.h>
 #endif
 
-#if defined(__ANDROID__) && defined(__mips__)
+#if defined(__mips__)
   #include <sys/cachectl.h>
   #include <sys/syscall.h>
-  #ifdef __LP64__
+  #if defined(__ANDROID__) && defined(__LP64__)
     /*
      * clear_mips_cache - Invalidates instruction cache for Mips.
      */
@@ -109,10 +109,10 @@ void __clear_cache(void *start, void *en
     #else
         compilerrt_abort();
     #endif
-#elif defined(__ANDROID__) && defined(__mips__)
+#elif defined(__mips__)
   const uintptr_t start_int = (uintptr_t) start;
   const uintptr_t end_int = (uintptr_t) end;
-    #ifdef __LP64__
+    #if defined(__ANDROID__) && defined(__LP64__)
         // Call synci implementation for short address range.
         const uintptr_t address_range_limit = 256;
         if ((end_int - start_int) <= address_range_limit) {





More information about the llvm-commits mailing list